public function ToolbarController::flushPhp in Helper 8
Flush the PHP caches.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse Reloads the page.
1 string reference to 'ToolbarController::flushPhp'
File
- src/
Controller/ ToolbarController.php, line 61
Class
- ToolbarController
- Toolbar controller.
Namespace
Drupal\helper\ControllerCode
public function flushPhp() {
if (function_exists('opcache_reset')) {
opcache_reset();
$this
->messenger()
->addMessage($this
->t('PHP opcache cleared using opcache_reset().'));
}
if (function_exists('apc_cache_clear')) {
apc_cache_clear();
apc_clear_cache('user');
apc_clear_cache('opcode');
$this
->messenger()
->addMessage($this
->t('PHP APC cache cleared using apc_cache_clear().'));
}
clearstatcache();
$this
->messenger()
->addMessage($this
->t('File status cache cleared using clearstatcache().'));
return new RedirectResponse($this
->reloadPage());
}