예제 #1
0
파일: Remote.php 프로젝트: swk/bluebox
 public static function queryRepositories($repos = NULL)
 {
     if (is_null($repos)) {
         $repos = Kohana::config('core.repositories');
     }
     if (!is_array($repos)) {
         $repos = array($repos);
     }
     if (empty($repos)) {
         return array();
     }
     $remoteCatalogs = array();
     foreach ($repos as $repo) {
         if (!($repoXMLCatalog = self::fetch($repo))) {
             continue;
         }
         $remoteCatalog = self::fromXML($repoXMLCatalog);
         foreach ($remoteCatalog as $package) {
             Package_Catalog_Standardize::packageData($package, NULL);
             Package_Catalog_Standardize::navigation($package);
             if (empty($package['identifier'])) {
                 Package_Message::log('alert', 'Remote repo ' . $repo . ' provided an invalid package, ignoring!');
                 continue;
             }
             if (array_key_exists($package['identifier'], Package_Catalog::getCatalog())) {
                 Package_Message::log('debug', 'Remote repo ' . $repo . ' provided existing package ' . $package['packageName'] . ' version ' . $package['version'] . ', ignoring');
                 continue;
             }
             Package_Message::log('debug', 'Remote repo ' . $repo . ' provided new package ' . $package['packageName'] . ' version ' . $package['version']);
             $package['status'] = Package_Manager::STATUS_UNINSTALLED;
             $remoteCatalogs[$package['identifier']] = $package;
         }
     }
     return $remoteCatalogs;
 }
예제 #2
0
파일: Catalog.php 프로젝트: swk/bluebox
 public static function buildCatalog()
 {
     self::$catalog = array();
     self::$packageList = array();
     $configureFiles = self::listConfigureFiles();
     $installedPackages = array();
     foreach ($configureFiles as $class => $filepath) {
         $metadata = get_class_vars($class);
         $metadata['configure_class'] = $class;
         Package_Catalog_Standardize::packageData($metadata, $filepath);
         Package_Catalog_Standardize::navigation($metadata);
         Package_Catalog_Standardize::typeRestrictions($metadata);
         Package_Catalog_Datastore::import($metadata);
         //Package_Message::log('debug', 'Catalog added ' .str_replace(DOCROOT, '', $filepath) .' as ' .$metadata['packageName'] .' version ' .$metadata['version'] . ' identified by ' .$metadata['identifier']);
         self::$catalog[$metadata['identifier']] = $metadata;
         self::$packageList[$metadata['packageName']][$metadata['status']][$metadata['identifier']] =& self::$catalog[$metadata['identifier']];
     }
     if (self::$remote) {
         $remoteCatalog = Package_Catalog_Remote::queryRepositories();
         foreach ($remoteCatalog as $identifier => $metadata) {
             if (!empty(self::$catalog[$identifier])) {
                 continue;
             }
             self::$catalog[$identifier] = $metadata;
             self::$packageList[$metadata['packageName']][Package_Manager::STATUS_UNINSTALLED][$identifier] =& self::$catalog[$identifier];
         }
     }
     self::findAvaliableMigrations();
     return self::$catalog;
 }