Index: trunk/extensions/Translate/utils/TranslateMetadata.php |
— | — | @@ -18,10 +18,19 @@ |
19 | 19 | * @return String |
20 | 20 | */ |
21 | 21 | public static function get( $group, $key ) { |
22 | | - $dbr = wfGetDB( DB_SLAVE ); |
23 | | - $conds = array( 'tmd_group' => $group, 'tmd_key' => $key ); |
24 | | - $result = $dbr->selectField( 'translate_metadata', 'tmd_value', $conds, __METHOD__ ); |
25 | | - return $result; |
| 22 | + static $cache = null; |
| 23 | + if ( $cache === null ) { |
| 24 | + $dbr = wfGetDB( DB_SLAVE ); |
| 25 | + $cache = $dbr->select( 'translate_metadata', '*', array(), __METHOD__ ); |
| 26 | + } |
| 27 | + |
| 28 | + foreach ( $cache as $row ) { |
| 29 | + if ( $row->tmd_group === $group && $row->tmd_key === $key ) { |
| 30 | + return $row->tmd_value; |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + return false; |
26 | 35 | } |
27 | 36 | |
28 | 37 | /** |