https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112876
Revision: 112876
Author: nikerabbit
Date: 2012-03-02 10:03:17 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
Clear cache on writes
Modified Paths:
--------------
trunk/extensions/Translate/utils/TranslateMetadata.php
Modified: trunk/extensions/Translate/utils/TranslateMetadata.php
===================================================================
--- trunk/extensions/Translate/utils/TranslateMetadata.php 2012-03-02
07:16:44 UTC (rev 112875)
+++ trunk/extensions/Translate/utils/TranslateMetadata.php 2012-03-02
10:03:17 UTC (rev 112876)
@@ -11,6 +11,8 @@
*/
class TranslateMetadata {
+ protected static $cache = null;
+
/**
* Get a metadata value for the given group and key.
* @param $group The group name
@@ -18,13 +20,12 @@
* @return String
*/
public static function get( $group, $key ) {
- static $cache = null;
- if ( $cache === null ) {
+ if ( self::$cache === null ) {
$dbr = wfGetDB( DB_SLAVE );
$cache = $dbr->select( 'translate_metadata', '*',
array(), __METHOD__ );
}
- foreach ( $cache as $row ) {
+ foreach ( self::$cache as $row ) {
if ( $row->tmd_group === $group && $row->tmd_key ===
$key ) {
return $row->tmd_value;
}
@@ -48,6 +49,8 @@
} else {
$dbw->replace( 'translate_metadata', array( array(
'tmd_group', 'tmd_key' ) ), $data, __METHOD__ );
}
+
+ $this->cache = null;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs