Mattias Lövström
Sep 8, 2010
  6394
(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
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024