SaaS CMS has officially launched! Learn more now.

Mattias Lövström
Sep 8, 2010
  6391
(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
A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024

Integrate a CMP workflow step with CMS

As you might know Optimizely has an integration where you can create and edit pages in the CMS directly from the CMP. One of the benefits of this i...

Marcus Hoffmann | Jul 10, 2024