Example #1
0
 /**
  * set the paths to scan for pyrus installations
  */
 public function setCascadingRegistries($path)
 {
     $paths = explode(PATH_SEPARATOR, $path);
     $paths = array_unique($paths);
     $readonly = false;
     foreach ($paths as $path) {
         try {
             if ($path === '.') {
                 continue;
             }
             $registries = Registry::detectRegistries($path);
             if (!count($registries)) {
                 if ($readonly) {
                     // no installation present
                     continue;
                 }
                 $registries = array('Sqlite3', 'Xml');
             }
             $registry_class = Registry::$className;
             $registry = new $registry_class($path, $registries, $readonly);
             $channel_registry = $registry->getChannelRegistry();
             if (!$readonly) {
                 $this->myregistry = $registry;
                 $this->mychannelRegistry = $channel_registry;
             }
             $readonly = true;
             $registry->setParent();
             // clear any previous parent
             $channel_registry->setParent();
             // clear any previous parent
             if (isset($last)) {
                 $last->setParent($registry);
                 $lastc->setParent($channel_registry);
             }
             $last = $registry;
             $lastc = $channel_registry;
             if ($this->packagingRoot) {
                 break;
                 // no cascading registries allowed for packaging
             }
         } catch (\Exception $e) {
             if (!$readonly) {
                 throw new Config\Exception('Cannot initialize primary registry in path ' . $path, $e);
             } else {
                 // silently skip this registry
                 continue;
             }
         }
     }
 }