public static function dispatchUtils() { if ($_POST['password'] != self::_getHttpPassword()) { throw new Kwf_Exception_AccessDenied(); } $uri = $_SERVER['REQUEST_URI']; $baseUrl = Kwf_Setup::getBaseUrl(); if ($baseUrl && substr($uri, 0, strlen($baseUrl)) == $baseUrl) { $uri = substr($uri, strlen($baseUrl)); } if (substr($uri, 0, 25) == '/kwf/util/apc/clear-cache') { $s = microtime(true); if (isset($_REQUEST['deleteCacheSimple'])) { foreach (explode(',', $_REQUEST['deleteCacheSimple']) as $id) { Kwf_Cache_Simple::delete($id); } } if (isset($_REQUEST['clearCacheSimpleStatic'])) { foreach (explode(',', $_REQUEST['clearCacheSimpleStatic']) as $id) { Kwf_Cache_SimpleStatic::clear($id); } } if (isset($_REQUEST['deleteCacheSimpleStatic'])) { foreach (explode(',', $_REQUEST['deleteCacheSimpleStatic']) as $id) { Kwf_Cache_SimpleStatic::delete($id); } } if (isset($_REQUEST['cacheIds'])) { foreach (explode(',', $_REQUEST['cacheIds']) as $cacheId) { apc_delete($cacheId); } } if (isset($_REQUEST['files']) && function_exists('apc_delete_file')) { foreach (explode(',', $_REQUEST['files']) as $file) { @apc_delete_file($file); } } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'user') { if (extension_loaded('apcu')) { apc_clear_cache(); } else { apc_clear_cache('user'); } } else { if (!extension_loaded('apcu')) { apc_clear_cache('file'); } } } echo 'OK ' . round((microtime(true) - $s) * 1000) . ' ms'; exit; } else { if (substr($uri, 0, 24) == '/kwf/util/apc/save-cache') { $data = unserialize($_REQUEST['data']); if (apc_store($_REQUEST['id'], $data)) { echo 'OK'; } else { echo 'ERROR'; } exit; } else { if (substr($uri, 0, 31) == '/kwf/util/apc/get-counter-value') { $prefix = Kwf_Cache::getUniquePrefix() . 'bench-'; echo apc_fetch($prefix . $_GET['name']); exit; } else { if ($uri == '/kwf/util/apc/stats') { self::stats(); } else { if ($uri == '/kwf/util/apc/iterate') { self::iterate(); } else { if ($uri == '/kwf/util/apc/is-loaded') { if (extension_loaded('apc')) { echo 'OK1'; } else { echo 'OK0'; } exit; } else { if ($uri == '/kwf/util/apc/get-hostname') { echo php_uname('n'); exit; } } } } } } } throw new Kwf_Exception_NotFound(); }