/Main_Page

::You must have ninja focus to complete your mission::NinjaFocus::

EAccelerator Admin

Views:


A simple utility script to help administer eAccelerator, should do more, it's pretty similar in function to the script included in the eAccelerator source code. The zip file contains some css, too.

media:eaccelerator_admin.zip

You allow the admin function by adding a setting to the php config:

eaccelerator.allowed_admin_path = "/var/www/html/eaadmin"
<?php
function redirect($action = 'cached_scripts')
{
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/?a='.$action);
    die;
}

$action = null;
$error = false;
$info = null;
$list = null;
$title = null;

if (isset($_GET['a']))
{
    switch ($_GET['a'])
    {
        case 'cached_scripts': $action = 'cached_scripts'; break;
        case 'clean': $action = 'clean'; break;
        case 'clear': $action = 'clear'; break;
        case 'info': $action = 'info'; break;
        case 'removed_scripts': $action = 'removed_scripts'; break;
        case 'purge_scripts': $action = 'purge_scripts'; break;
    }
}

if ($action)
{
    switch ($action)
    {
        case 'info':            $info = eaccelerator_info();
                                break;
        case 'removed_scripts': $list = eaccelerator_removed_scripts();
                                $title = 'Removed Scripts';
                                break;
        case 'purge_scripts':   eaccelerator_purge_scripts();
                                redirect();
                                break;
        case 'cached_scripts':  $list = eaccelerator_cached_scripts();
                                $title = 'Cached Scripts';
                                break;
        case 'clean':           eaccelerator_clean();
                                redirect();
                                break;
        case 'clear':           eaccelerator_clear();
                                redirect();
                                break;
        default:                $error = 'Invalid Action';
                                break;
    }
}

?><!DOCTYPE html 
		PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>eAccelerator</title> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<link href="./styles.css" rel="stylesheet" type="text/css" media="all"></link>
</head>
<body>
        <h1>eAccelerator</h1>
        <div id="menu">
            <ul>
                <li><a href="./?a=cached_scripts">Cached Scripts</a></li>
                <li><a href="./?a=clean">Clean Cache</a></li>
                <li><a href="./?a=clear">Clear Cache</a></li>
                <li><a href="./?a=info">Info</a></li>
                <li><a href="./?a=removed_scripts">Removed Scripts</a></li>
                <li><a href="./?a=purge_scripts">Purge Scripts</a></li>
            </ul>
        </div>
        <div id="display">
            <?php if ($info):?>
                <h2>eAccelerator Information</h2>
                <table>
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Value</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($info as $name => $value):?>
                            <tr>
                                <td><?php echo htmlentities($name, ENT_COMPAT, 'UTF-8');?></td>
                                <td><?php echo htmlentities($value, ENT_COMPAT, 'UTF-8');?></td>
                            </tr>
                        <?php endforeach;?>
                    </tbody>
                </table>
            <?php elseif ($list):?>
                <h2><?php echo $title;?></h2>
                <ul style="list-style-type:none">
                    <?php foreach($list as $item):?>
                    <li><h3><?php echo htmlentities($item['file'], ENT_COMPAT, 'UTF-8');?></h3>
                        <ul style="list-style-type:none">
                            <li>Last Modified: <?php echo date('H:m:s d/m/Y', $item['mtime']);?></li>
                            <li>Size: <?php echo number_format($item['size']/1024.0);?>KB</li>
                            <li>Reloads: <?php echo htmlentities($item['reloads'], ENT_COMPAT, 'UTF-8');?></li>
                            <li>Use Count: <?php echo htmlentities($item['usecount'], ENT_COMPAT, 'UTF-8');?></li>
                            <li>Hits: <?php echo htmlentities($item['hits'], ENT_COMPAT, 'UTF-8');?></li>
                        </ul>
                    </li>
                    <?php endforeach;?>
                </ul>            
            <?php elseif ($error):?>
                <h2>Error!</h2>
                <p><?php echo $error;?></p>
            <?php endif;?>
        </div>
</body>
</html>

Main Menu

Personal tools

Toolbox