diff options
Diffstat (limited to 'MLEB/Translate/utils/MessageGroupCache.php')
-rw-r--r-- | MLEB/Translate/utils/MessageGroupCache.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/MLEB/Translate/utils/MessageGroupCache.php b/MLEB/Translate/utils/MessageGroupCache.php index 4f5713f9..fa44f561 100644 --- a/MLEB/Translate/utils/MessageGroupCache.php +++ b/MLEB/Translate/utils/MessageGroupCache.php @@ -4,7 +4,7 @@ * @file * @author Niklas Laxström * @copyright Copyright © 2009-2013 Niklas Laxström - * @license GPL-2.0+ + * @license GPL-2.0-or-later */ /** @@ -26,7 +26,7 @@ class MessageGroupCache { protected $group; /** - * @var CdbReader + * @var \Cdb\Reader */ protected $cache; @@ -116,7 +116,7 @@ class MessageGroupCache { $this->close(); // Close the reader instance just to be sure $messages = $this->group->load( $this->code ); - if ( $messages === array() ) { + if ( $messages === [] ) { if ( $this->exists() ) { // Delete stale cache files unlink( $this->getCacheFileName() ); @@ -127,7 +127,7 @@ class MessageGroupCache { $hash = md5( file_get_contents( $this->group->getSourceFilePath( $this->code ) ) ); wfMkdirParents( dirname( $this->getCacheFileName() ) ); - $cache = CdbWriter::open( $this->getCacheFileName() ); + $cache = \Cdb\Writer::open( $this->getCacheFileName() ); $keys = array_keys( $messages ); $cache->set( '#keys', serialize( $keys ) ); @@ -149,10 +149,10 @@ class MessageGroupCache { * Checks whether the cache still reflects the source file. * It uses multiple conditions to speed up the checking from file * modification timestamps to hashing. - * @param int $reason + * @param int &$reason * @return bool Whether the cache is up to date. */ - public function isValid( &$reason = 0 ) { + public function isValid( &$reason ) { $group = $this->group; $groupId = $group->getId(); @@ -206,7 +206,7 @@ class MessageGroupCache { // Message count check $messages = $group->load( $this->code ); // CDB converts numbers to strings - $count = intval( $this->get( '#msgcount' ) ); + $count = (int)( $this->get( '#msgcount' ) ); if ( $count !== count( $messages ) ) { // Number of messsages has changed $reason = self::CHANGED; @@ -234,7 +234,7 @@ class MessageGroupCache { */ protected function open() { if ( $this->cache === null ) { - $this->cache = CdbReader::open( $this->getCacheFileName() ); + $this->cache = \Cdb\Reader::open( $this->getCacheFileName() ); if ( $this->cache->get( '#version' ) !== '3' ) { $this->close(); unlink( $this->getCacheFileName() ); |