public function clean() { eaccelerator_clean(); eaccelerator_clear(); eaccelerator_gc(); eaccelerator_purge(); return; }
/** * Save the local configuration file */ public function save() { if ($this->strTop == '') { $this->strTop = '<?php'; } $strFile = trim($this->strTop) . "\n\n"; $strFile .= "### INSTALL SCRIPT START ###\n"; foreach ($this->arrData as $k => $v) { $strFile .= "{$k} = {$v}\n"; } $strFile .= "### INSTALL SCRIPT STOP ###\n"; $this->strBottom = trim($this->strBottom); if ($this->strBottom != '') { $strFile .= "\n" . $this->strBottom . "\n"; } $strTemp = md5(uniqid(mt_rand(), true)); // Write to a temp file first $objFile = fopen(TL_ROOT . '/system/tmp/' . $strTemp, 'wb'); fputs($objFile, $strFile); fclose($objFile); // Make sure the file has been written (see #4483) if (!filesize(TL_ROOT . '/system/tmp/' . $strTemp)) { \System::log('The local configuration file could not be written. Have your reached your quota limit?', __METHOD__, TL_ERROR); return; } // Then move the file to its final destination $this->Files->rename('system/tmp/' . $strTemp, 'system/config/localconfig.php'); // Reset the Zend OPcache if (function_exists('opcache_invalidate')) { opcache_invalidate(TL_ROOT . '/system/config/localconfig.php', true); } // Reset the Zend Optimizer+ cache (unfortunately no API to delete just a single file) if (function_exists('accelerator_reset')) { accelerator_reset(); } // Recompile the APC file (thanks to Trenker) if (function_exists('apc_compile_file') && !ini_get('apc.stat')) { apc_compile_file(TL_ROOT . '/system/config/localconfig.php'); } // Purge the eAccelerator cache (thanks to Trenker) if (function_exists('eaccelerator_purge') && !ini_get('eaccelerator.check_mtime')) { @eaccelerator_purge(); } // Purge the XCache cache (thanks to Trenker) if (function_exists('xcache_count') && !ini_get('xcache.stat')) { if (($count = xcache_count(XC_TYPE_PHP)) > 0) { for ($id = 0; $id < $count; $id++) { xcache_clear_cache(XC_TYPE_PHP, $id); } } } }
/** * Refreshes all active opcode caches for the specified file * * @param string $path Path to the file * @return boolean True on success, false on failure */ protected static function refreshOpcodeCache($path) { try { // Zend OPcache if (function_exists('opcache_invalidate')) { opcache_invalidate($path, true); } // Zend Optimizer+ if (function_exists('accelerator_reset')) { accelerator_reset(); } // APC if (function_exists('apc_compile_file') && !ini_get('apc.stat')) { apc_compile_file($path); } // eAccelerator if (function_exists('eaccelerator_purge') && !ini_get('eaccelerator.check_mtime')) { @eaccelerator_purge(); } // XCache if (function_exists('xcache_count') && !ini_get('xcache.stat')) { if (($count = xcache_count(XC_TYPE_PHP)) > 0) { for ($id = 0; $id < $count; $id++) { xcache_clear_cache(XC_TYPE_PHP, $id); } } } // WinCache if (function_exists('wincache_refresh_if_changed')) { wincache_refresh_if_changed(array($path)); } } catch (\Exception $exception) { return false; } return true; }
} else { if (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) { if ($info['optimizer']) { eaccelerator_optimizer(false); } else { eaccelerator_optimizer(true); } } else { if (isset($_POST['clear'])) { eaccelerator_clear(); } else { if (isset($_POST['clean'])) { eaccelerator_clean(); } else { if (isset($_POST['purge'])) { eaccelerator_purge(); } } } } } $info = eaccelerator_info(); /* }}} */ /* {{{ create_script_table */ function create_script_table($list) { ?> <table class="scripts"> <tr> <th>Filename</th> <th>MTime</th>
/** * worker 进程结束 * @param $server * @param $worker_id */ public function onWorkerStop($server, $worker_id) { /** * clear opcode cache,only support apc/opcache/eaccelerator */ if (function_exists('apc_clear_cache')) { apc_clear_cache(); } if (function_exists('opcache_reset')) { opcache_reset(); } if (function_exists('eaccelerator_purge')) { @eaccelerator_purge(); } }