0

I noticed a strange difference between our Production and QA Sitecore websites that was deliberately done by our Sitecore vendor.

In the SiteDefinition.config file, the site block is changed to MyCompanyName.

Why would this be different? Can I change the one on QA to match Production or will that break something?

QA:

<events>
  <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <site>MyCompanyName</site>
      </sites>
    </handler>
  </event>
  <event name="publish:end:remote">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <site>MyCompanyName</site>
      </sites>
    </handler>
  </event>
</events>

PROD:

    <events>
  <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <MyCompanyName>MyCompanyName</MyCompanyName>
      </sites>
    </handler>
  </event>
  <event name="publish:end:remote">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <MyCompanyName>MyCompanyName</MyCompanyName>
      </sites>
    </handler>
  </event>
</events>
  • Do you have any configuration transformations applied during building to your QA and Production environments, that changes the config files (possibly differently)? – Søren Engel Nov 8 '16 at 20:11
  • Actually, that is exactly what I am working on right now. We are using Octopus Deploy and I want to correct this if I can, because it seems odd. – ADH Nov 8 '16 at 20:13
  • 1
    i would ask that you do basic research around your question before posting. If you need assistance and interactive debugging, Slack is a better medium. – Mark Cassidy Nov 8 '16 at 20:15
5

This works because of the way that HtmlCacheClear processes the <sites> list.

When you take a peek into the code for HtmlCacheClearer.ClearCache() method, you'll see that it's iterating through the list of sites in a basic for() loop. Therefore, the element name of the list item makes no difference whatsoever.

As for how it changed to MyCompanyName in prod, I have no idea. Bad transform file? Either way, it doesn't matter.

You will be safe changing it on QA.

/// <summary>Clears the cache.</summary>
/// <param name="sender">The sender.</param>
/// <param name="args">The arguments.</param>
public void ClearCache(object sender, EventArgs args)
{

   ...

  for (int index = 0; index < this._sites.Count; ++index)
  {
    string siteName = this._sites[index] as string;

   ...

  }
   ...
}
| improve this answer | |
  • The change was deliberately done by our vendor. – ADH Nov 8 '16 at 20:17
  • 1
    I've seen it before and I think it was done to not overwrite other values in the "list" when patching it. But as Pete says, it does not matter.. – Gatogordo Nov 8 '16 at 20:19

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.