Permalink
Browse files

MINOR Removed duplicated code in i18nTextCollector, more defensive ch…

…ecks for get_owner_module() (from r104992)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112419 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Oct 15, 2010
1 parent a213ce7 commit 4f798d4d129f76e7a73957514fc359bdf3cd28dd
Showing with 3 additions and 12 deletions.
  1. +3 −12 core/i18nTextCollector.php
View
@@ -94,6 +94,7 @@ public function run($restrictToModules = null) {
// 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 @@ public function run($restrictToModules = null) {
// 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

0 comments on commit 4f798d4

Please sign in to comment.