r34908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34907‎ | r34908 | r34909 >
Date:06:26, 16 May 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Don't try to show too big values
Modified paths:
  • /trunk/extensions/APC/APCCacheMode.php (modified) (history)
  • /trunk/extensions/APC/ViewAPC.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/APC/APCCacheMode.php
@@ -37,6 +37,7 @@
3838 foreach( $cache[$list] as $entry ) {
3939 if (md5($entry[$this->fieldKey]) !== $object) continue;
4040
 41+ $size = 0;
4142 foreach($entry as $key => $value) {
4243 switch ($key) {
4344 case 'num_hits':
@@ -49,6 +50,8 @@
5051 $value = wfMsg( 'viewapc-display-no-delete' );
5152 break;
5253 }
 54+ case 'mem_size':
 55+ $size = $value;
5356 default:
5457 $value = $this->formatValue( $key, $value );
5558 }
@@ -60,10 +63,16 @@
6164 }
6265
6366 if ( $this->userMode ) {
64 - $value = var_export(apc_fetch($entry[$this->fieldKey]),true);
65 - $s .= APCUtils::tableRow( $r=1-$r,
 67+ if ( $size > 1024*1024 ) {
 68+ $s .= APCUtils::tableRow( $r=1-$r,
6669 wfMsgHtml( 'viewapc-display-stored-value' ),
67 - Xml::element( 'pre', null, $value ) );
 70+ wfMsgExt( 'viewapc-display-too-big', 'parseinline' ) );
 71+ } else {
 72+ $value = var_export(apc_fetch($entry[$this->fieldKey]),true);
 73+ $s .= APCUtils::tableRow( $r=1-$r,
 74+ wfMsgHtml( 'viewapc-display-stored-value' ),
 75+ Xml::element( 'pre', null, $value ) );
 76+ }
6877 }
6978 }
7079 }
Index: trunk/extensions/APC/ViewAPC.i18n.php
@@ -79,6 +79,7 @@
8080 'viewapc-display-ref_count' => 'Reference count',
8181 'viewapc-display-mem_size' => 'Size',
8282 'viewapc-display-stored-value' => 'Stored value',
 83+ 'viewapc-display-too-big' => "''Content is too large to show.''",
8384
8485 'viewapc-ls-options-legend' => 'Options',
8586 'viewapc-ls-options' => 'Scope: $1 Sorting: $2$3$4 Search: $5 $6',

Status & tagging log