private function getEnabledFilesystemPaths($repositoryPath) { // Get a copy so that we can remove the entries that we processed // already $inMappings = $this->mappings->toArray(); $outMappings = array(); $filesystemPaths = array(); $this->filterEnabledMappings($repositoryPath, $inMappings, $outMappings); foreach ($outMappings as $mappingPath => $mappingsByModule) { foreach ($mappingsByModule as $moduleName => $mapping) { $filesystemPaths[$moduleName][$mappingPath] = $mapping->getFilesystemPaths(); } } if (!$filesystemPaths) { return array(); } // Sort primary keys (module names) $sortedNames = $this->overrideGraph->getSortedModuleNames(array_keys($filesystemPaths)); $filesystemPaths = array_replace(array_flip($sortedNames), $filesystemPaths); // Sort secondary keys (repository paths) foreach ($filesystemPaths as $moduleName => $pathsByModule) { ksort($filesystemPaths[$moduleName]); } return $filesystemPaths; }
/** * {@inheritdoc} */ public function execute() { // Quit if no mappings exist if (!($moduleNames = $this->mappings->getModuleNames())) { return; } $sortedNames = $this->overrideGraph->getSortedModuleNames($moduleNames); try { foreach ($sortedNames as $moduleName) { foreach ($this->getEnabledMappingsByModuleName($moduleName) as $repositoryPath => $mapping) { foreach ($mapping->getFilesystemPaths() as $filesystemPath) { $this->repo->add($repositoryPath, $this->createResource($filesystemPath)); $this->added = true; } } } } catch (Exception $e) { $this->repo->clear(); throw $e; } }