Aha. I see. So can I just ’add’ the ’empty_cache’ permission to the ’Load Only’ policy?
While awaiting your response, I ended up lifting the following from [tt]/manager/controllers/default/system/refresh_site.php[/tt]
It seems to work -- but I guess your method is preferable?
<?php
$modx->invokeEvent('OnBeforeCacheUpdate');
$paths = array(
'config.cache.php',
'sitePublishing.idx.php',
'registry/mgr/workspace/',
'lexicon/',
);
$contexts = $modx->getCollection('modContext');
foreach ($contexts as $context) {
$paths[] = $context->get('key') . '/';
}
$options = array(
'publishing' => 1,
'extensions' => array('.cache.php', '.msg.php')
);
if ($modx->getOption('cache_db')) $options['objects'] = '*';
$results= $modx->cacheManager->clearCache($paths, $options);
return "Done!";