Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Excluding page types from Mirroring

Vote:
 

Hi all,

I've been asked to investigate some mirroring issues on an existing site we have recently taken on, which is running on CMS 6 R2 with Composer.

The issue is that the site is using the XMLPage provider, and during mirroring there is always an error thrown along the lines of:

22/05/2014 16:20:07 FAILED Mirroring job: 'Mirroring Job'
Mirroring state: Failure during export
The following errors occured:
[Exporting page 2277__Members] Exception: Object reference not set to an instance of an object.[]
SourceService: Exported 2253 pages
TargetService: Imported 0 pages, moved 0 pages, deleted 0 pages

The odd thing is that there is no page with the page reference id 2277 - it could perhaps be a composer object?

So, im wondering either:

- How to find out what this 2277 refers to, or:
- How to exclude certain page types from being mirrored. We do have an instance of the XMLPageProvider which pulls in Members, which sounds like the error message being thrown. So im wondering if I could igore all page types which are used for the page provider entry point?

Any help would be appreciated

Thanks in advance

Al

#86512
May 22, 2014 17:34
Vote:
 

Incase anyone comes across this in the future, the solution I came up with after a little reflection is:

[InitializableModule]
    [ModuleDependency(typeof(InitializableModule))]
    public class MirroringInitialization : IInitializableModule
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(MirroringInitialization));

        public void Preload(string[] parameters){}

        public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            DataExporter.PageExporting -= DataExporter_PageExporting;
        }

        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            DataExporter.PageExporting += DataExporter_PageExporting;
        }

        void DataExporter_PageExporting(DataExporter dataExporting, EPiServer.Enterprise.Enterprise.PageExportingEventArgs e)
        {
            var pageReference = e.PageReference;
            if (pageReference == PageReference.EmptyReference || PageReference.IsNullOrEmpty(pageReference))
            {
                e.Cancel = true;
            }

            var pageProvider = DataFactory.Instance.GetPageProvider(pageReference);
            if (pageProvider.Name == "XMLPageProvider")
            {
                e.Cancel = true;
            }
        } 
    }

Hope it helps

Al

#86558
May 23, 2014 15:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.