*/
public function getItem( $code, $key ) {
if ( !isset( $this->loadedItems[$code][$key] ) ) {
- wfProfileIn( __METHOD__ . '-load' );
$this->loadItem( $code, $key );
- wfProfileOut( __METHOD__ . '-load' );
}
if ( $key === 'fallback' && isset( $this->shallowFallbacks[$code] ) ) {
if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) &&
!isset( $this->loadedItems[$code][$key] )
) {
- wfProfileIn( __METHOD__ . '-load' );
$this->loadSubitem( $code, $key, $subkey );
- wfProfileOut( __METHOD__ . '-load' );
}
if ( isset( $this->data[$code][$key][$subkey] ) ) {
* @return array
*/
protected function readPHPFile( $_fileName, $_fileType ) {
- wfProfileIn( __METHOD__ );
// Disable APC caching
wfSuppressWarnings();
$_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
} elseif ( $_fileType == 'aliases' ) {
$data = compact( 'aliases' );
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" );
}
- wfProfileOut( __METHOD__ );
return $data;
}
* @return array Array with a 'messages' key, or empty array if the file doesn't exist
*/
public function readJSONFile( $fileName ) {
- wfProfileIn( __METHOD__ );
if ( !is_readable( $fileName ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
$json = file_get_contents( $fileName );
if ( $json === false ) {
- wfProfileOut( __METHOD__ );
return array();
}
$data = FormatJson::decode( $json, true );
if ( $data === null ) {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ": Invalid JSON file: $fileName" );
}
}
}
- wfProfileOut( __METHOD__ );
-
// The JSON format only supports messages, none of the other variables, so wrap the data
return array( 'messages' => $data );
}
* rules, and save the compiled rules in a process-local cache.
*
* @param string $fileName
+ * @throws MWException
*/
protected function loadPluralFile( $fileName ) {
// Use file_get_contents instead of DOMDocument::load (T58439)
*/
protected function readSourceFilesAndRegisterDeps( $code, &$deps ) {
global $IP;
- wfProfileIn( __METHOD__ );
// This reads in the PHP i18n file with non-messages l10n data
$fileName = Language::getMessagesFileName( $code );
$deps['plurals'] = new FileDependency( "$IP/languages/data/plurals.xml" );
$deps['plurals-mw'] = new FileDependency( "$IP/languages/data/plurals-mediawiki.xml" );
- wfProfileOut( __METHOD__ );
-
return $data;
}
*/
public function recache( $code ) {
global $wgExtensionMessagesFiles;
- wfProfileIn( __METHOD__ );
if ( !$code ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Invalid language code requested" );
}
$this->recachedLangs[$code] = true;
$codeSequence = array_merge( array( $code ), $coreData['fallbackSequence'] );
$messageDirs = $this->getMessagesDirs();
- wfProfileIn( __METHOD__ . '-fallbacks' );
-
# Load non-JSON localisation data for extensions
$extensionData = array_combine(
$codeSequence,
}
}
- wfProfileOut( __METHOD__ . '-fallbacks' );
-
# Add cache dependencies for any referenced globals
$deps['wgExtensionMessagesFiles'] = new GlobalDependency( 'wgExtensionMessagesFiles' );
// $wgMessagesDirs is used in LocalisationCache::getMessagesDirs()
Hooks::run( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) );
if ( is_null( $allData['namespaceNames'] ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': Localisation data failed sanity check! ' .
'Check that your languages/messages/MessagesEn.php file is intact.' );
}
}
# Save to the persistent cache
- wfProfileIn( __METHOD__ . '-write' );
$this->store->startWrite( $code );
foreach ( $allData as $key => $value ) {
if ( in_array( $key, self::$splitKeys ) ) {
}
}
$this->store->finishWrite();
- wfProfileOut( __METHOD__ . '-write' );
# Clear out the MessageBlobStore
# HACK: If using a null (i.e. disabled) storage backend, we
MessageBlobStore::getInstance()->clear();
}
- wfProfileOut( __METHOD__ );
}
/**