Skip to content

Instantly share code, notes, and snippets.

@KristianP
Created February 15, 2012 12:32
Show Gist options
  • Save KristianP/1835389 to your computer and use it in GitHub Desktop.
Save KristianP/1835389 to your computer and use it in GitHub Desktop.
modx clear cache
<?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'] = '*';
$results= $modx->cacheManager->clearCache($paths, $options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment