Try our conversational search powered by Generative AI!

Mattias Lövström
Sep 8, 2010
  6360
(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
The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024

Optimizely Search & Navigation: Boosting in Unified Search

In the Optimizely Search & Navigation admin view, administrators can set a certain weight of different properties (title, content, summary, or...

Tung Tran | Apr 15, 2024