Skip to content

Instantly share code, notes, and snippets.

@angry-dan
Created November 25, 2013 11:48
Show Gist options
  • Save angry-dan/29188f3f2fe93e632451 to your computer and use it in GitHub Desktop.
Save angry-dan/29188f3f2fe93e632451 to your computer and use it in GitHub Desktop.
Allow Drupal's user 1 to clear the APC cache.
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if ($user->uid == 1) {
if (function_exists('apc_clear_cache')) {
apc_clear_cache('opcode');
drupal_set_message('APC cache cleared');
}
else {
drupal_set_message('APC api not available');
}
drupal_deliver_page('');
}
else{
drupal_deliver_page(MENU_ACCESS_DENIED);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment