Created
November 25, 2013 11:48
-
-
Save angry-dan/29188f3f2fe93e632451 to your computer and use it in GitHub Desktop.
Allow Drupal's user 1 to clear the APC cache.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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