3

We're currently in the process of upgrading to Sitecore 8.2 Update-3, and as part of this are finally moving customizations out of the Sitecore.config into patch files.

One of our needs is to define a new database element for a production/content delivery database on our authoring server.

This means that we have a patch file that looks like this on the server:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <databases>
            <!-- Edit will need to be able to point to both the edit and production databases. -->
            <database id="prodweb" singleInstance="true" type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel" patch:after="database[@id='web']">
                <param desc="name">$(id)</param>
                <icon>Network/16x16/earth.png</icon>
                <securityEnabled>true</securityEnabled>
                <dataProviders hint="list:AddDataProvider">
                    <dataProvider ref="dataProviders/main" param1="$(id)">
                        <disableGroup>publishing</disableGroup>
                        <prefetch hint="raw:AddPrefetch">
                            <sc.include file="/App_Config/Prefetch/Common.config"/>
                            <sc.include file="/App_Config/Prefetch/Webdb.config"/>
                        </prefetch>
                    </dataProvider>
                </dataProviders>
                <proxiesEnabled>false</proxiesEnabled>
                <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)"/>
                <archives hint="raw:AddArchive">
                    <archive name="archive"/>
                    <archive name="recyclebin"/>
                </archives>
                <cacheSizes hint="setting">
                    <data>20MB</data>
                    <items>10MB</items>
                    <paths>500KB</paths>
                    <itempaths>10MB</itempaths>
                    <standardValues>500KB</standardValues>
                </cacheSizes>
            </database>
        </databases>
    </sitecore>
</configuration>

If we pull up the admin page that shows the final config, https://example.com/sitecore/admin/showconfig.aspx we have the following, where we can see that sc.include elements aren't being replaced as they are with the other sites.

<?xml version="1.0"?>
<sitecore xmlns:patch="http://www.sitecore.net/xmlconfig/" database="SqlServer">
    <databases>
        <!-- web -->
        <database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
            <param desc="name">$(id)</param>
            <icon>Images/database_web.png</icon>
            <securityEnabled>true</securityEnabled>
            <dataProviders hint="list:AddDataProvider">
                <dataProvider ref="dataProviders/main" param1="$(id)">
                    <disableGroup>publishing</disableGroup>
                    <prefetch hint="raw:AddPrefetch">
                        <childLimit>100</childLimit>
                        <logStats>false</logStats>
                        <template desc="template">{AB86861A-6030-46C5-B394-E8F99E8B87DB}</template>
                        <template desc="template section">{E269FBB5-3750-427A-9149-7AA950B49301}</template>
                        <template desc="template field">{455A3E98-A627-4B40-8035-E683A0331AC7}</template>
                        <template desc="node">{239F9CF4-E5A0-44E0-B342-0F32CD4C6D8B}</template>
                        <template desc="folder">{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}</template>
                        <template desc="language">{F68F13A6-3395-426A-B9A1-FA2DC60D94EB}</template>
                        <template desc="device">{B6F7EEB4-E8D7-476F-8936-5ACE6A76F20B}</template>
                        <item desc="root">{11111111-1111-1111-1111-111111111111}</item>
                        <children desc="main sections">{11111111-1111-1111-1111-111111111111}</children>
                        <!--
    scdev: 10MB
    scstage: 10MB
    scedit: 75MB
    scprod: 150MB
    -->
                        <cacheSize>50MB</cacheSize>
                        <template desc="alias">{54BCFFB7-8F46-4948-AE74-DA5B6B5AFA86}</template>
                        <template desc="layout">{3A45A723-64EE-4919-9D41-02FD40FD1466}</template>
                        <template desc="xsl rendering">{F1F1D639-4F54-40C2-8BE0-81266B392CEB}</template>
                        <item desc="home">{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}</item>
                        <children desc="main items">{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}</children>
                    </prefetch>
                </dataProvider>
            </dataProviders>
            <proxiesEnabled>false</proxiesEnabled>
            <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" />
            <archives hint="raw:AddArchive">
                <archive name="archive" />
                <archive name="recyclebin" />
            </archives>
            <cacheSizes hint="setting">
                <data>100MB</data>
                <items>50MB</items>
                <paths>2500KB</paths>
                <itempaths>50MB</itempaths>
                <standardValues>2500KB</standardValues>
            </cacheSizes>
            <Engines.DataEngine.Commands.AddFromTemplatePrototype patch:source="Sitecore.Buckets.config">
                <obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
            </Engines.DataEngine.Commands.AddFromTemplatePrototype>
        </database>
        <!-- Edit will need to be able to point to both the edit and production databases. -->
        <database id="prodweb" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel" patch:source="Wsb.Sites.config">
            <param desc="name">$(id)</param>
            <icon>Network/16x16/earth.png</icon>
            <securityEnabled>true</securityEnabled>
            <dataProviders hint="list:AddDataProvider">
                <dataProvider ref="dataProviders/main" param1="$(id)">
                    <disableGroup>publishing</disableGroup>
                    <prefetch hint="raw:AddPrefetch">
                        <sc.include file="/App_Config/Prefetch/Common.config" />
                        <sc.include file="/App_Config/Prefetch/Webdb.config" />
                    </prefetch>
                </dataProvider>
            </dataProviders>
            <proxiesEnabled>false</proxiesEnabled>
            <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" />
            <archives hint="raw:AddArchive">
                <archive name="archive" />
                <archive name="recyclebin" />
            </archives>
            <cacheSizes hint="setting">
                <data>20MB</data>
                <items>10MB</items>
                <paths>500KB</paths>
                <itempaths>10MB</itempaths>
                <standardValues>500KB</standardValues>
            </cacheSizes>
        </database>
    </databases>
</sitecore>

I can't find any documentation about this, so while things appear to be working properly, I'm unclear whether it's okay that the sc.include elements are not being expanded in this view for the site being patched in.

Should I update the patch file to manually include the items from the two config files (/App_Config/Prefetch/Common.config and /App_Config/Prefetch/Webdb.config) or will Sitecore still do the necessary replacements?

Or is there a better way to add a new site via Sitecore patch files?

Thanks!

4

It’s a bug, public reference number 91385.

Problem

<sc.include> cannot be expanded, when it is used in a config file under the Include folder

Workaround

Manually include items from the referenced configs (or move your configuration to sitecore.config)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.