Exemplo n.º 1
0
        /// <summary>
        /// 1. export repository as a zip file.
        /// 2. offline the site.
        /// 3. zip the site directory as a zip file.
        /// 4. online the site.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="outputStream"></param>
        public void Export(Site site, System.IO.Stream outputStream)
        {
            ISiteProvider siteRepository = Providers.SiteProvider;

            siteRepository.Offline(site);
            try
            {
                //export the data to disk.
                ExportLabels(site, true);
                ExportPages(site, true);
                ExportHtmlBlocks(site, true);

                using (ZipFile zipFile = new ZipFile(Encoding.UTF8))
                {
                    //zipFile.ZipError += new EventHandler<ZipErrorEventArgs>(zipFile_ZipError);

                    zipFile.AddSelectedFiles("name != *\\~versions\\*.* and name != *\\.svn\\*.* and name != *\\_svn\\*.*", site.PhysicalPath, "", true);

                    ExportSiteRepository(site, site, zipFile);

                    zipFile.ZipErrorAction = ZipErrorAction.Skip;

                    zipFile.Save(outputStream);
                }
            }
            finally
            {
                siteRepository.Online(site);
            }
        }
Exemplo n.º 2
0
 public void Online(Site site)
 {
     try
     {
         inner.Online(site);
     }
     finally
     {
         CacheManagerFactory.DefaultCacheManager.ClearGlobalObjectCache();
     }
 }