public static function ajax_getCacheStats_callback() { $s = wfCache::getCacheStats(); if ($s['files'] == 0) { return array('ok' => 1, 'heading' => 'Cache Stats', 'body' => "The cache is currently empty. It may be disabled or it may have been recently cleared."); } $body = 'Total files in cache: ' . $s['files'] . '<br />Total directories in cache: ' . $s['dirs'] . '<br />Total data: ' . $s['data'] . 'KB'; if ($s['compressedFiles'] > 0) { $body .= '<br />Files: ' . $s['uncompressedFiles'] . '<br />Data: ' . $s['uncompressedKBytes'] . 'KB' . '<br />Compressed files: ' . $s['compressedFiles'] . '<br />Compressed data: ' . $s['compressedKBytes'] . 'KB'; } if ($s['largestFile'] > 0) { $body .= '<br />Largest file: ' . $s['largestFile'] . 'KB'; } if ($s['oldestFile'] !== false) { $body .= '<br />Oldest file in cache created '; if (time() - $s['oldestFile'] < 300) { $body .= time() - $s['oldestFile'] . ' seconds ago'; } else { $body .= human_time_diff($s['oldestFile']) . ' ago.'; } } if ($s['newestFile'] !== false) { $body .= '<br />Newest file in cache created '; if (time() - $s['newestFile'] < 300) { $body .= time() - $s['newestFile'] . ' seconds ago'; } else { $body .= human_time_diff($s['newestFile']) . ' ago.'; } } return array('ok' => 1, 'heading' => 'Cache Stats', 'body' => $body); }