summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/MessageGroups.php')
-rw-r--r--MLEB/Translate/MessageGroups.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/MLEB/Translate/MessageGroups.php b/MLEB/Translate/MessageGroups.php
index 4adfd344..279439b5 100644
--- a/MLEB/Translate/MessageGroups.php
+++ b/MLEB/Translate/MessageGroups.php
@@ -28,7 +28,6 @@ class MessageGroups {
return;
}
- wfProfileIn( __METHOD__ );
self::$groups = array();
global $wgAutoloadClasses;
@@ -47,7 +46,6 @@ class MessageGroups {
$wgAutoloadClasses[$class] = $file;
}
}
- wfProfileOut( __METHOD__ );
}
/**
@@ -77,7 +75,6 @@ class MessageGroups {
* to have three ways: Yaml files, translatable pages and with the hook.
*/
protected static function loadGroupDefinitions() {
- wfProfileIn( __METHOD__ );
global $wgEnablePageTranslation, $wgTranslateGroupFiles;
global $wgTranslateCC, $wgAutoloadClasses, $wgTranslateWorkflowStates;
@@ -119,10 +116,17 @@ class MessageGroups {
wfProfileOut( __METHOD__ . '-hook' );
wfProfileIn( __METHOD__ . '-yaml' );
+ $parser = new MessageGroupConfigurationParser();
foreach ( $wgTranslateGroupFiles as $configFile ) {
- wfDebug( $configFile . "\n" );
$deps[] = new FileDependency( realpath( $configFile ) );
- $fgroups = TranslateYaml::parseGroupFile( $configFile );
+
+ $yaml = file_get_contents( $configFile );
+ $fgroups = $parser->getHopefullyValidConfigurations(
+ $yaml,
+ function ( $index, $config, $errmsg ) use ( $configFile ) {
+ trigger_error( "Document $index in $configFile is invalid: $errmsg", E_USER_WARNING );
+ }
+ );
foreach ( $fgroups as $id => $conf ) {
if ( !empty( $conf['AUTOLOAD'] ) && is_array( $conf['AUTOLOAD'] ) ) {
@@ -158,7 +162,6 @@ class MessageGroups {
wfProfileOut( __METHOD__ . '-save' );
wfDebug( __METHOD__ . "-end\n" );
- wfProfileOut( __METHOD__ );
}
/**
@@ -500,14 +503,12 @@ class MessageGroups {
* @since 2012-04-30
*/
public static function getGroupsByType( $type ) {
- wfProfileIn( __METHOD__ );
$groups = self::getAllGroups();
foreach ( $groups as $id => $group ) {
if ( !$group instanceof $type ) {
unset( $groups[$id] );
}
}
- wfProfileOut( __METHOD__ );
return $groups;
}
@@ -523,7 +524,6 @@ class MessageGroups {
*/
public static function getGroupStructure() {
$groups = self::getAllGroups();
- wfProfileIn( __METHOD__ );
// Determine the top level groups of the tree
$tree = $groups;
@@ -581,8 +581,6 @@ class MessageGroups {
throw new MWException( "Found cyclic aggregate message groups: $participants" );
}
- wfProfileOut( __METHOD__ );
-
return $tree;
}