dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LocalisationCache: Avoid use of compact()
[lhc/web/wiklou.git]
/
includes
/
cache
/
localisation
/
LocalisationCache.php
diff --git
a/includes/cache/localisation/LocalisationCache.php
b/includes/cache/localisation/LocalisationCache.php
index
5e0a688
..
e7b9554
100644
(file)
--- a/
includes/cache/localisation/LocalisationCache.php
+++ b/
includes/cache/localisation/LocalisationCache.php
@@
-199,22
+199,22
@@
class LocalisationCache {
switch ( $conf['store'] ) {
case 'files':
case 'file':
switch ( $conf['store'] ) {
case 'files':
case 'file':
- $storeClass =
'LCStoreCDB'
;
+ $storeClass =
LCStoreCDB::class
;
break;
case 'db':
break;
case 'db':
- $storeClass =
'LCStoreDB'
;
+ $storeClass =
LCStoreDB::class
;
break;
case 'array':
break;
case 'array':
- $storeClass =
'LCStoreStaticArray'
;
+ $storeClass =
LCStoreStaticArray::class
;
break;
case 'detect':
if ( !empty( $conf['storeDirectory'] ) ) {
break;
case 'detect':
if ( !empty( $conf['storeDirectory'] ) ) {
- $storeClass =
'LCStoreCDB'
;
+ $storeClass =
LCStoreCDB::class
;
} elseif ( $wgCacheDirectory ) {
$storeConf['directory'] = $wgCacheDirectory;
} elseif ( $wgCacheDirectory ) {
$storeConf['directory'] = $wgCacheDirectory;
- $storeClass =
'LCStoreCDB'
;
+ $storeClass =
LCStoreCDB::class
;
} else {
} else {
- $storeClass =
'LCStoreDB'
;
+ $storeClass =
LCStoreDB::class
;
}
break;
default:
}
break;
default:
@@
-517,20
+517,30
@@
class LocalisationCache {
*/
protected function readPHPFile( $_fileName, $_fileType ) {
// Disable APC caching
*/
protected function readPHPFile( $_fileName, $_fileType ) {
// Disable APC caching
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
$_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
$_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
-
MediaWiki
\restoreWarnings();
+
Wikimedia
\restoreWarnings();
include $_fileName;
include $_fileName;
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
ini_set( 'apc.cache_by_default', $_apcEnabled );
ini_set( 'apc.cache_by_default', $_apcEnabled );
-
MediaWiki
\restoreWarnings();
+
Wikimedia
\restoreWarnings();
+ $data = [];
if ( $_fileType == 'core' || $_fileType == 'extension' ) {
if ( $_fileType == 'core' || $_fileType == 'extension' ) {
- $data = compact( self::$allKeys );
+ foreach ( self::$allKeys as $key ) {
+ // Not all keys are set in language files, so
+ // check they exist first
+ if ( isset( $$key ) ) {
+ $data[$key] = $$key;
+ }
+ }
} elseif ( $_fileType == 'aliases' ) {
} elseif ( $_fileType == 'aliases' ) {
- $data = compact( 'aliases' );
+ if ( isset( $aliases ) ) {
+ /** @suppress PhanUndeclaredVariable */
+ $data['aliases'] = $aliases;
+ }
} else {
throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" );
}
} else {
throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" );
}