2016-01-20 21:12:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
2022-04-28 14:49:11 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2016-01-20 21:12:43 +00:00
|
|
|
*
|
2022-04-28 14:49:11 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2022-04-28 18:48:00 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2022-04-28 14:49:11 +00:00
|
|
|
* GNU General Public License for more details.
|
2016-01-20 21:12:43 +00:00
|
|
|
*
|
2022-04-28 14:49:11 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you can also view it online at
|
2022-04-28 18:48:00 +00:00
|
|
|
* https://files.froxlor.org/misc/COPYING.txt
|
2016-01-20 21:12:43 +00:00
|
|
|
*
|
2022-04-28 14:49:11 +00:00
|
|
|
* @copyright the authors
|
|
|
|
* @author Froxlor team <team@froxlor.org>
|
|
|
|
* @author Janos Muzsi <muzsij@hypernics.hu>
|
|
|
|
* @author Andrew Collington <andy@amnuts.com>
|
2022-04-28 18:48:00 +00:00
|
|
|
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
|
2022-04-28 14:49:11 +00:00
|
|
|
*
|
|
|
|
* Based on https://github.com/amnuts/opcache-gui, which is
|
|
|
|
* licensed under the MIT licence, which can be viewed
|
|
|
|
* online at https://acollington.mit-license.org/
|
2016-01-20 21:12:43 +00:00
|
|
|
*/
|
2022-02-20 17:00:44 +00:00
|
|
|
|
|
|
|
const AREA = 'admin';
|
|
|
|
require __DIR__ . '/lib/init.php';
|
2016-01-20 21:12:43 +00:00
|
|
|
|
2022-04-28 18:48:00 +00:00
|
|
|
use Froxlor\FroxlorLogger;
|
2023-06-12 10:15:52 +00:00
|
|
|
use Froxlor\UI\HTML;
|
2022-03-25 08:32:33 +00:00
|
|
|
use Froxlor\UI\Panel\UI;
|
2022-04-28 18:48:00 +00:00
|
|
|
use Froxlor\UI\Response;
|
2022-03-25 08:32:33 +00:00
|
|
|
|
2018-12-22 07:15:31 +00:00
|
|
|
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
|
2022-12-31 08:08:34 +00:00
|
|
|
if ($_POST['send'] == 'send') {
|
|
|
|
opcache_reset();
|
|
|
|
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "reset OPcache");
|
|
|
|
header('Location: ' . $linker->getLink([
|
|
|
|
'section' => 'opcacheinfo',
|
|
|
|
'page' => 'showinfo'
|
|
|
|
]));
|
|
|
|
exit();
|
|
|
|
} else {
|
|
|
|
HTML::askYesNo('cache_reallydelete', $filename, [
|
|
|
|
'page' => $page,
|
|
|
|
'action' => 'reset',
|
|
|
|
], '', [
|
2022-04-28 18:48:00 +00:00
|
|
|
'section' => 'opcacheinfo',
|
|
|
|
'page' => 'showinfo'
|
2022-12-31 08:08:34 +00:00
|
|
|
]);
|
|
|
|
}
|
2016-01-20 21:12:43 +00:00
|
|
|
}
|
|
|
|
|
2023-06-12 10:15:52 +00:00
|
|
|
if (!extension_loaded('Zend OPcache')) {
|
2023-06-12 11:06:18 +00:00
|
|
|
Response::standardError('no_opcacheinfo');
|
2016-01-20 21:12:43 +00:00
|
|
|
}
|
|
|
|
|
2023-06-12 10:15:52 +00:00
|
|
|
$ocEnabled = ini_get('opcache.enable');
|
|
|
|
if (empty($ocEnabled)) {
|
2023-06-12 11:06:18 +00:00
|
|
|
Response::standardError('inactive_opcacheinfo');
|
2023-06-12 10:15:52 +00:00
|
|
|
}
|
|
|
|
|
2022-12-31 07:51:05 +00:00
|
|
|
if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') {
|
2018-12-21 11:24:07 +00:00
|
|
|
$time = time();
|
2022-04-28 18:48:00 +00:00
|
|
|
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2023-06-12 10:15:52 +00:00
|
|
|
$opcache = (new \Amnuts\Opcache\Service())->getData();
|
2022-03-25 08:32:33 +00:00
|
|
|
|
|
|
|
UI::view('settings/opcacheinfo.html.twig', [
|
|
|
|
'opcacheinfo' => [
|
2023-06-12 10:15:52 +00:00
|
|
|
'version' => $opcache['version'],
|
|
|
|
'overview' => $opcache['overview'],
|
|
|
|
'files' => $opcache['files'],
|
|
|
|
'preload' => $opcache['preload'],
|
|
|
|
'directives' => $opcache['directives'],
|
|
|
|
'blacklist' => $opcache['blacklist'],
|
|
|
|
'functions' => $opcache['functions'],
|
2022-03-25 08:32:33 +00:00
|
|
|
]
|
|
|
|
]);
|
2016-01-20 21:12:43 +00:00
|
|
|
}
|