I search a external script for clear MODx revolution Cache. I have a script that import resurce from management system, when i finish of importing i want clear Cache and use this script:
function clearMODxCache(&$modx) {
// Clear the cache (taken from /core/model/modx/processors/system/clearcache.php)
$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', '.tpl.php'),
);
if ($modx->getOption('cache_db')) $options['objects'] = '*';
// The final magic
$results= $modx->cacheManager->clearCache($paths, $options);
}
but does not work.
You might try just this:
$cm = $modx->getCacheManager();
$cm->refresh();
$modx->reloadContext('web');
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html