MINOR Removed duplicated code in i18nTextCollector, more defensive checks for get_owner_module()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@104992 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-05-17 03:17:09 +00:00 committed by Sam Minnee
parent 416c8fcc2a
commit a809289a25

View File

@ -94,6 +94,7 @@ class i18nTextCollector extends Object {
// we store the master string tables
$processedEntities = $this->processModule($module);
if(isset($entitiesByModule[$module])) {
$entitiesByModule[$module] = array_merge_recursive($entitiesByModule[$module], $processedEntities);
} else {
@ -102,24 +103,14 @@ class i18nTextCollector extends Object {
// extract all entities for "foreign" modules (fourth argument)
foreach($entitiesByModule[$module] as $fullName => $spec) {
if(isset($spec[3]) && $spec[3] != $module) {
if(isset($spec[3]) && $spec[3] && $spec[3] != $module) {
$othermodule = $spec[3];
if(!isset($entitiesByModule[$othermodule])) $entitiesByModule[$othermodule] = array();
unset($spec[3]);
$entitiesByModule[$othermodule][$fullName] = $spec;
unset($entitiesByModule[$module][$fullName]);
}
}
// extract all entities for "foreign" modules (fourth argument)
foreach($entitiesByModule[$module] as $fullName => $spec) {
if(isset($spec[3]) && $spec[3] != $module) {
$othermodule = $spec[3];
if(!isset($entitiesByModule[$othermodule])) $entitiesByModule[$othermodule] = array();
unset($spec[3]);
$entitiesByModule[$othermodule][$fullName] = $spec;
}
}
}
}
// Write the generated master string tables