Skip to content

Instantly share code, notes, and snippets.

@AFaust
Created November 29, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AFaust/baee9a32a10c8e7110bfa54d9b512292 to your computer and use it in GitHub Desktop.
Save AFaust/baee9a32a10c8e7110bfa54d9b512292 to your computer and use it in GitHub Desktop.
Alfresco JavaScript Console script to reset the theme of all sites in Alfresco to the system default
var sites, idx, site, dashboard, xmlConfig;
sites = search.query({ language: 'fts-alfresco', query: 'TYPE:"st:sites"'});
for (idx = 0; idx < sites.length; idx++)
{
site = sites[idx];
dashboard = site.childrenByXPath('cm:surf-config/cm:pages/cm:site/cm:' + site.name + '/cm:dashboard.xml')[0];
xmlConfig = dashboard.content;
if (/<theme>/.test(xmlConfig))
{
print('Resetting theme for site ' + site.name);
xmlConfig = String(xmlConfig).replace(/<theme>[^<]+<\/theme>/, '');
dashboard.content = xmlConfig;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment