function eaccelerator_display($mode, $start = 0, $limit = 5, $sort = false)
{
    global $_CLASS, $sort_by;
    $total_count = 0;
    switch ($mode) {
        case 'scripts':
        case 'removed_scripts':
            $scripts_array = $mode === 'scripts' ? eaccelerator_cached_scripts() : eaccelerator_removed_scripts();
            if (!empty($scripts_array)) {
                $sort_by = 'mtime';
                usort($scripts_array, 'eaccelerator_compare');
                $total_count = count($scripts_array);
                $end = min($start + $limit, $total_count);
                for ($i = $start; $i < $end; $i++) {
                    $scripts_array[$i]['time'] = date('Y/m/d H:i', $scripts_array[$i]['mtime']);
                    $scripts_array[$i]['size'] = generate_size($scripts_array[$i]['size']);
                    $_CLASS['core_template']->assign_vars_array($mode . '_array', $scripts_array[$i]);
                }
            }
            break;
        case 'keys':
            $keys_array = eaccelerator_list_keys();
            if (!empty($keys_array)) {
                $sort_by = 'created';
                usort($keys_array, 'eaccelerator_compare');
                $total_count = count($keys_array);
                $end = min($start + $limit, $total_count);
                for ($i = $start; $i < $end; $i++) {
                    $keys_array[$i]['created'] = date('Y/m/d H:i', $keys_array[$i]['created']);
                    $keys_array[$i]['size'] = generate_size($keys_array[$i]['size']);
                    if ($keys_array[$i]['ttl'] == 0) {
                        $keys_array[$i]['expire_time'] = 'none';
                    } elseif ($keys_array[$i]['ttl'] == -1) {
                        $keys_array[$i]['expire_time'] = 'expired';
                    } else {
                        $keys_array[$i]['expire_time'] = date('Y/m/d H:i', $keys_array[$i]['ttl']);
                    }
                    $_CLASS['core_template']->assign_vars_array('keys_array', $keys_array[$i]);
                }
            }
            break;
    }
    $pagination = generate_pagination('eaccelerator&amp;mode=' . $mode, $total_count, $limit, $start, true);
    $_CLASS['core_template']->assign_array(array($mode . '_more' => $total_count < $limit ? false : true, $mode . '_pagination' => $pagination['formated'], $mode . '_pagination_array' => $pagination['array']));
}
 public function flush()
 {
     eaccelerator_gc();
     eaccelerator_clear();
     eaccelerator_removed_scripts();
 }
Пример #3
0
 public function info()
 {
     $info = array();
     $info['info'] = eaccelerator_info();
     $info['keys'] = eaccelerator_list_keys();
     $info['script'] = eaccelerator_cached_scripts();
     $info['script_remove'] = eaccelerator_removed_scripts();
     return $info;
 }
Пример #4
0
        <tr>
            <td class="e">Purge cache</td>
            <td><input type="submit" name="purge" value="purge" title="remove all 'removed' scripts from shared memory" /></td>
        </tr>
    </table>
</form>
<!-- }}} -->

<h2>Cached scripts</h2>
<?php 
create_script_table(eaccelerator_cached_scripts());
?>

<h2>Removed scripts</h2>
<?php 
create_script_table(eaccelerator_removed_scripts());
?>

<?php 
if (function_exists('eaccelerator_get')) {
    echo "<h2>Cached keys</h2>";
    create_key_table(eaccelerator_list_keys());
}
?>

<!-- {{{ footer -->
<br /><br />
<table>
    <tr><td class="center">
    <a href="http://eaccelerator.net"><img src="?=<?php 
echo $info['logo'];
Пример #5
0
print '</tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>Removed scripts</td>';
print '<td align="right">' . $info['removedScripts'] . '</td>';
print '</tr>';
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>Cached keys</td>';
print '<td align="right">' . (isset($info['cachedKeys']) ? $info['cachedKeys'] : '') . '</td>';
print '</tr>';
print '</table>';
$var = true;
$resCached = @eaccelerator_cached_scripts();
// If success return an array
$resRemoved = @eaccelerator_removed_scripts();
if (is_array($resCached) || is_array($resRemoved)) {
    print "<br>";
    print '<form name="ea_control" method="post">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<table class="noborder">';
    print '<tr class="liste_titre"><td colspan="2">Actions</td></tr>';
    if (is_array($resCached)) {
        $var = !$var;
        print "<tr " . $bc[$var] . ">";
        print "<td>Caching</td>";
        print '<td align="right"><input type="submit" class="butAction" name="caching" value="' . ($info['cache'] ? 'disable' : 'enable') . '" /></td>';
        print "</tr>";
        $var = !$var;
        print "<tr " . $bc[$var] . ">";
        print "<td>Optimizer</td>";
Пример #6
0
    <td class="ec"><input type="submit" name="clean" value=" Delete expired "/></td> 
    <td class="fl">Removed all expired scripts and data from shared memory and / or disk.</td>
</tr>
<tr>
    <td class="ec"><input type="submit" name="purge" value=" Purge cache "/></td> 
    <td class="fl">Delete all 'removed' scripts from shared memory.</td>
</tr>
</table>
</form>

<?php 
        break;
    case 1:
        /******************************     SCRIPT CACHE     ******************************/
        $scripts = eaccelerator_cached_scripts();
        $removed = eaccelerator_removed_scripts();
        // combine arrays
        function removedmod($val)
        {
            $val['removed'] = true;
            return $val;
        }
        $scripts = array_merge($scripts, array_map('removedmod', $removed));
        // search
        function scriptsearch($val)
        {
            $str = isset($_GET['str']) ? $_GET['str'] : '';
            return preg_match('/' . preg_quote($str, '/') . '/i', $val['file']);
        }
        $scripts = array_filter($scripts, 'scriptsearch');
        // sort