Advertisement
Guest User

wincache.php

a guest
Jun 10th, 2012
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 66.60 KB | None | 0 0
  1. <?php
  2. /*
  3. +----------------------------------------------------------------------------------------------+
  4. | Windows Cache for PHP |
  5. +----------------------------------------------------------------------------------------------+
  6. | Copyright (c) 2009, Microsoft Corporation. All rights reserved. |
  7. | |
  8. | Redistribution and use in source and binary forms, with or without modification, are |
  9. | permitted provided that the following conditions are met: |
  10. | - Redistributions of source code must retain the above copyright notice, this list of |
  11. | conditions and the following disclaimer. |
  12. | - Redistributions in binary form must reproduce the above copyright notice, this list of |
  13. | conditions and the following disclaimer in the documentation and/or other materials provided |
  14. | with the distribution. |
  15. | - Neither the name of the Microsoft Corporation nor the names of its contributors may be |
  16. | used to endorse or promote products derived from this software without specific prior written|
  17. | permission. |
  18. | |
  19. | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
  20. | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
  21. | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
  22. | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
  23. | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE|
  24. | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
  25. | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
  26. | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
  27. | OF THE POSSIBILITY OF SUCH DAMAGE. |
  28. +----------------------------------------------------------------------------------------------+
  29. | Module: wincache.php |
  30. +----------------------------------------------------------------------------------------------+
  31. | Authors: Don Venkat Raman <[email protected]> |
  32. | Ruslan Yakushev <[email protected]> |
  33. +----------------------------------------------------------------------------------------------+
  34. */
  35.  
  36. /**
  37. * ======================== CONFIGURATION SETTINGS ==============================
  38. * If you do not want to use authentication for this page, set USE_AUTHENTICATION to 0.
  39. * If you use authentication then replace the default password.
  40. */
  41. define('USE_AUTHENTICATION', 0);
  42. define('USERNAME', 'wincache');
  43. define('PASSWORD', 'wincache');
  44.  
  45. /**
  46. * The Basic PHP authentication will work only when IIS is configured to support
  47. * Anonymous Authentication' and nothing else. If IIS is configured to support/use
  48. * any other kind of authentication like Basic/Negotiate/Digest etc, this will not work.
  49. * In that case use the array below to define the names of users in your
  50. * domain/network/workgroup which you want to grant access to.
  51. */
  52. $user_allowed = array('DOMAIN\user1', 'DOMAIN\user2', 'DOMAIN\user3');
  53.  
  54. /**
  55. * If the array contains string 'all', then all the users authenticated by IIS
  56. * will have access to the page. Uncomment the below line and comment above line
  57. * to grant access to all users who gets authenticated by IIS.
  58. */
  59. /* $user_allowed = array('all'); */
  60.  
  61. /** ===================== END OF CONFIGURATION SETTINGS ========================== */
  62.  
  63. if ( !extension_loaded( 'wincache' ) )
  64. {
  65. die('The extension WINCACHE (php_wincache.dll) is not loaded. No statistics to show.');
  66. }
  67.  
  68. if ( USE_AUTHENTICATION == 1 ) {
  69. if (!empty($_SERVER['AUTH_TYPE']) && !empty($_SERVER['REMOTE_USER']) && strcasecmp($_SERVER['REMOTE_USER'], 'anonymous'))
  70. {
  71. if (!in_array(strtolower($_SERVER['REMOTE_USER']), array_map('strtolower', $user_allowed))
  72. && !in_array('all', array_map('strtolower', $user_allowed)))
  73. {
  74. echo 'You are not authorised to view this page. Please contact server admin to get permission. Exiting.';
  75. exit;
  76. }
  77. }
  78. else if ( !isset($_SERVER['PHP_AUTH_USER'] ) || !isset( $_SERVER['PHP_AUTH_PW'] ) ||
  79. $_SERVER['PHP_AUTH_USER'] != USERNAME || $_SERVER['PHP_AUTH_PW'] != PASSWORD ) {
  80. header( 'WWW-Authenticate: Basic realm="WINCACHE Log In!"' );
  81. header( 'HTTP/1.0 401 Unauthorized' );
  82. exit;
  83. }
  84. else if ( $_SERVER['PHP_AUTH_PW'] == 'wincache' )
  85. {
  86. echo "Please change the default password to get this page working. Exiting.";
  87. exit;
  88. }
  89. }
  90.  
  91. define('IMG_WIDTH', 320);
  92. define('IMG_HEIGHT', 220);
  93. define('SUMMARY_DATA', 1);
  94. define('OCACHE_DATA', 2); // Opcode cache
  95. define('FCACHE_DATA', 3); // File cache
  96. define('UCACHE_DATA', 4); // User cache
  97. define('SCACHE_DATA', 5); // Session cache
  98. define('RCACHE_DATA', 6); // Resolve file cache
  99. define('BAR_CHART', 1);
  100. define('PIE_CHART', 2);
  101. define('PATH_MAX_LENGTH', 45);
  102. define('INI_MAX_LENGTH', 45);
  103. define('SUBKEY_MAX_LENGTH', 90);
  104. define('CACHE_MAX_ENTRY', 250);
  105.  
  106. // WinCache settings that are used for debugging purposes
  107. $settings_to_hide = array( 'wincache.localheap', 'wincache.debuglevel', 'wincache.olocaltest' );
  108.  
  109.  
  110.  
  111.  
  112. // Input parameters check
  113. $PHP_SELF = isset( $_SERVER['PHP_SELF'] ) ? htmlentities( strip_tags( $_SERVER['PHP_SELF'],'' ), ENT_QUOTES, 'UTF-8' ) : '';
  114.  
  115. $PHP_SELF = './wincache.php';
  116.  
  117.  
  118. $page = isset( $_GET['page'] ) ? $_GET['page'] : SUMMARY_DATA;
  119. if ( !is_numeric( $page ) || $page < SUMMARY_DATA || $page > RCACHE_DATA )
  120. $page = SUMMARY_DATA;
  121.  
  122. $img = 0;
  123. if ( isset( $_GET['img'] ) && is_numeric( $_GET['img'] ) ) {
  124. $img = $_GET['img'];
  125. if ( $img < OCACHE_DATA || $img > SCACHE_DATA)
  126. $img = 0;
  127. }
  128. $chart_type = BAR_CHART;
  129. if ( isset( $_GET['type'] ) && is_numeric( $_GET['type'] ) ) {
  130. $chart_type = $_GET['type'];
  131. if ( $chart_type < BAR_CHART || $chart_type > PIE_CHART)
  132. $chart_type = BAR_CHART;
  133. }
  134. $chart_param1 = 0;
  135. if ( isset( $_GET['p1'] ) && is_numeric( $_GET['p1'] ) ) {
  136. $chart_param1 = $_GET['p1'];
  137. if ( $chart_param1 < 0 )
  138. $chart_param1 = 0;
  139. else if ( $chart_param1 > PHP_INT_MAX )
  140. $chart_param1 = PHP_INT_MAX;
  141. }
  142. $chart_param2 = 0;
  143. if ( isset( $_GET['p2'] ) && is_numeric( $_GET['p2'] ) ) {
  144. $chart_param2 = $_GET['p2'];
  145. if ( $chart_param2 < 0 )
  146. $chart_param2 = 0;
  147. else if ( $chart_param2 > PHP_INT_MAX )
  148. $chart_param2 = PHP_INT_MAX;
  149. }
  150.  
  151. $show_all_ucache_entries = 0;
  152. if ( isset( $_GET['all'] ) && is_numeric( $_GET['all'] ) ) {
  153. $show_all_ucache_entries = $_GET['all'];
  154. if ( $show_all_ucache_entries < 0 || $show_all_ucache_entries > 1)
  155. $show_all_ucache_entries = 0;
  156. }
  157.  
  158. $clear_user_cache = 0;
  159. if ( isset( $_GET['clc'] ) && is_numeric( $_GET['clc'] ) ) {
  160. $clear_user_cache = $_GET['clc'];
  161. if ( $clear_user_cache < 0 || $clear_user_cache > 1)
  162. $clear_user_cache = 0;
  163. }
  164.  
  165. $ucache_key = null;
  166. if ( isset( $_GET['key'] ) )
  167. $ucache_key = $_GET['key'];
  168. // End of input parameters check
  169.  
  170. // Initialize global variables
  171. $user_cache_available = function_exists('wincache_ucache_info') && !strcmp( ini_get( 'wincache.ucenabled' ), "1" );
  172. $session_cache_available = function_exists('wincache_scache_info') && !strcasecmp( ini_get( 'session.save_handler' ), "wincache" );
  173. $ocache_mem_info = null;
  174. $ocache_file_info = null;
  175. $ocache_summary_info = null;
  176. $fcache_mem_info = null;
  177. $fcache_file_info = null;
  178. $fcache_summary_info = null;
  179. $rpcache_mem_info = null;
  180. $rpcache_file_info = null;
  181. $ucache_mem_info = null;
  182. $ucache_info = null;
  183. $scache_mem_info = null;
  184. $scache_info = null;
  185. $sort_key = null;
  186.  
  187. if ( $session_cache_available && ( $page == SUMMARY_DATA || $page == SCACHE_DATA ) ){
  188. @session_name('WINCACHE_SESSION');
  189. session_start();
  190. }
  191.  
  192. function cmp($a, $b)
  193. {
  194. global $sort_key;
  195. if ( $sort_key == 'file_name' )
  196. return strcmp( get_trimmed_filename( $a[$sort_key], PATH_MAX_LENGTH ), get_trimmed_filename( $b[$sort_key], PATH_MAX_LENGTH ) );
  197. else if ( $sort_key == 'resolve_path' )
  198. return strcmp( get_trimmed_string( $a[$sort_key], PATH_MAX_LENGTH ), get_trimmed_string( $b[$sort_key], PATH_MAX_LENGTH ) );
  199. else
  200. return 0;
  201. }
  202.  
  203. function convert_bytes_to_string( $bytes ) {
  204. $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
  205. $log = log( $bytes, 1024 );
  206. $power = (int) $log;
  207. $size = pow(1024, $log - $power);
  208. return round($size, 2) . ' ' . $units[$power];
  209. }
  210.  
  211. function seconds_to_words( $seconds ) {
  212. /*** return value ***/
  213. $ret = "";
  214.  
  215. /*** get the hours ***/
  216. $hours = intval(intval( $seconds ) / 3600);
  217. if ( $hours > 0 ) {
  218. $ret .= "$hours hours ";
  219. }
  220. /*** get the minutes ***/
  221. $minutes = bcmod( ( intval( $seconds ) / 60 ), 60 );
  222. if( $hours > 0 || $minutes > 0 ) {
  223. $ret .= "$minutes minutes ";
  224. }
  225.  
  226. /*** get the seconds ***/
  227. $seconds = bcmod( intval( $seconds ), 60 );
  228. $ret .= "$seconds seconds";
  229.  
  230. return $ret;
  231. }
  232.  
  233. function get_trimmed_filename( $filepath, $max_len ) {
  234. if ($max_len <= 0) die ('The maximum allowed length must be bigger than 0');
  235.  
  236. $result = basename( $filepath );
  237. if ( strlen( $result ) > $max_len )
  238. $result = substr( $result, -1 * $max_len );
  239.  
  240. return $result;
  241. }
  242.  
  243. function get_trimmed_string( $input, $max_len ) {
  244. if ($max_len <= 3) die ('The maximum allowed length must be bigger than 3');
  245.  
  246. $result = $input;
  247. if ( strlen( $result ) > $max_len )
  248. $result = substr( $result, 0, $max_len - 3 ). '...';
  249.  
  250. return $result;
  251. }
  252.  
  253. function get_trimmed_ini_value( $input, $max_len, $separators = array('|', ',') ) {
  254. if ($max_len <= 3) die ('The maximum allowed length must be bigger than 3');
  255.  
  256. $result = $input;
  257. $lastindex = 0;
  258. if ( strlen( $result ) > $max_len ) {
  259. $result = substr( $result, 0, $max_len - 3 ).'...';
  260. if ( !is_array( $separators ) ) die( 'The separators must be in an array' );
  261. foreach ( $separators as $separator ) {
  262. $index = strripos( $result, $separator );
  263. if ( $index !== false && $index > $lastindex )
  264. $lastindex = $index;
  265. }
  266. if ( 0 < $lastindex && $lastindex < ( $max_len - 3 ) )
  267. $result = substr( $result, 0, $lastindex + 1 ).'...';
  268. }
  269. return $result;
  270. }
  271.  
  272. function get_ocache_summary( $entries ) {
  273. $result = array();
  274. $result['total_classes'] = 0;
  275. $result['total_functions'] = 0;
  276. $result['oldest_entry'] = '';
  277. $result['recent_entry'] = '';
  278.  
  279. if ( isset( $entries ) && count( $entries ) > 0 && isset( $entries[1]['file_name'] ) ) {
  280. foreach ( (array)$entries as $entry ) {
  281. $result['total_classes'] += $entry['class_count'];
  282. $result['total_functions'] += $entry['function_count'];
  283. }
  284. }
  285. return $result;
  286. }
  287. function get_fcache_summary( $entries ) {
  288. $result = array();
  289. $result['total_size'] = 0;
  290. $result['oldest_entry'] = '';
  291. $result['recent_entry'] = '';
  292.  
  293. if ( isset( $entries ) && count( $entries ) > 0 && isset( $entries[1]['file_name'] ) ) {
  294. foreach ( (array)$entries as $entry ) {
  295. $result['total_size'] += $entry['file_size'];
  296. }
  297. }
  298. return $result;
  299. }
  300.  
  301. function get_ocache_size_markup( $size ) {
  302. $size_string = convert_bytes_to_string( $size );
  303.  
  304. if ( $size > ( ini_get( 'wincache.ocachesize' ) * pow( 1024, 2 ) ) ) {
  305. return '<td class="n" title="The opcode cache size has been automatically increased to be at least 3 times bigger than file cache size.">'.$size_string.'</td>';
  306. }
  307.  
  308. return '<td class="v">'.$size_string.'</td>';
  309. }
  310.  
  311. function get_chart_title( $chart_data )
  312. {
  313. $chart_title = '';
  314. switch( $chart_data ) {
  315. case OCACHE_DATA: {
  316. $chart_title = 'Opcode Cache';
  317. break;
  318. }
  319. case FCACHE_DATA: {
  320. $chart_title = 'File Cache';
  321. break;
  322. }
  323. case UCACHE_DATA: {
  324. $chart_title = 'User Cache';
  325. break;
  326. }
  327. case SCACHE_DATA: {
  328. $chart_title = 'Session Cache';
  329. }
  330. }
  331. return $chart_title;
  332. }
  333.  
  334. function gd_loaded() {
  335. return extension_loaded( 'gd' );
  336. }
  337.  
  338. if ( $img > 0 ) {
  339. if ( !gd_loaded() )
  340. exit( 0 );
  341.  
  342. function create_hit_miss_chart( $width, $height, $hits, $misses, $title = 'Hits & Misses (in %)' ) {
  343.  
  344. $hit_percent = 0;
  345. $miss_percent = 0;
  346. if ( $hits < 0 ) $hits = 0;
  347. if ( $misses < 0 ) $misses = 0;
  348. if ( $hits > 0 || $misses > 0 ) {
  349. $hit_percent = round( $hits / ( $hits + $misses ) * 100, 2 );
  350. $miss_percent = round( $misses / ( $hits + $misses ) * 100, 2 );
  351. }
  352. $data = array( 'Hits' => $hit_percent, 'Misses' => $miss_percent );
  353.  
  354. $image = imagecreate( $width, $height );
  355.  
  356. // colors
  357. $white = imagecolorallocate( $image, 0xFF, 0xFF, 0xFF );
  358. $phpblue = imagecolorallocate( $image, 0x5C, 0x87, 0xB2 );
  359. $black = imagecolorallocate( $image, 0x00, 0x00, 0x00 );
  360. $gray = imagecolorallocate( $image, 0xC0, 0xC0, 0xC0 );
  361.  
  362. $maxval = max( $data );
  363. $nval = sizeof( $data );
  364.  
  365. // draw something here
  366. $hmargin = 38; // left horizontal margin for y-labels
  367. $vmargin = 20; // top (bottom) vertical margin for title (x-labels)
  368.  
  369. $base = floor( ( $width - $hmargin ) / $nval );
  370.  
  371. $xsize = $nval * $base - 1; // x-size of plot
  372. $ysize = $height - 2 * $vmargin; // y-size of plot
  373.  
  374. // plot frame
  375. imagerectangle( $image, $hmargin, $vmargin, $hmargin + $xsize, $vmargin + $ysize, $black );
  376.  
  377. // top label
  378. $titlefont = 3;
  379. $txtsize = imagefontwidth( $titlefont ) * strlen( $title );
  380. $xpos = (int)( $hmargin + ( $xsize - $txtsize ) / 2 );
  381. $xpos = max( 1, $xpos ); // force positive coordinates
  382. $ypos = 3; // distance from top
  383. imagestring( $image, $titlefont, $xpos, $ypos, $title , $black );
  384.  
  385. // grid lines
  386. $labelfont = 2;
  387. $ngrid = 4;
  388.  
  389. $dydat = 100 / $ngrid;
  390. $dypix = $ysize / $ngrid;
  391.  
  392. for ( $i = 0; $i <= $ngrid; $i++ ) {
  393. $ydat = (int)( $i * $dydat );
  394. $ypos = $vmargin + $ysize - (int)( $i * $dypix );
  395.  
  396. $txtsize = imagefontwidth( $labelfont ) * strlen( $ydat );
  397. $txtheight = imagefontheight( $labelfont );
  398.  
  399. $xpos = (int)( ( $hmargin - $txtsize) / 2 );
  400. $xpos = max( 1, $xpos );
  401.  
  402. imagestring( $image, $labelfont, $xpos, $ypos - (int)( $txtheight/2 ), $ydat, $black );
  403.  
  404. if ( !( $i == 0 ) && !( $i >= $ngrid ) )
  405. imageline( $image, $hmargin - 3, $ypos, $hmargin + $xsize, $ypos, $gray );
  406. // don't draw at Y=0 and top
  407. }
  408.  
  409. // graph bars
  410. // columns and x labels
  411. $padding = 30; // half of spacing between columns
  412. $yscale = $ysize / ( $ngrid * $dydat ); // pixels per data unit
  413.  
  414. for ( $i = 0; list( $xval, $yval ) = each( $data ); $i++ ) {
  415.  
  416. // vertical columns
  417. $ymax = $vmargin + $ysize;
  418. $ymin = $ymax - (int)( $yval * $yscale );
  419. $xmax = $hmargin + ( $i + 1 ) * $base - $padding;
  420. $xmin = $hmargin + $i * $base + $padding;
  421.  
  422. imagefilledrectangle( $image, $xmin, $ymin, $xmax, $ymax, $phpblue );
  423.  
  424. // x labels
  425. $xlabel = $xval.': '.$yval.'%';
  426. $txtsize = imagefontwidth( $labelfont ) * strlen( $xlabel );
  427.  
  428. $xpos = ( $xmin + $xmax - $txtsize ) / 2;
  429. $xpos = max( $xmin, $xpos );
  430. $ypos = $ymax + 3; // distance from x axis
  431.  
  432. imagestring( $image, $labelfont, $xpos, $ypos, $xlabel, $black );
  433. }
  434. return $image;
  435. }
  436.  
  437. function create_used_free_chart( $width, $height, $used_memory, $free_memory, $title = 'Free & Used Memory (in %)' ) {
  438. // Check the input parameters to avoid division by zero and weird cases
  439. if ( $free_memory <= 0 && $used_memory <= 0 ) {
  440. $free_memory = 1;
  441. $used_memory = 0;
  442. }
  443.  
  444. $centerX = 120;
  445. $centerY = 120;
  446. $diameter = 120;
  447.  
  448. $hmargin = 5; // left (right) horizontal margin
  449. $vmargin = 20; // top (bottom) vertical margin
  450.  
  451. $image = imagecreate( $width, $height );
  452.  
  453. // colors
  454. $white = imagecolorallocate( $image, 0xFF, 0xFF, 0xFF );
  455. $black = imagecolorallocate( $image, 0x00, 0x00, 0x00 );
  456. $pie_color[1] = imagecolorallocate($image, 0x5C, 0x87, 0xB2);
  457. $pie_color[2] = imagecolorallocate($image, 0xCB, 0xE1, 0xEF);
  458. $pie_color[3] = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
  459.  
  460. // Label font size
  461. $labelfont = 2;
  462. $hfw = imagefontwidth( $labelfont );
  463. $vfw = imagefontheight( $labelfont );
  464.  
  465. // Border
  466. imagerectangle( $image, $hmargin, $vmargin, $width - $hmargin, $height - $vmargin, $black );
  467.  
  468. // Top label
  469. $titlefont = 3;
  470. $txtsize = imagefontwidth( $titlefont ) * strlen( $title );
  471. $hpos = (int)( ($width - $txtsize) / 2 );
  472. $vpos = 3; // distance from top
  473. imagestring( $image, $titlefont, $hpos, $vpos, $title , $black );
  474.  
  475. $total = 0;
  476. $n = 0;
  477. $items = array('Used memory' => $used_memory, 'Free memory' => $free_memory);
  478.  
  479. //read the arguments into different arrays:
  480. foreach( $items as $key => $val ) {
  481. $n++;
  482. $label[$n] = $key;
  483. $value[$n] = $val;
  484. $total += $val;
  485. $arc_dec[$n] = $total*360;
  486. $arc_rad[$n] = $total*2*pi();
  487. }
  488.  
  489. //the base:
  490. $arc_rad[0] = 0;
  491. $arc_dec[0] = 0;
  492.  
  493. //count the labels:
  494. for ( $i = 1; $i <= $n; $i++ ) {
  495.  
  496. //calculate the percents:
  497. $perc[$i] = $value[$i] / $total;
  498. $percstr[$i] = (string) number_format( $perc[$i] * 100, 2 )."%";
  499. //label with percentage:
  500. $label[$i] = $percstr[$i];
  501.  
  502. //calculate the arc and line positions:
  503. $arc_rad[$i] = $arc_rad[$i] / $total;
  504. $arc_dec[$i] = $arc_dec[$i] / $total;
  505. $hpos = round( $centerX + ( $diameter / 2 ) * sin( $arc_rad[$i] ) );
  506. $vpos = round( $centerY + ( $diameter / 2 ) * cos( $arc_rad[$i] ) );
  507. imageline( $image, $centerX, $centerY, $hpos, $vpos, $black );
  508. imagearc( $image, $centerX, $centerY, $diameter, $diameter, $arc_dec[$i-1], $arc_dec[$i], $black );
  509.  
  510. //calculate the positions for the labels:
  511. $arc_rad_label = $arc_rad[$i-1] + 0.5 * $perc[$i] * 2 * pi();
  512. $hpos = $centerX + 1.1 * ( $diameter / 2 ) * sin( $arc_rad_label );
  513. $vpos = $centerY + 1.1 * ( $diameter / 2 ) * cos( $arc_rad_label );
  514. if ( ( $arc_rad_label > 0.5 * pi() ) && ( $arc_rad_label < 1.5 * pi() ) ) {
  515. $vpos = $vpos - $vfw;
  516. }
  517. if ( $arc_rad_label > pi() ) {
  518. $hpos = $hpos - $hfw * strlen( $label[$i] );
  519. }
  520. //display the labels:
  521. imagestring($image, $labelfont, $hpos, $vpos, $label[$i], $black);
  522. }
  523.  
  524. //fill the parts with their colors:
  525. for ( $i = 1; $i <= $n; $i++ ) {
  526. if ( round($arc_dec[$i] - $arc_dec[$i-1]) != 0 ) {
  527. $arc_rad_label = $arc_rad[$i - 1] + 0.5 * $perc[$i] * 2 * pi();
  528. $hpos = $centerX + 0.8 * ( $diameter / 2 ) * sin( $arc_rad_label );
  529. $vpos = $centerY + 0.8 * ( $diameter / 2 ) * cos( $arc_rad_label );
  530. imagefilltoborder( $image, $hpos, $vpos, $black, $pie_color[$i] );
  531. }
  532. }
  533.  
  534. // legend
  535. $hpos = $centerX + 1.1 * ($diameter / 2) + $hfw * strlen( '50.00%' );
  536. $vpos = $centerY - ($diameter / 2);
  537. $i = 1;
  538. $thumb_size = 5;
  539. foreach ($items as $key => $value){
  540. imagefilledrectangle( $image, $hpos, $vpos, $hpos + $thumb_size, $vpos + $thumb_size, $pie_color[$i++] );
  541. imagestring( $image, $labelfont, $hpos + $thumb_size + 5, $vpos, $key, $black );
  542. $vpos += $vfw + 2;
  543. }
  544. return $image;
  545. }
  546.  
  547. $png_image = null;
  548. $chart_title = get_chart_title($img);
  549.  
  550. if ( $chart_type == PIE_CHART ){
  551. $png_image = create_used_free_chart( IMG_WIDTH, IMG_HEIGHT, $chart_param1, $chart_param2, 'Memory Usage by '.$chart_title.' (in %)' );
  552. }
  553. else{
  554. $png_image = create_hit_miss_chart( IMG_WIDTH, IMG_HEIGHT, $chart_param1, $chart_param2, $chart_title.' Hits & Misses (in %)' );
  555. }
  556.  
  557. if ( $png_image !== null ) {
  558. // flush image
  559. header('Content-type: image/png');
  560. imagepng($png_image);
  561. imagedestroy($png_image);
  562. }
  563. exit;
  564. }
  565.  
  566. function get_chart_markup( $data_type, $chart_type, $chart_param1, $chart_param2 ) {
  567. global $PHP_SELF;
  568.  
  569. $result = '';
  570. $alt_title = '';
  571.  
  572. if ( gd_loaded() ){
  573. $alt_title = get_chart_title( $data_type );
  574. if ( $alt_title == '' )
  575. return '';
  576.  
  577. if ( $chart_type == BAR_CHART )
  578. $alt_title .= ' hit and miss percentage chart';
  579. elseif ( $chart_type == PIE_CHART )
  580. $alt_title .= ' memory usage percentage chart';
  581. else
  582. return '';
  583.  
  584. $result = '<img src="'.$PHP_SELF;
  585. $result .= '?img='.$data_type.'&amp;type='.$chart_type;
  586. $result .= '&amp;p1='.$chart_param1.'&amp;p2='.$chart_param2.'" ';
  587. $result .= 'alt="'.$alt_title.'" width="'.IMG_WIDTH.'" height="'.IMG_HEIGHT.'" />';
  588. }
  589. else {
  590. $result = '<p class="notice">Enable GD library (<em>php_gd2.dll</em>) in order to see the charts.</p>';
  591. }
  592.  
  593. return $result;
  594. }
  595.  
  596. function cache_scope_text( $is_local )
  597. {
  598. return ( $is_local == true ) ? 'local' : 'global';
  599. }
  600.  
  601. function init_cache_info( $cache_data = SUMMARY_DATA )
  602. {
  603. global $ocache_mem_info,
  604. $ocache_file_info,
  605. $ocache_summary_info,
  606. $fcache_mem_info,
  607. $fcache_file_info,
  608. $fcache_summary_info,
  609. $rpcache_mem_info,
  610. $rpcache_file_info,
  611. $ucache_mem_info,
  612. $ucache_info,
  613. $scache_mem_info,
  614. $scache_info,
  615. $user_cache_available,
  616. $session_cache_available;
  617.  
  618. if ( $cache_data == SUMMARY_DATA || $cache_data == OCACHE_DATA ) {
  619. $ocache_mem_info = wincache_ocache_meminfo();
  620. $ocache_file_info = wincache_ocache_fileinfo();
  621. $ocache_summary_info = get_ocache_summary( $ocache_file_info['file_entries'] );
  622. }
  623. if ( $cache_data == SUMMARY_DATA || $cache_data == FCACHE_DATA ) {
  624. $fcache_mem_info = wincache_fcache_meminfo();
  625. $fcache_file_info = wincache_fcache_fileinfo();
  626. $fcache_summary_info = get_fcache_summary( $fcache_file_info['file_entries'] );
  627. }
  628. if ( $cache_data == SUMMARY_DATA || $cache_data == RCACHE_DATA ){
  629. $rpcache_mem_info = wincache_rplist_meminfo();
  630. $rpcache_file_info = wincache_rplist_fileinfo();
  631. }
  632. if ( $user_cache_available && ( $cache_data == SUMMARY_DATA || $cache_data == UCACHE_DATA ) ){
  633. $ucache_mem_info = wincache_ucache_meminfo();
  634. $ucache_info = wincache_ucache_info();
  635. }
  636. if ( $session_cache_available && ( $cache_data == SUMMARY_DATA || $cache_data == SCACHE_DATA ) ){
  637. $scache_mem_info = wincache_scache_meminfo();
  638. $scache_info = wincache_scache_info();
  639. }
  640. }
  641.  
  642. if ( USE_AUTHENTICATION && $user_cache_available && $clear_user_cache ){
  643. wincache_ucache_clear();
  644. header('Location: '.$PHP_SELF.'?page='.UCACHE_DATA);
  645. exit;
  646. }
  647.  
  648. ?>
  649. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  650. <html xmlns="http://www.w3.org/1999/xhtml">
  651.  
  652. <head>
  653. <style type="text/css">
  654. body {
  655. background-color: #ffffff;
  656. color: #000000;
  657. font-family: sans-serif;
  658. font-size: 0.8em;
  659. }
  660. h1 {
  661. font-size: 2em;
  662. }
  663. #content {
  664. width: 960px;
  665. margin: 5px;
  666. }
  667. #header {
  668. color: #ffffff;
  669. border: 1px solid black;
  670. background-color: #5C87B2;
  671. margin-bottom: 1em;
  672. padding: 1em 2em;
  673. }
  674. /*The #menu element credits: */
  675. /*Credits: Dynamic Drive CSS Library */
  676. /*URL: http://www.dynamicdrive.com/style/ */
  677. #menu {
  678. width: 100%;
  679. overflow: hidden;
  680. border-bottom: 1px solid black;
  681. margin-bottom: 1em; /*bottom horizontal line that runs beneath tabs*/
  682. }
  683. #menu ul {
  684. margin: 0;
  685. padding: 0;
  686. padding-left: 10px; /*offset of tabs relative to browser left edge*/;
  687. font-weight: bold;
  688. font-size: 1.2em;
  689. list-style-type: none;
  690. }
  691. #menu li {
  692. display: inline;
  693. margin: 0;
  694. }
  695. #menu li a {
  696. float: left;
  697. display: block;
  698. text-decoration: none;
  699. margin: 0;
  700. padding: 7px 8px;
  701. border-right: 1px solid white; /*padding inside each tab*/
  702. color: white; /*right divider between tabs*/
  703. background: #5C87B2; /*background of tabs (default state)*/
  704. }
  705. #menu li a:visited {
  706. color: white;
  707. }
  708. #menu li a:hover, #menu li.selected a {
  709. background: #336699;
  710. }
  711. /*The end of the menu elements credits */
  712. #panel{
  713. float: left;
  714. width: 100%;
  715. margin-bottom: 2em;
  716. border: 1px solid black;
  717. }
  718. #panel_header{
  719. background-color: #5C87B2;
  720. font-weight: bold;
  721. color: #ffffff;
  722. border-bottom: 1px solid black;
  723. padding: 0.5em;
  724. }
  725. #panel_body{
  726. background-color: #E7E7E7;
  727. padding: 0.5em;
  728. white-space:
  729. }
  730. pre {
  731. white-space: pre-wrap; /* css-3 */
  732. white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
  733. white-space: -pre-wrap; /* Opera 4-6 */
  734. white-space: -o-pre-wrap; /* Opera 7 */
  735. word-wrap: break-word; /* Internet Explorer 5.5+ */
  736. }
  737. .overview{
  738. float: left;
  739. width: inherit;
  740. margin-bottom: 2em;
  741. }
  742. .list{
  743. float: left;
  744. width: 100%;
  745. margin-bottom: 2em;
  746. }
  747. .wideleftpanel{
  748. float: left;
  749. width: 520px;
  750. margin-right: 20px;
  751. }
  752. .widerightpanel{
  753. float: left;
  754. width: 420px;
  755. }
  756. .leftpanel{
  757. float: left;
  758. width: 310px;
  759. }
  760. .rightpanel{
  761. float:left;
  762. width: 320px;
  763. margin-left: 5px;
  764. }
  765. .extra_margin{
  766. margin-top: 20px;
  767. }
  768. table {
  769. border-collapse: collapse;
  770. }
  771. td, th {
  772. border: 1px solid black;
  773. vertical-align: baseline;
  774. }
  775. th {
  776. background-color: #5C87B2;
  777. font-weight: bold;
  778. color: #ffffff;
  779. }
  780. .e {
  781. background-color: #cbe1ef;
  782. font-weight: bold;
  783. color: #000000;
  784. width: 40%;
  785. }
  786. .leftpanel .e{
  787. width: 50%;
  788. }
  789. .v {
  790. background-color: #E7E7E7;
  791. color: #000000;
  792. }
  793. .n{
  794. background-color: #FFFF00;
  795. color: #000000;
  796. font-weight: bold;
  797. }
  798. .notice {
  799. display: block;
  800. margin-top: 1.5em;
  801. padding: 1em;
  802. background-color: #ffffe0;
  803. border: 1px solid #dddddd;
  804. }
  805. .clear{
  806. clear: both;
  807. }
  808. </style>
  809. <title>Windows Cache Extension for PHP - Statistics</title>
  810. </head>
  811.  
  812. <body>
  813.  
  814. <div id="content">
  815. <div id="header">
  816. <h1>Windows Cache Extension for PHP - Statistics</h1>
  817. </div>
  818. <div id="menu">
  819. <ul>
  820. <li <?php echo ($page == SUMMARY_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', SUMMARY_DATA; ?>">Summary</a></li>
  821. <li <?php echo ($page == OCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', OCACHE_DATA; ?>">Opcode Cache</a></li>
  822. <li <?php echo ($page == FCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', FCACHE_DATA; ?>">File System Cache</a></li>
  823. <li <?php echo ($page == UCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', UCACHE_DATA; ?>">User Cache</a></li>
  824. <li <?php echo ($page == SCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', SCACHE_DATA; ?>">Session Cache</a></li>
  825. <li <?php echo ($page == RCACHE_DATA)? 'class="selected"' : ''; ?>><a href="<?php echo $PHP_SELF, '?page=', RCACHE_DATA; ?>">Resolve Path Cache</a></li>
  826. </ul>
  827. </div>
  828. <?php if ( $page == SUMMARY_DATA ) {
  829. init_cache_info( SUMMARY_DATA );
  830. ?>
  831. <div class="overview">
  832. <div class="wideleftpanel">
  833. <table style="width: 100%">
  834. <tr>
  835. <th colspan="2">General Information</th>
  836. </tr>
  837. <tr>
  838. <td class="e">WinCache version</td>
  839. <td class="v"><?php echo phpversion('wincache'); ?></td>
  840. </tr>
  841. <tr>
  842. <td class="e">PHP version</td>
  843. <td class="v"><?php echo phpversion(); ?></td>
  844. </tr>
  845. <tr title="<?php echo $_SERVER['DOCUMENT_ROOT']; ?>">
  846. <td class="e">Document root</td>
  847. <td class="v"><?php echo get_trimmed_string( $_SERVER['DOCUMENT_ROOT'], PATH_MAX_LENGTH ); ?></td>
  848. </tr>
  849. <tr title="<?php echo isset( $_SERVER['PHPRC'] ) ? $_SERVER['PHPRC'] : 'Not defined'; ?>">
  850. <td class="e">PHPRC</td>
  851. <td class="v"><?php echo isset( $_SERVER['PHPRC'] ) ? get_trimmed_string( $_SERVER['PHPRC'], PATH_MAX_LENGTH ) : 'Not defined'; ?></td>
  852. </tr>
  853. <tr>
  854. <td class="e">Server software</td>
  855. <td class="v"><?php echo isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE']: 'Not set'; ?></td>
  856. </tr>
  857. <tr>
  858. <td class="e">Operating System</td>
  859. <td class="v"><?php echo php_uname( 's' ), ' ', php_uname( 'r' ); ?></td>
  860. </tr>
  861. <tr>
  862. <td class="e">Processor information</td>
  863. <td class="v"><?php echo isset( $_SERVER['PROCESSOR_IDENTIFIER'] ) ? $_SERVER['PROCESSOR_IDENTIFIER']: 'Not set'; ?></td>
  864. </tr>
  865. <tr>
  866. <td class="e">Number of processors</td>
  867. <td class="v"><?php echo isset( $_SERVER['NUMBER_OF_PROCESSORS'] ) ? $_SERVER['NUMBER_OF_PROCESSORS']: 'Not set'; ?></td>
  868. </tr>
  869. <tr>
  870. <td class="e">Machine name</td>
  871. <td class="v"><?php echo (getenv( 'COMPUTERNAME' ) != FALSE) ? getenv( 'COMPUTERNAME' ) : 'Not set'; ?></td>
  872. </tr>
  873. <tr>
  874. <td class="e">Host name</td>
  875. <td class="v"><?php echo isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : 'Not set'; ?></td>
  876. </tr>
  877. <tr>
  878. <td class="e">PHP session handler</td>
  879. <td class="v"><?php echo ini_get( 'session.save_handler' ); ?></td>
  880. </tr>
  881. <tr>
  882. <td class="e">Application Pool ID</td>
  883. <td class="v"><?php echo (getenv( 'APP_POOL_ID' ) != FALSE) ? getenv( 'APP_POOL_ID') : 'Not available'; ?></td>
  884. </tr>
  885. <tr>
  886. <td class="e">Site ID</td>
  887. <td class="v"><?php echo isset( $_SERVER['INSTANCE_ID'] ) ? $_SERVER['INSTANCE_ID'] : 'Not available'; ?></td>
  888. </tr>
  889. <tr>
  890. <td class="e">FastCGI impersonation</td>
  891. <td class="v"><?php echo (ini_get( 'fastcgi.impersonate' ) === '1') ? 'enabled' : 'disabled'; ?></td>
  892. </tr>
  893. </table>
  894. </div>
  895. <div class="widerightpanel">
  896. <table style="width:100%">
  897. <tr>
  898. <th colspan="2">Cache Settings</th>
  899. </tr>
  900. <?php
  901. foreach ( ini_get_all( 'wincache' ) as $ini_name => $ini_value) {
  902. // Do not show the settings used for debugging
  903. if ( in_array( $ini_name, $settings_to_hide ) )
  904. continue;
  905. echo '<tr title="', $ini_value['local_value'], '"><td class="e">', $ini_name, '</td><td class="v">';
  906. if ( !is_numeric( $ini_value['local_value'] ) )
  907. echo get_trimmed_ini_value( $ini_value['local_value'], INI_MAX_LENGTH );
  908. else
  909. echo $ini_value['local_value'];
  910. echo '</td></tr>', "\n";
  911. }
  912. ?>
  913. </table>
  914. </div>
  915. </div>
  916. <div class="overview">
  917. <div class="leftpanel extra_margin">
  918. <table width="100%">
  919. <tr>
  920. <th colspan="2">Opcode Cache Overview</th>
  921. </tr>
  922. <tr>
  923. <td class="e">Cache scope</td>
  924. <td class="v"><?php echo ( isset( $ocache_file_info['is_local_cache'] ) ) ? cache_scope_text( $ocache_file_info['is_local_cache'] ) : 'Unknown'; ?></td>
  925. </tr>
  926. <tr>
  927. <td class="e">Cache uptime</td>
  928. <td class="v"><?php echo ( isset( $ocache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $ocache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  929. </tr>
  930. <tr>
  931. <td class="e">Cached files</td>
  932. <td class="v"><a href="<?php echo $PHP_SELF, '?page=', OCACHE_DATA, '#filelist'; ?>"><?php echo $ocache_file_info['total_file_count']; ?></a></td>
  933. </tr>
  934. <tr>
  935. <td class="e">Hits</td>
  936. <td class="v"><?php echo $ocache_file_info['total_hit_count']; ?></td>
  937. </tr>
  938. <tr>
  939. <td class="e">Misses</td>
  940. <td class="v"><?php echo $ocache_file_info['total_miss_count']; ?></td>
  941. </tr>
  942. <tr>
  943. <td class="e">Total memory</td>
  944. <?php echo get_ocache_size_markup( $ocache_mem_info['memory_total'] ); ?>
  945. </tr>
  946. <tr>
  947. <td class="e">Available memory</td>
  948. <td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_free'] ); ?></td>
  949. </tr>
  950. <tr>
  951. <td class="e">Memory overhead</td>
  952. <td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_overhead'] ); ?></td>
  953. </tr>
  954. <tr>
  955. <td class="e">Number of functions</td>
  956. <td class="v"><?php echo $ocache_summary_info['total_functions']; ?></td>
  957. </tr>
  958. <tr>
  959. <td class="e">Number of classes</td>
  960. <td class="v"><?php echo $ocache_summary_info['total_classes']; ?></td>
  961. </tr>
  962. </table>
  963. </div>
  964. <div class="rightpanel">
  965. <?php echo get_chart_markup( OCACHE_DATA, BAR_CHART, $ocache_file_info['total_hit_count'], $ocache_file_info['total_miss_count'] ); ?>
  966. </div>
  967. <div class="rightpanel">
  968. <?php echo get_chart_markup( OCACHE_DATA, PIE_CHART, $ocache_mem_info['memory_total'] - $ocache_mem_info['memory_free'], $ocache_mem_info['memory_free'] ); ?>
  969. </div>
  970. </div>
  971. <div class="overview">
  972. <div class="leftpanel extra_margin">
  973. <table style="width: 100%">
  974. <tr>
  975. <th colspan="2">File Cache Overview</th>
  976. </tr>
  977. <tr>
  978. <td class="e">Cache uptime</td>
  979. <td class="v"><?php echo ( isset( $fcache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $fcache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  980. </tr>
  981. <tr>
  982. <td class="e">Cached files</td>
  983. <td class="v"><a href="<?php echo $PHP_SELF, '?page=', FCACHE_DATA, '#filelist'; ?>"><?php echo $fcache_file_info['total_file_count']; ?></a></td>
  984. </tr>
  985. <tr>
  986. <td class="e">Total files size</td>
  987. <td class="v"><?php echo convert_bytes_to_string( $fcache_summary_info['total_size'] ); ?></td>
  988. </tr>
  989. <tr>
  990. <td class="e">Hits</td>
  991. <td class="v"><?php echo $fcache_file_info['total_hit_count']; ?></td>
  992. </tr>
  993. <tr>
  994. <td class="e">Misses</td>
  995. <td class="v"><?php echo $fcache_file_info['total_miss_count']; ?></td>
  996. </tr>
  997. <tr>
  998. <td class="e">Total memory</td>
  999. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_total'] ); ?></td>
  1000. </tr>
  1001. <tr>
  1002. <td class="e">Available memory</td>
  1003. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_free'] ); ?></td>
  1004. </tr>
  1005. <tr>
  1006. <td class="e">Memory overhead</td>
  1007. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_overhead'] ); ?></td>
  1008. </tr>
  1009. </table>
  1010. </div>
  1011. <div class="rightpanel">
  1012. <?php echo get_chart_markup( FCACHE_DATA, BAR_CHART, $fcache_file_info['total_hit_count'], $fcache_file_info['total_miss_count'] ); ?>
  1013. </div>
  1014. <div class="rightpanel">
  1015. <?php echo get_chart_markup( FCACHE_DATA, PIE_CHART, $fcache_mem_info['memory_total'] - $fcache_mem_info['memory_free'], $fcache_mem_info['memory_free'] ); ?>
  1016. </div>
  1017. </div>
  1018. <div class="overview">
  1019. <?php if ( $user_cache_available ) {?>
  1020. <div class="leftpanel extra_margin">
  1021. <table style="width: 100%">
  1022. <tr>
  1023. <th colspan="2">User Cache Overview</th>
  1024. </tr>
  1025. <tr>
  1026. <td class="e">Cache scope</td>
  1027. <td class="v"><?php echo ( isset( $ucache_info['is_local_cache'] ) ) ? cache_scope_text( $ucache_info['is_local_cache'] ) : 'Unknown'; ?></td>
  1028. </tr>
  1029. <tr>
  1030. <td class="e">Cache uptime</td>
  1031. <td class="v"><?php echo ( isset( $ucache_info['total_cache_uptime'] ) ) ? seconds_to_words( $ucache_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1032. </tr>
  1033. <tr>
  1034. <td class="e">Cached entries</td>
  1035. <td class="v"><a href="<?php echo $PHP_SELF, '?page=', UCACHE_DATA, '#filelist'; ?>"><?php echo $ucache_info['total_item_count']; ?></a></td>
  1036. </tr>
  1037. <tr>
  1038. <td class="e">Hits</td>
  1039. <td class="v"><?php echo $ucache_info['total_hit_count']; ?></td>
  1040. </tr>
  1041. <tr>
  1042. <td class="e">Misses</td>
  1043. <td class="v"><?php echo $ucache_info['total_miss_count']; ?></td>
  1044. </tr>
  1045. <tr>
  1046. <td class="e">Total memory</td>
  1047. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_total'] ); ?></td>
  1048. </tr>
  1049. <tr>
  1050. <td class="e">Available memory</td>
  1051. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_free'] ); ?></td>
  1052. </tr>
  1053. <tr>
  1054. <td class="e">Memory overhead</td>
  1055. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_overhead'] ); ?></td>
  1056. </tr>
  1057. </table>
  1058. </div>
  1059. <div class="rightpanel">
  1060. <?php echo get_chart_markup( UCACHE_DATA, BAR_CHART, $ucache_info['total_hit_count'], $ucache_info['total_miss_count'] ); ?>
  1061. </div>
  1062. <div class="rightpanel">
  1063. <?php echo get_chart_markup( UCACHE_DATA, PIE_CHART, $ucache_mem_info['memory_total'] - $ucache_mem_info['memory_free'], $ucache_mem_info['memory_free'] ); ?>
  1064. </div>
  1065. <?php } ?>
  1066. </div>
  1067. <div class="overview">
  1068. <?php if ( $session_cache_available ) {?>
  1069. <div class="leftpanel extra_margin">
  1070. <table style="width: 100%">
  1071. <tr>
  1072. <th colspan="2">Session Cache Overview</th>
  1073. </tr>
  1074. <tr>
  1075. <td class="e">Cache scope</td>
  1076. <td class="v"><?php echo ( isset( $scache_info['is_local_cache'] ) ) ? cache_scope_text( $scache_info['is_local_cache'] ) : 'Unknown'; ?></td>
  1077. </tr>
  1078. <tr>
  1079. <td class="e">Cache uptime</td>
  1080. <td class="v"><?php echo ( isset( $scache_info['total_cache_uptime'] ) ) ? seconds_to_words( $scache_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1081. </tr>
  1082. <tr>
  1083. <td class="e">Cached entries</td>
  1084. <td class="v"><a href="<?php echo $PHP_SELF, '?page=', SCACHE_DATA, '#filelist'; ?>"><?php echo $scache_info['total_item_count']; ?></a></td>
  1085. </tr>
  1086. <tr>
  1087. <td class="e">Hits</td>
  1088. <td class="v"><?php echo $scache_info['total_hit_count']; ?></td>
  1089. </tr>
  1090. <tr>
  1091. <td class="e">Misses</td>
  1092. <td class="v"><?php echo $scache_info['total_miss_count']; ?></td>
  1093. </tr>
  1094. <tr>
  1095. <td class="e">Total memory</td>
  1096. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_total'] ); ?></td>
  1097. </tr>
  1098. <tr>
  1099. <td class="e">Available memory</td>
  1100. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_free'] ); ?></td>
  1101. </tr>
  1102. <tr>
  1103. <td class="e">Memory overhead</td>
  1104. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_overhead'] ); ?></td>
  1105. </tr>
  1106. </table>
  1107. </div>
  1108. <div class="rightpanel">
  1109. <?php echo get_chart_markup( SCACHE_DATA, BAR_CHART, $scache_info['total_hit_count'], $scache_info['total_miss_count'] ); ?>
  1110. </div>
  1111. <div class="rightpanel">
  1112. <?php echo get_chart_markup( SCACHE_DATA, PIE_CHART, $scache_mem_info['memory_total'] - $scache_mem_info['memory_free'], $scache_mem_info['memory_free'] ); ?>
  1113. </div>
  1114. <?php } ?>
  1115. </div>
  1116. <div class="overview">
  1117. <div class="leftpanel">
  1118. <table style="width: 100%">
  1119. <tr>
  1120. <th colspan="2">Resolve Path Cache Overview</th>
  1121. </tr>
  1122. <tr>
  1123. <td class="e">Cached entries</td>
  1124. <td class="v"><a href="<?php echo $PHP_SELF, '?page=', RCACHE_DATA, '#filelist'; ?>"><?php echo $rpcache_file_info['total_file_count']; ?></a></td>
  1125. </tr>
  1126. <tr>
  1127. <td class="e">Total memory</td>
  1128. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_total'] ); ?></td>
  1129. </tr>
  1130. <tr>
  1131. <td class="e">Available memory</td>
  1132. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_free'] ); ?></td>
  1133. </tr>
  1134. <tr>
  1135. <td class="e">Memory overhead</td>
  1136. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_overhead'] ); ?></td>
  1137. </tr>
  1138. </table>
  1139. </div>
  1140. </div>
  1141. <?php } else if ( $page == OCACHE_DATA ) {
  1142. init_cache_info( OCACHE_DATA );
  1143. ?>
  1144. <div class="overview">
  1145. <div class="leftpanel extra_margin">
  1146. <table width="100%">
  1147. <tr>
  1148. <th colspan="2">Opcode Cache Overview</th>
  1149. </tr>
  1150. <tr>
  1151. <td class="e">Cache scope</td>
  1152. <td class="v"><?php echo ( isset( $ocache_file_info['is_local_cache'] ) ) ? cache_scope_text( $ocache_file_info['is_local_cache'] ) : 'Unknown'; ?></td>
  1153. </tr>
  1154. <tr>
  1155. <td class="e">Cache uptime</td>
  1156. <td class="v"><?php echo ( isset( $ocache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $ocache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1157. </tr>
  1158. <tr>
  1159. <td class="e">Cached files</td>
  1160. <td class="v"><?php echo $ocache_file_info['total_file_count']; ?></td>
  1161. </tr>
  1162. <tr>
  1163. <td class="e">Hits</td>
  1164. <td class="v"><?php echo $ocache_file_info['total_hit_count']; ?></td>
  1165. </tr>
  1166. <tr>
  1167. <td class="e">Misses</td>
  1168. <td class="v"><?php echo $ocache_file_info['total_miss_count']; ?></td>
  1169. </tr>
  1170. <tr>
  1171. <td class="e">Total memory</td>
  1172. <?php echo get_ocache_size_markup( $ocache_mem_info['memory_total'] ); ?>
  1173. </tr>
  1174. <tr>
  1175. <td class="e">Available memory</td>
  1176. <td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_free'] ); ?></td>
  1177. </tr>
  1178. <tr>
  1179. <td class="e">Memory overhead</td>
  1180. <td class="v"><?php echo convert_bytes_to_string( $ocache_mem_info['memory_overhead'] ); ?></td>
  1181. </tr>
  1182. <tr>
  1183. <td class="e">Number of functions</td>
  1184. <td class="v"><?php echo $ocache_summary_info['total_functions']; ?></td>
  1185. </tr>
  1186. <tr>
  1187. <td class="e">Number of classes</td>
  1188. <td class="v"><?php echo $ocache_summary_info['total_classes']; ?></td>
  1189. </tr>
  1190. </table>
  1191. </div>
  1192. <div class="rightpanel">
  1193. <?php echo get_chart_markup( OCACHE_DATA, BAR_CHART, $ocache_file_info['total_hit_count'], $ocache_file_info['total_miss_count'] ); ?>
  1194. </div>
  1195. <div class="rightpanel">
  1196. <?php echo get_chart_markup( OCACHE_DATA, PIE_CHART, $ocache_mem_info['memory_total'] - $ocache_mem_info['memory_free'], $ocache_mem_info['memory_free'] ); ?>
  1197. </div>
  1198. </div>
  1199. <div class="list" id="filelist">
  1200. <table style="width:100%">
  1201. <tr>
  1202. <th colspan="7">Opcode cache entries</th>
  1203. </tr>
  1204. <tr>
  1205. <th title="Name of the file">File name</th>
  1206. <th title="Number of PHP functions in the file">Function count</th>
  1207. <th title="Number of PHP classes in the file">Class count</th>
  1208. <th title="Indicates total amount of time in seconds for which the file has been in the cache">Add time</th>
  1209. <th title="Total amount of time in seconds which has elapsed since the file was last used">Use time</th>
  1210. <th title="Indicates total amount of time in seconds which has elapsed since the file was last checked for file change">Last check</th>
  1211. <th title="Number of times cache has been hit">Hit count</th>
  1212. </tr>
  1213. <?php
  1214. $sort_key = 'file_name';
  1215. usort( $ocache_file_info['file_entries'], 'cmp' );
  1216. foreach ( $ocache_file_info['file_entries'] as $entry ) {
  1217. echo '<tr title="', $entry['file_name'] ,'">', "\n";
  1218. echo '<td class="e">', get_trimmed_filename( $entry['file_name'], PATH_MAX_LENGTH ),'</td>', "\n";
  1219. echo '<td class="v">', $entry['function_count'],'</td>', "\n";
  1220. echo '<td class="v">', $entry['class_count'],'</td>', "\n";
  1221. echo '<td class="v">', $entry['add_time'],'</td>', "\n";
  1222. echo '<td class="v">', $entry['use_time'],'</td>', "\n";
  1223. echo '<td class="v">', $entry['last_check'],'</td>', "\n";
  1224. echo '<td class="v">', $entry['hit_count'],'</td>', "\n";
  1225. echo "</tr>\n";
  1226. }
  1227. ?>
  1228. </table>
  1229. </div>
  1230. <?php } else if ( $page == FCACHE_DATA ) {
  1231. init_cache_info( FCACHE_DATA );
  1232. ?>
  1233. <div class="overview">
  1234. <div class="leftpanel extra_margin">
  1235. <table style="width: 100%">
  1236. <tr>
  1237. <th colspan="2">File Cache Overview</th>
  1238. </tr>
  1239. <tr>
  1240. <td class="e">Cache uptime</td>
  1241. <td class="v"><?php echo ( isset( $fcache_file_info['total_cache_uptime'] ) ) ? seconds_to_words( $fcache_file_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1242. </tr>
  1243. <tr>
  1244. <td class="e">Cached files</td>
  1245. <td class="v"><?php echo $fcache_file_info['total_file_count']; ?></td>
  1246. </tr>
  1247. <tr>
  1248. <td class="e">Total files size</td>
  1249. <td class="v"><?php echo convert_bytes_to_string( $fcache_summary_info['total_size'] ); ?></td>
  1250. </tr>
  1251. <tr>
  1252. <td class="e">Hits</td>
  1253. <td class="v"><?php echo $fcache_file_info['total_hit_count']; ?></td>
  1254. </tr>
  1255. <tr>
  1256. <td class="e">Misses</td>
  1257. <td class="v"><?php echo $fcache_file_info['total_miss_count']; ?></td>
  1258. </tr>
  1259. <tr>
  1260. <td class="e">Total memory</td>
  1261. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_total'] ); ?></td>
  1262. </tr>
  1263. <tr>
  1264. <td class="e">Available memory</td>
  1265. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_free'] ); ?></td>
  1266. </tr>
  1267. <tr>
  1268. <td class="e">Memory overhead</td>
  1269. <td class="v"><?php echo convert_bytes_to_string( $fcache_mem_info['memory_overhead'] ); ?></td>
  1270. </tr>
  1271. </table>
  1272. </div>
  1273. <div class="rightpanel">
  1274. <?php echo get_chart_markup( FCACHE_DATA, BAR_CHART, $fcache_file_info['total_hit_count'], $fcache_file_info['total_miss_count'] ); ?>
  1275. </div>
  1276. <div class="rightpanel">
  1277. <?php echo get_chart_markup( FCACHE_DATA, PIE_CHART, $fcache_mem_info['memory_total'] - $fcache_mem_info['memory_free'], $fcache_mem_info['memory_free'] ); ?>
  1278. </div>
  1279. </div>
  1280. <div class="list" id="filelist">
  1281. <table style="width:100%">
  1282. <tr>
  1283. <th colspan="6">File cache entries</th>
  1284. </tr>
  1285. <tr>
  1286. <th title="Name of the file">File name</th>
  1287. <th title="Size of the file in KB">File size</th>
  1288. <th title="Indicates total amount of time in seconds for which the file has been in the cache">Add time</th>
  1289. <th title="Total amount of time in seconds which has elapsed since the file was last used">Use time</th>
  1290. <th title="Indicates total amount of time in seconds which has elapsed since the file was last checked for file change">Last check</th>
  1291. <th title="Number of times the file has been served from the cache">Hit Count</th>
  1292. </tr>
  1293. <?php
  1294. $sort_key = 'file_name';
  1295. usort( $fcache_file_info['file_entries'], 'cmp' );
  1296. foreach ( $fcache_file_info['file_entries'] as $entry ) {
  1297. echo '<tr title="', $entry['file_name'] ,'">', "\n";
  1298. echo '<td class="e">', get_trimmed_filename( $entry['file_name'], PATH_MAX_LENGTH ),'</td>', "\n";
  1299. echo '<td class="v">', convert_bytes_to_string( $entry['file_size'] ),'</td>', "\n";
  1300. echo '<td class="v">', $entry['add_time'],'</td>', "\n";
  1301. echo '<td class="v">', $entry['use_time'],'</td>', "\n";
  1302. echo '<td class="v">', $entry['last_check'],'</td>', "\n";
  1303. echo '<td class="v">', $entry['hit_count'],'</td>', "\n";
  1304. echo "</tr>\n";
  1305. }
  1306. ?>
  1307. </table>
  1308. </div>
  1309. <?php } else if ( $page == UCACHE_DATA && $ucache_key == null ) {
  1310. if ( $user_cache_available ) {
  1311. init_cache_info( UCACHE_DATA );
  1312. ?>
  1313. <div class="overview">
  1314. <div class="leftpanel extra_margin">
  1315. <table style="width: 100%">
  1316. <tr>
  1317. <th colspan="2">User Cache Overview</th>
  1318. </tr>
  1319. <tr>
  1320. <td class="e">Cache scope</td>
  1321. <td class="v"><?php echo ( isset( $ucache_info['is_local_cache'] ) ) ? cache_scope_text( $ucache_info['is_local_cache'] ) : 'Unknown'; ?></td>
  1322. </tr>
  1323. <tr>
  1324. <td class="e">Cache uptime</td>
  1325. <td class="v"><?php echo ( isset( $ucache_info['total_cache_uptime'] ) ) ? seconds_to_words( $ucache_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1326. </tr>
  1327. <tr>
  1328. <td class="e">Cached entries</td>
  1329. <td class="v"><?php echo $ucache_info['total_item_count'];
  1330. if ( USE_AUTHENTICATION && $ucache_info['total_item_count'] > 0 )
  1331. echo ' (<a href="', $PHP_SELF, '?page=', UCACHE_DATA, '&amp;clc=1">Clear All</a>)'; ?>
  1332. </td>
  1333. </tr>
  1334. <tr>
  1335. <td class="e">Hits</td>
  1336. <td class="v"><?php echo $ucache_info['total_hit_count']; ?></td>
  1337. </tr>
  1338. <tr>
  1339. <td class="e">Misses</td>
  1340. <td class="v"><?php echo $ucache_info['total_miss_count']; ?></td>
  1341. </tr>
  1342. <tr>
  1343. <td class="e">Total memory</td>
  1344. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_total'] ); ?></td>
  1345. </tr>
  1346. <tr>
  1347. <td class="e">Available memory</td>
  1348. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_free'] ); ?></td>
  1349. </tr>
  1350. <tr>
  1351. <td class="e">Memory overhead</td>
  1352. <td class="v"><?php echo convert_bytes_to_string( $ucache_mem_info['memory_overhead'] ); ?></td>
  1353. </tr>
  1354. </table>
  1355. </div>
  1356. <div class="rightpanel">
  1357. <?php echo get_chart_markup( UCACHE_DATA, BAR_CHART, $ucache_info['total_hit_count'], $ucache_info['total_miss_count'] ); ?>
  1358. </div>
  1359. <div class="rightpanel">
  1360. <?php echo get_chart_markup( UCACHE_DATA, PIE_CHART, $ucache_mem_info['memory_total'] - $ucache_mem_info['memory_free'], $ucache_mem_info['memory_free'] ); ?>
  1361. </div>
  1362. </div>
  1363. <div class="list" id="filelist">
  1364. <table style="width:100%">
  1365. <tr>
  1366. <th colspan="6">User cache entries</th>
  1367. </tr>
  1368. <tr>
  1369. <th title="Object Key Name">Key name</th>
  1370. <th title="Type of the object stored">Value type</th>
  1371. <th title="Size of the object stored">Value size</th>
  1372. <th title="Total amount of time in seconds which remains until the object is removed from the cache">Total TTL</th>
  1373. <th title="Total amount of time in seconds which has elapsed since the object was added to the cache">Total age</th>
  1374. <th title="Number of times the object has been served from the cache">Hit Count</th>
  1375. </tr>
  1376. <?php
  1377. $count = 0;
  1378. foreach ( $ucache_info['ucache_entries'] as $entry ) {
  1379. echo '<tr title="', $entry['key_name'] ,'">', "\n";
  1380. if ( USE_AUTHENTICATION )
  1381. echo '<td class="e"><a href="', $PHP_SELF, '?page=', UCACHE_DATA, '&key=', urlencode( $entry['key_name'] ), '">', get_trimmed_string( $entry['key_name'], PATH_MAX_LENGTH ),'</a></td>', "\n";
  1382. else
  1383. echo '<td class="e">', get_trimmed_string( $entry['key_name'], PATH_MAX_LENGTH ),'</td>', "\n";
  1384. echo '<td class="v">', $entry['value_type'], '</td>', "\n";
  1385. echo '<td class="v">', convert_bytes_to_string( $entry['value_size']), '</td>', "\n";
  1386. echo '<td class="v">', $entry['ttl_seconds'],'</td>', "\n";
  1387. echo '<td class="v">', $entry['age_seconds'],'</td>', "\n";
  1388. echo '<td class="v">', $entry['hitcount'],'</td>', "\n";
  1389. echo "</tr>\n";
  1390. if ($count++ > CACHE_MAX_ENTRY && !$show_all_ucache_entries){
  1391. echo '<tr><td colspan="6"><a href="', $PHP_SELF, '?page=', UCACHE_DATA, '&amp;all=1">Show all entries</td></tr>';
  1392. break;
  1393. }
  1394. }
  1395. ?>
  1396. </table>
  1397. </div>
  1398. <?php } else { ?>
  1399. <div class="overview">
  1400. <p class="notice">The user cache is not available. Enable the user cache by using <strong>wincache.ucenabled</strong>
  1401. directive in <strong>php.ini</strong> file.</p>
  1402. </div>
  1403. <?php }?>
  1404. <?php } else if ( $page == UCACHE_DATA && $ucache_key != null && USE_AUTHENTICATION ) {
  1405. if ( !wincache_ucache_exists( $ucache_key ) ){
  1406. ?>
  1407. <div class="overview">
  1408. <p class="notice">The variable with this key does not exist in the user cache.</p>
  1409. </div>
  1410. <?php }
  1411. else{
  1412. $ucache_entry_info = wincache_ucache_info( true, $ucache_key );
  1413. ?>
  1414. <div class="list">
  1415. <table width="60%">
  1416. <tr>
  1417. <th colspan="2">User Cache Entry Information</th>
  1418. </tr>
  1419. <tr>
  1420. <td class="e">Key</td>
  1421. <td class="v"><?php echo $ucache_entry_info['ucache_entries'][1]['key_name']; ?></td>
  1422. </tr>
  1423. <tr>
  1424. <td class="e">Value Type</td>
  1425. <td class="v"><?php echo $ucache_entry_info['ucache_entries'][1]['value_type']; ?></td>
  1426. </tr>
  1427. <tr>
  1428. <td class="e">Size</td>
  1429. <td class="v"><?php echo convert_bytes_to_string( $ucache_entry_info['ucache_entries'][1]['value_size'] ); ?></td>
  1430. </tr>
  1431. <tr>
  1432. <td class="e">Total Time To Live (in seconds)</td>
  1433. <td class="v"><?php echo $ucache_entry_info['ucache_entries'][1]['ttl_seconds']; ?></td>
  1434. </tr>
  1435. <tr>
  1436. <td class="e">Total Age (in seconds)</td>
  1437. <td class="v"><?php echo $ucache_entry_info['ucache_entries'][1]['age_seconds']; ?></td>
  1438. </tr>
  1439. <tr>
  1440. <td class="e">Hit Count</td>
  1441. <td class="v"><?php echo $ucache_entry_info['ucache_entries'][1]['hitcount']; ?></td>
  1442. </tr>
  1443. </table>
  1444. </div>
  1445. <div id="panel">
  1446. <div id="panel_header">
  1447. User Cache Entry Content
  1448. </div>
  1449. <div id="panel_body">
  1450. <pre><?php var_dump( wincache_ucache_get( $ucache_key ) )?></pre>
  1451. </div>
  1452. </div>
  1453. <?php }?>
  1454. <?php } else if ( $page == SCACHE_DATA ) {
  1455. if ( $session_cache_available ) {
  1456. init_cache_info( SCACHE_DATA );
  1457. ?>
  1458. <div class="overview">
  1459. <div class="leftpanel extra_margin">
  1460. <table style="width: 100%">
  1461. <tr>
  1462. <th colspan="2">Session Cache Overview</th>
  1463. </tr>
  1464. <tr>
  1465. <td class="e">Cache scope</td>
  1466. <td class="v"><?php echo ( isset( $scache_info['is_local_cache'] ) ) ? cache_scope_text( $scache_info['is_local_cache'] ) : 'Unknown'; ?></td>
  1467. </tr>
  1468. <tr>
  1469. <td class="e">Cache uptime</td>
  1470. <td class="v"><?php echo ( isset( $scache_info['total_cache_uptime'] ) ) ? seconds_to_words( $scache_info['total_cache_uptime'] ) : 'Unknown'; ?></td>
  1471. </tr>
  1472. <tr>
  1473. <td class="e">Cached entries</td>
  1474. <td class="v"><?php echo $scache_info['total_item_count']; ?></td>
  1475. </tr>
  1476. <tr>
  1477. <td class="e">Hits</td>
  1478. <td class="v"><?php echo $scache_info['total_hit_count']; ?></td>
  1479. </tr>
  1480. <tr>
  1481. <td class="e">Misses</td>
  1482. <td class="v"><?php echo $scache_info['total_miss_count']; ?></td>
  1483. </tr>
  1484. <tr>
  1485. <td class="e">Total memory</td>
  1486. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_total'] ); ?></td>
  1487. </tr>
  1488. <tr>
  1489. <td class="e">Available memory</td>
  1490. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_free'] ); ?></td>
  1491. </tr>
  1492. <tr>
  1493. <td class="e">Memory overhead</td>
  1494. <td class="v"><?php echo convert_bytes_to_string( $scache_mem_info['memory_overhead'] ); ?></td>
  1495. </tr>
  1496. </table>
  1497. </div>
  1498. <div class="rightpanel">
  1499. <?php echo get_chart_markup( SCACHE_DATA, BAR_CHART, $scache_info['total_hit_count'], $scache_info['total_miss_count'] ); ?>
  1500. </div>
  1501. <div class="rightpanel">
  1502. <?php echo get_chart_markup( SCACHE_DATA, PIE_CHART, $scache_mem_info['memory_total'] - $scache_mem_info['memory_free'], $scache_mem_info['memory_free'] ); ?>
  1503. </div>
  1504. </div>
  1505. <div class="list" id="sessionlist">
  1506. <table style="width:100%">
  1507. <tr>
  1508. <th colspan="6">Session cache entries</th>
  1509. </tr>
  1510. <tr>
  1511. <th title="Object Key Name">Key name</th>
  1512. <th title="Type of the object stored">Value type</th>
  1513. <th title="Size of the object stored">Value size</th>
  1514. <th title="Total amount of time in seconds which remains until the object is removed from the cache">Total TTL</th>
  1515. <th title="Total amount of time in seconds which has elapsed since the object was added to the cache">Total age</th>
  1516. <th title="Number of times the object has been served from the cache">Hit Count</th>
  1517. </tr>
  1518. <?php
  1519. $count = 0;
  1520. foreach ( $scache_info['scache_entries'] as $entry ) {
  1521. echo '<tr title="', $entry['key_name'] ,'">', "\n";
  1522. echo '<td class="e">', get_trimmed_string( $entry['key_name'], PATH_MAX_LENGTH ),'</td>', "\n";
  1523. echo '<td class="v">', $entry['value_type'], '</td>', "\n";
  1524. echo '<td class="v">', convert_bytes_to_string( $entry['value_size'] ), '</td>', "\n";
  1525. echo '<td class="v">', $entry['ttl_seconds'],'</td>', "\n";
  1526. echo '<td class="v">', $entry['age_seconds'],'</td>', "\n";
  1527. echo '<td class="v">', $entry['hitcount'],'</td>', "\n";
  1528. echo "</tr>\n";
  1529. if ($count++ > CACHE_MAX_ENTRY && !$show_all_ucache_entries){
  1530. echo '<tr><td colspan="6"><a href="', $PHP_SELF, '?page=', SCACHE_DATA, '&amp;all=1">Show all entries</td></tr>';
  1531. break;
  1532. }
  1533. }
  1534. ?>
  1535. </table>
  1536. </div>
  1537. <?php } else { ?>
  1538. <div class="overview">
  1539. <p class="notice">The session cache is not enabled. To enable session cache set the session handler in <strong>php.ini</strong> to
  1540. <strong>wincache</strong>, for example: <strong>session.save_handler=wincache</strong>.</p>
  1541. </div>
  1542. <?php }?>
  1543. <?php } else if ( $page == RCACHE_DATA ) {
  1544. init_cache_info( RCACHE_DATA );
  1545. ?>
  1546. <div class="overview">
  1547. <div class="wideleftpanel">
  1548. <table style="width: 100%">
  1549. <tr>
  1550. <th colspan="2">Resolve Path Cache Overview</th>
  1551. </tr>
  1552. <tr>
  1553. <td class="e">Cached entries</td>
  1554. <td class="v"><?php echo $rpcache_file_info['total_file_count'] ?></td>
  1555. </tr>
  1556. <tr>
  1557. <td class="e">Total memory</td>
  1558. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_total'] ); ?></td>
  1559. </tr>
  1560. <tr>
  1561. <td class="e">Available memory</td>
  1562. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_free'] ); ?></td>
  1563. </tr>
  1564. <tr>
  1565. <td class="e">Memory overhead</td>
  1566. <td class="v"><?php echo convert_bytes_to_string( $rpcache_mem_info['memory_overhead'] ); ?></td>
  1567. </tr>
  1568. </table>
  1569. </div>
  1570. </div>
  1571. <div class="list" id="filelist">
  1572. <table style="width:100%">
  1573. <tr>
  1574. <th colspan="2">Resolve path cache entries</th>
  1575. </tr>
  1576. <tr>
  1577. <th>Resolve path</th>
  1578. <th>Subkey data</th>
  1579. </tr>
  1580. <?php
  1581. $sort_key = 'resolve_path';
  1582. usort( $rpcache_file_info['rplist_entries'], 'cmp' );
  1583. foreach ( $rpcache_file_info['rplist_entries'] as $entry ) {
  1584. echo '<tr title="',$entry['subkey_data'], '">', "\n";
  1585. echo '<td class="e">', get_trimmed_string( $entry['resolve_path'], PATH_MAX_LENGTH ),'</td>', "\n";
  1586. echo '<td class="v">', get_trimmed_string( $entry['subkey_data'], SUBKEY_MAX_LENGTH ), '</td>', "\n";
  1587. echo "</tr>\n";
  1588. }
  1589. ?>
  1590. </table>
  1591. </div>
  1592. <?php } ?>
  1593. <div class="clear"></div>
  1594. </div>
  1595. </body>
  1596.  
  1597. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement