November Happy Hour will be moved to Thursday December 5th.

Mattias Lövström
Sep 8, 2010
  6464
(0 votes)

Copy many pages in edit mode

We gets some complains of that is not possible to copy a lot of pages in edit mode, so I tried to run the copying functionality in a different thread - and it works better than I have expected.

Remarks: This is not fully tested and should not be run in a production environment without seriously testing and documentation to the editors.

Background

When we deliver EPiServer CMS 5 a developer think that it should be cool to be able to run the copy function in a separate thread, unfortunately he was a terrible at both GUI design and user experience. So the function was horrible to use; and the function was removed – BUT the API resists.

Many years later we delivered Mirroring 2, enhanced editorial GUI and page providers that make it possible to test this functionality out – and it work better than I have expected! (I miss some progress indicator that tells me the status of the copying process).

Requirements

EPiServer CMS 6

Implementation to try it out

Create a page provider that inheriting from EPiServers LocalPageProvider and override the copy function to always set the argument allowThreading to true.

Source code

using EPiServer;
 
namespace ForceThreadedCopyPageProvider
{
    public class OverridedLocalPageProvider : LocalPageProvider
    {
        public override EPiServer.Core.PageReference Copy(EPiServer.Core.PageReference pageLink, EPiServer.Core.PageReference destinationLink, bool publishOnDestination, bool allowThreading)
        {
            return base.Copy(pageLink, destinationLink, publishOnDestination, true);
        }
    }
}

Configuration in episerver.config

<episerver>
  ...
  <pageProvider>
    <providers>
      <add name="default"
           type="ForceThreadedCopyPageProvider.OverridedLocalPageProvider, ForceThreadedCopyPageProvider"
           capabilities="Create,Edit,Delete,Move,Copy,MultiLanguage,Security,Search,PageFolder" />
    </providers>
  </pageProvider>

Test it out

I created a page with 13’000 sub pages (by copying the start page several times). Then I copy this page by right clicking in the editorial GUI, and paste it on the start page.

On my developing machine it took 23 minutes, and when it was ready it automatically updates the web tree with the copied page (even when I had worked during the operation) – Great!

Download binary

ForcethreadedCopyPageProvider.zip

Sep 08, 2010

Comments

Sep 21, 2010 10:33 AM

Another option if you want to copy a large structure in a site is to set up a "one time" mirroring channel for the copy. The disadvantage is of course that it requires an admin account and that it is not doable by a simple rightclick. The advantage though is that the copying is done "out of process" and will not affect the performance of the site.

Sep 21, 2010 10:33 AM

Another option is to use the export/import functionality in the admin mode. But then again, you need to be admin, which might defeat the whole purpose ;)

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog