*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/**
* \file htdocs/admin/tools/eaccelerator.php
* \brief Page administration de eaccelerator
*/
require '../../main.inc.php';
$langs->load("admin");
if (!$user->admin) accessforbidden();
/*
* View
*/
llxHeader();
if (!function_exists('eaccelerator_info'))
{
print 'eAccelerator is not installed.';
llxFooter();
exit;
}
$info = eaccelerator_info();
if (isset($_POST['caching'])) {
if ($info['cache']) {
eaccelerator_caching(false);
} else {
eaccelerator_caching(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();
if (!is_array($info)) {
dol_print_error('','An error occured getting eAccelerator information, this is caused if eAccelerator isn\'t initalised properly');
exit;
}
function compare($x, $y)
{
global $sortby;
if ( $x[$sortby] == $y[$sortby] )
return 0;
else if ( $x[$sortby] < $y[$sortby] )
return -1;
else
return 1;
}
/**
* Compare revisions
*
* @param array $x Parts of version 1
* @param array $y Parts of version 2
* @return int 1 if 1<2, 0 if 1=2, -1 if 1>2
*/
function revcompare($x, $y)
{
global $sortby, $langs;
if ( $x[$sortby] == $y[$sortby] )
return 0;
else if ( $x[$sortby] < $y[$sortby] )
return 1;
else
return -1;
}
/**
* Output table
*
* @param array $list Array of records
* @return void
*/
function create_script_table($list)
{
global $sortby,$bc,$langs;
$var=true;
if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) {
$order = $_GET['order'];
} else {
$order = "asc";
}
if (isset($_GET['sort'])) {
switch ($_GET['sort']) {
case "mtime":
case "size":
case "reloads":
case "hits":
$sortby = $_GET['sort'];
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
break;
default:
$sortby = "file";
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
}
}
?>
| Name |
Created |
trans("Size"); ?> |
ttl |
>
|
|
KB |
|
| Information |
>
| Caching enabled |
|
>
| Optimizer enabled |
|
>
| Memory usage |
%
(
MB /
MB) |
>
| Free memory in reserved cache |
MB |
>
| Cached scripts |
|
>
| Removed scripts |
|
>
| Cached keys |
|
";
print '";
}
if (is_array($resCached))
{
print "
";
print "Cached scripts
";
create_script_table($resCached);
}
if (is_array($resRemoved))
{
print "
";
print "Removed scripts
";
create_script_table($resRemoved);
}
}
else
{
print "
";
print "Check in your php.ini that eaccelerator.allowed_admin_path parameter is : ";
print "
";
print "".$_SERVER["SCRIPT_FILENAME"]."";
print "
";
}
if (function_exists('eaccelerator_get'))
{
print '
';
print 'Cached keys
';
$res=eaccelerator_list_keys();
create_key_table($res);
}
print "
";
llxFooter();
$db->close();
?>