Browse Source

?/debug/apc

pull/40/head
Michael Foster 11 years ago
parent
commit
39be89ba49
  1. 2
      inc/config.php
  2. 13
      inc/mod/pages.php
  3. 1
      mod.php
  4. 23
      templates/mod/debug/apc.html

2
inc/config.php

@ -1340,6 +1340,8 @@
$config['mod']['news_delete'] = ADMIN;
// Execute un-filtered SQL queries on the database (?/debug/sql)
$config['mod']['debug_sql'] = DISABLED;
// Look through all cache values for debugging when APC is enabled (?/debug/apc)
$config['mod']['debug_apc'] = ADMIN;
// Edit the current configuration (via web interface)
$config['mod']['edit_config'] = ADMIN;
// View ban appeals

13
inc/mod/pages.php

@ -2354,3 +2354,16 @@ function mod_debug_sql() {
mod_page(_('Debug: SQL'), 'mod/debug/sql.html', $args);
}
function mod_debug_apc() {
global $config;
if (!hasPermission($config['mod']['debug_apc']))
error($config['error']['noaccess']);
if ($config['cache']['enabled'] != 'apc')
error('APC is not enabled.');
$cached_vars = new APCIterator('user', '/^' . $config['cache']['prefix'] . '/');
mod_page(_('Debug: APC'), 'mod/debug/apc.html', array('cached_vars' => $cached_vars));
}

1
mod.php

@ -89,6 +89,7 @@ $pages = array(
// these pages aren't listed in the dashboard without $config['debug']
'/debug/antispam' => 'debug_antispam',
'/debug/recent' => 'debug_recent_posts',
'/debug/apc' => 'debug_apc',
'/debug/sql' => 'secure_POST debug_sql',
// This should always be at the end:

23
templates/mod/debug/apc.html

@ -0,0 +1,23 @@
<table class="modlog">
<tr>
<th class="minimal">Key</th>
<th class="minimal">Hits</th>
<th class="minimal">Created</th>
<th class="minimal">Expires</th>
<th class="minimal">Size</th>
<th>Value</th>
</tr>
{% for var in cached_vars %}
<tr>
<td class="minimal">{{ var.key }}</td>
<td class="minimal">{{ var.num_hits }}</td>
<td class="minimal">{{ var.creation_time|ago }} ago</td>
<td class="minimal">{{ (var.creation_time + var.ttl)|until }} (ttl: {{ var.ttl }}s)</td>
<td class="minimal">{{ var.mem_size }} bytes</td>
<td style="word-wrap:break-word">
{% set value = var.value|json_encode %}
<code>{{ value[:80]|e('html') }}{% if value|length > 80 %}&hellip;{% endif %}</code>
</td>
</tr>
{% endfor %}
</table>
Loading…
Cancel
Save