r72962 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72961‎ | r72962 | r72963 >
Date:09:27, 14 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Ditch cdb wrapper for message index, it's useless
Modified paths:
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageIndexRebuilder.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageIndexRebuilder.php
@@ -41,11 +41,8 @@
4242 self::checkAndAdd( $hugearray, $g, true );
4343 }
4444
45 - $filename = TranslateUtils::cacheFile( 'translate_messageindex.cdb' );
46 -
47 - $writer = CdbWriter::open( $filename );
48 - $writer->set( 'map', serialize( $hugearray ) );
49 - $writer->close();
 45+ $filename = TranslateUtils::cacheFile( 'translate_messageindex.ser' );
 46+ file_put_contents( $filename, serialize( $hugearray ) );
5047 }
5148
5249 protected static function checkAndAdd( &$hugearray, $g, $ignore = false ) {
Index: trunk/extensions/Translate/TranslateUtils.php
@@ -304,18 +304,17 @@
305305 * @return \array or \type{false}
306306 */
307307 public static function messageIndex() {
308 - $filename = self::cacheFile( 'translate_messageindex.cdb' );
 308+ wfDebug( __METHOD__ . ": loading from file...\n" );
 309+ $filename = self::cacheFile( 'translate_messageindex.ser' );
309310
310311 if ( !file_exists( $filename ) ) {
311312 MessageIndexRebuilder::execute();
312313 }
313314
314315 if ( file_exists( $filename ) ) {
315 - $reader = CdbReader::open( $filename );
316 - $keyToGroup = unserialize( $reader->get( 'map' ) );
 316+ $keyToGroup = unserialize( file_get_contents( $filename ) );
317317 } else {
318 - $keyToGroup = false;
319 - wfDebug( __METHOD__ . ": Message index missing." );
 318+ throw new MWException( 'Unable to get message index' );
320319 }
321320
322321 self::$mi = $keyToGroup;

Status & tagging log