Try our conversational search powered by Generative AI!

Mattias Lövström
Sep 8, 2010
  6362
(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 and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

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