3 +----------------------------------------------------------------------+
4 | eAccelerator control panel |
5 +----------------------------------------------------------------------+
6 | Copyright (c) 2004-2006 eAccelerator |
7 | http://eaccelerator.net |
8 +----------------------------------------------------------------------+
9 | This source file is subject to version 2.00 of the Zend license, |
10 | that is bundled with this package in the file LICENSE, and is |
11 | available through the world-wide-web at the following url: |
12 | http://www.zend.com/license/2_00.txt. |
13 | If you did not receive a copy of the Zend license and are unable to |
14 | obtain it through the world-wide-web, please send a note to |
15 | license@zend.com so we can mail you a copy immediately. |
16 +----------------------------------------------------------------------+
21 if (!function_exists('eaccelerator_info')) {
22 die('eAccelerator isn\'t installed or isn\'t compiled with info support!');
31 if (!isset($_SERVER['PHP_AUTH_USER']) ||
!isset($_SERVER['PHP_AUTH_USER']) ||
32 $_SERVER['PHP_AUTH_USER'] != $user ||
$_SERVER['PHP_AUTH_PW'] != $pw) {
33 header('WWW-Authenticate: Basic realm="eAccelerator control panel"');
34 header('HTTP/1.0 401 Unauthorized');
39 /* {{{ process any commands */
40 $info = eaccelerator_info();
41 if (isset($_POST['caching'])) {
43 eaccelerator_caching(false);
45 eaccelerator_caching(true);
47 } else if (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) {
48 if ($info['optimizer']) {
49 eaccelerator_optimizer(false);
51 eaccelerator_optimizer(true);
53 } else if (isset($_POST['clear'])) {
55 } else if (isset($_POST['clean'])) {
57 } else if (isset($_POST['purge'])) {
60 $info = eaccelerator_info();
63 function compare($x, $y)
67 if ( $x[$sortby] == $y[$sortby] )
69 else if ( $x[$sortby] < $y[$sortby] )
75 function revcompare($x, $y)
79 if ( $x[$sortby] == $y[$sortby] )
81 else if ( $x[$sortby] < $y[$sortby] )
87 /* {{{ create_script_table */
88 function create_script_table($list) {
91 if (isset($_GET['order']) && ($_GET['order'] == "asc" ||
$_GET['order'] =="desc")) {
92 $order = $_GET['order'];
97 if (isset($_GET['sort'])) {
98 switch ($_GET['sort']) {
103 $sortby = $_GET['sort'];
104 ($order == "asc" ?
uasort($list, 'compare') : uasort($list, 'revcompare'));
108 ($order == "asc" ?
uasort($list, 'compare') : uasort($list, 'revcompare'));
115 <th
><a href
="<?=$_SERVER['PHP_SELF']?>?sort=file&order=<?=($order == "asc
" ? "desc
" : "asc
")?>">Filename
</a
> 
;<?
if($sortby == "file") echo ($order == "asc" ?
"↓" : "↑")?
></th
>
116 <th
><a href
="<?=$_SERVER['PHP_SELF']?>?sort=mtime&order=<?=($order == "asc
" ? "desc
" : "asc
")?>">MTime
</a
> 
;<?
if($sortby == "mtime") echo ($order == "asc" ?
"↓" : "↑")?
></th
>
117 <th
><a href
="<?=$_SERVER['PHP_SELF']?>?sort=size&order=<?=($order == "asc
" ? "desc
" : "asc
")?>">Size
</a
> 
;<?
if($sortby == "size") echo ($order == "asc" ?
"↓" : "↑")?
></th
>
118 <th
><a href
="<?=$_SERVER['PHP_SELF']?>?sort=reloads&order=<?=($order == "asc
" ? "desc
" : "asc
")?>">Reloads
</a
> 
;<?
if($sortby == "reloads") echo ($order == "asc" ?
"↓" : "↑")?
></th
>
119 <th
><a href
="<?=$_SERVER['PHP_SELF']?>?sort=hits&order=<?=($order == "asc
" ? "desc
" : "asc
")?>">Hits
</a
> 
;<?
if($sortby == "hits") echo ($order == "asc" ?
"↓" : "↑")?
></th
>
127 ($order == "asc" ?
uasort($list, 'compare') : uasort($list, 'revcompare'));
132 ($order == "asc" ?
uasort($list, 'compare') : uasort($list, 'revcompare'));
136 foreach($list as $script) { ?
>
138 <?php
if (function_exists('eaccelerator_dasm_file')) { ?
>
139 <td
class="e"><a href
="dasm.php?file=<?php echo $script['file']; ?>"><?php
echo $script['file']; ?
></a
></td
>
141 <td
class="e"><?php
echo $script['file']; ?
></td
>
143 <td
class="vr"><?php
echo date('Y-m-d H:i', $script['mtime']); ?
></td
>
144 <td
class="vr"><?php
echo number_format($script['size'] / 1024, 2); ?
> KB
</td
>
145 <td
class="vr"><?php
echo $script['reloads']; ?
> (<?php
echo $script['usecount']; ?
>)</td
>
146 <td
class="vr"><?php
echo $script['hits']; ?
></td
>
154 /* {{{ create_key_table */
155 function create_key_table($list) {
165 foreach($list as $key) {
168 <td
class="e"><?php
echo $key['name']; ?
></td
>
169 <td
class="vr"><?php
echo date('Y-m-d H:i', $key['created']); ?
></td
>
170 <td
class="vr"><?php
echo number_format($key['size']/1024, 3); ?
>KB
</td
>
172 if ($key['ttl'] == -1) {
174 } elseif ($key['ttl'] == 0) {
177 echo date('Y-m-d H:i', $key['ttl']);
189 /* {{{ print_header */
190 function print_header() { ?
>
191 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
192 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en">
194 <title
>eAccelerator control panel
</title
>
195 <meta http
-equiv
="Content-Type" content
="text/html; charset=ISO-8859-1" />
196 <meta http
-equiv
="Content-Style-Type" content
="text/css" />
197 <meta http
-equiv
="Content-Language" content
="en" />
199 <style type
="text/css" media
="all">
200 body
{background
-color
: #ffffff; color: #000000;}
201 body
, td
, th
, h1
, h2
{font
-family
: sans
-serif
;}
202 pre
{margin
: 0px
; font
-family
: monospace
;}
203 a
:link
{color
: #000099; text-decoration: none}
204 a
:hover
{text
-decoration
: underline
;}
205 table
{border
-collapse
: collapse
; width
: 800px
;}
206 .center
{text
-align
: center
;}
207 .center table
{ margin
-left
: auto
; margin
-right
: auto
; text
-align
: left
;}
208 .center th
{ text
-align
: center
!important
; }
209 td
, th
{ border
: 1px solid
#000000; font-size: 75%; vertical-align: baseline;}
210 h1
{font
-size
: 150%
;}
211 h2
{font
-size
: 125%
;}
212 .p
{text
-align
: left
;}
213 .e
{background
-color
: #ccccff; font-weight: bold; color: #000000;}
214 .h
,th
{background
-color
: #9999cc; font-weight: bold; color: #000000;}
215 .v
,td
{background
-color
: #cccccc; color: #000000;}
216 .vr
{background
-color
: #cccccc; text-align: right; color: #000000; white-space: nowrap;}
217 img
{float: right
; border
: 0px
;}
218 hr
{width
: 600px
; background
-color
: #cccccc; border: 0px; height: 1px; color: #000000;}
220 h1
{width
: 800px
; border
: 1px solid
#000000; margin-left: auto; margin-right: auto; background-color: #9999cc;}
228 <?php
print_header(); ?
>
229 <body
class="center">
230 <h1
>eAccelerator
<?php
echo $info['version']; ?
> control panel
</h1
>
232 <!-- {{{ information
-->
236 <td
class="e">Caching enabled
</td
>
237 <td
><?php
echo $info['cache'] ?
'yes':'no' ?
></td
>
240 <td
class="e">Optimizer enabled
</td
>
241 <td
><?php
echo $info['optimizer'] ?
'yes':'no' ?
></td
>
244 <td
class="e">Memory usage
</td
>
245 <td
><?php
echo number_format(100 * $info['memoryAllocated'] / $info['memorySize'], 2); ?
>%
246 (<?php
echo number_format($info['memoryAllocated'] / (1024*1024), 2); ?
>MB
/
247 <?php
echo number_format($info['memorySize'] / (1024*1024), 2); ?
>MB
)</td
>
250 <td
class="e">Free memory
</td
>
251 <td
><?php
echo number_format($info['memoryAvailable'] / (1024*1024), 2); ?
>MB
</td
>
254 <td
class="e">Cached scripts
</td
>
255 <td
><?php
echo $info['cachedScripts']; ?
></td
>
258 <td
class="e">Removed scripts
</td
>
259 <td
><?php
echo $info['removedScripts']; ?
></td
>
262 <td
class="e">Cached keys
</td
>
263 <td
><?php
echo $info['cachedKeys']; ?
></td
>
270 <form name
="ea_control" method
="post">
273 <td
class="e">Caching
</td
>
274 <td
><input type
="submit" name
="caching" value
="<?php echo $info['cache']?'disable':'enable'; ?>" /></td
>
277 <td
class="e">Optimizer
</td
>
278 <td
><input type
="submit" name
="optimizer" value
="<?php echo $info['optimizer']?'disable':'enable'; ?>" /></td
>
281 <td
class="e">Clear cache
</td
>
282 <td
><input type
="submit" name
="clear" value
="clear" title
="remove all unused scripts and data from shared memory and disk cache" /></td
>
285 <td
class="e">Clean cache
</td
>
286 <td
><input type
="submit" name
="clean" value
="clean" title
=" remove all expired scripts and data from shared memory and disk cache" /></td
>
289 <td
class="e">Purge cache
</td
>
290 <td
><input type
="submit" name
="purge" value
="purge" title
="remove all 'removed' scripts from shared memory" /></td
>
296 <h2
>Cached scripts
</h2
>
297 <?php
create_script_table(eaccelerator_cached_scripts()); ?
>
299 <h2
>Removed scripts
</h2
>
300 <?php
create_script_table(eaccelerator_removed_scripts()); ?
>
303 if (function_exists('eaccelerator_get')) {
304 echo "<h2>Cached keys</h2>";
305 create_key_table(eaccelerator_list_keys());
312 <tr
><td
class="center">
313 <a href
="http://eaccelerator.net"><img src
="?=<?php echo $info['logo']; ?>" alt
="eA logo" /></a
>
314 <strong
>Created by the eAccelerator team
, <a href
="http://eaccelerator.net">http
://eaccelerator.net</a></strong><br /><br />
315 <nobr
>eAccelerator
<?php
echo $info['version']; ?
> [shm
:<?php
echo $info['shm_type']?
> sem
:<?php
echo $info['sem_type']; ?
>]</nobr
><br
/>
316 <nobr
>PHP
<?php
echo phpversion();?
> [ZE
<?php
echo zend_version(); ?
>]</nobr
><br
/>
317 <nobr
>Using
<?php
echo php_sapi_name();?
> on
<?php
echo php_uname(); ?
></nobr
><br
/>
331 * vim600: noet sw=4 ts=4 fdm=marker
332 * vim<600: noet sw=4 ts=4