示例#1
0
        private void CreateSearchIndex(CmsSiteEnvironment ToEnvironment)
        {
            Search.SearchHelper.FillSearchIndex(this);

            CmsSiteEnvironment FromEnvironment = CurrentWorkingEnvironment;

            if (!FromEnvironment.Equals(ToEnvironment))
            {
                //zet om naar live database
                //create
                string sql = String.Format(@"CREATE TABLE IF NOT EXISTS {0}.searchindex LIKE {1}.searchindex;", ToEnvironment.DatabaseName, FromEnvironment.DatabaseName);
                DataBase.Get().Execute(sql);

                //delete
                sql = String.Format(@"DELETE FROM {0}.searchindex WHERE FK_Site='{1}';", ToEnvironment.DatabaseName, this.ID);
                DataBase.Get().Execute(sql);
                //insert
                sql = String.Format(@"INSERT INTO {0}.searchindex SELECT * FROM {1}.searchindex WHERE FK_Site='{2}';", ToEnvironment.DatabaseName, FromEnvironment.DatabaseName, this.ID);
                DataBase.Get().Execute(sql);
            }
        }
示例#2
0
        public bool Publish(CmsSiteEnvironment ToEnvironment, bool cleanUp, bool publishPages,
                            bool publishFilesAndImages, bool publishData, bool publishBin,
                            bool reGenerateSearchIndex, bool reGenerateSitemap)
        {
            CmsSiteEnvironment FromEnvironment = CurrentWorkingEnvironment;

            if (!FromEnvironment.Equals(ToEnvironment))
            {
                if (!System.IO.Directory.Exists(ToEnvironment.Path))
                {
                    System.IO.Directory.CreateDirectory(ToEnvironment.Path);
                }

                if (publishPages)
                {
                    FileHelper.EmptySiteDirectory(ToEnvironment.Path, publishFilesAndImages);
                    PublishDataBase(ToEnvironment);
                }

                if ((!Directory.Exists(ToEnvironment.Path + "\\bin") || publishBin))
                {
                    PublishBinAndBitplate(ToEnvironment);
                }

                if (!File.Exists(ToEnvironment.Path + "\\web.config") || publishBin)
                {
                    CreateWebConfig(ToEnvironment);
                }

                if (publishFilesAndImages)
                {
                    PublishFiles(ToEnvironment, false);
                }

                if (publishData)
                {
                    PublishDataCollection(ToEnvironment);
                }


                //if (publishData)
                //{
                //    PublishDataBase(ToEnvironment, cleanUp);
                //}
                //if (publishBin)
                //{
                //    PublishBinAndBitplate(ToEnvironment);
                //}
                //if (publishFilesAndImages)
                //{
                //    PublishFiles(ToEnvironment, cleanUp);
                //}
                //if (publishPages)
                //{
                //    PublishScripts(ToEnvironment, cleanUp);
                //    PublishPages(ToEnvironment, cleanUp);
                //}
            }

            if (reGenerateSearchIndex)
            {
                CreateSearchIndex(ToEnvironment);
            }
            if (reGenerateSitemap)
            {
                CreateSiteMap(ToEnvironment);
                CreateRobotsTxt(ToEnvironment);
            }


            return(true);
        }