function getFilePath($file) { $role = \Pyrus\Installer\Role::factory($this->packagefile->getPackageType(), $this->packagefile->packagingcontents[$file]['attribs']['role']); list(, $path) = $role->getRelativeLocation($this->packagefile, new \Pyrus\PackageFile\v2Iterator\FileTag($this->packagefile->packagingcontents[$file], '', $this->packagefile), true); $dir = \Pyrus\Config::singleton($this->registry->getPath())->{$role->getLocationConfig()}; return $dir . DIRECTORY_SEPARATOR . $path; }
function __construct($path = null) { $this->path = $path === null ? Config::current()->plugins_dir : $path; $current = Config::current(); self::$config = Config::singleton($this->path); Config::setCurrent($current->path); parent::__construct($this->path, array('Sqlite3', 'Xml')); }
public function toPackageFile($package, $channel, $onlyMain = false) { if ($this->exists($package, $channel, true)) { foreach ($this->registries as $reg) { if ($reg instanceof Registry\Xml) { // prefer xml for retrieving packagefile object try { return $reg->toPackageFile($package, $channel); } catch (\Exception $e) { // failed, cascade to using default registry instead break; } } } return $this->registries[0]->toPackageFile($package, $channel); } elseif ($onlyMain || !$this->exists($package, $channel, false)) { throw new Registry\Exception('Cannot retrieve package file object ' . 'for package ' . $channel . '/' . $package . ', it is not installed'); } // installed in parent registry return $this->parent->toPackageFile($package, $channel); }
function upgradeRegistry($args, $options) { if (!file_exists($args['path']) || !is_dir($args['path'])) { echo "Cannot upgrade registries at ", $args['path'], ", path does not exist or is not a directory\n"; exit(1); } echo "Upgrading registry at path ", $args['path'], "\n"; $registries = \Pyrus\Registry::detectRegistries($args['path']); if (!count($registries)) { echo "No registries found\n"; exit; } if (!in_array('Pear1', $registries)) { echo "Registry already upgraded\n"; exit; } $pear1 = new \Pyrus\Registry\Pear1($args['path']); if (!in_array('Sqlite3', $registries)) { $sqlite3 = new \Pyrus\Registry\Sqlite3($args['path']); $sqlite3->cloneRegistry($pear1); } if (!in_array('Xml', $registries)) { $xml = new \Pyrus\Registry\Xml($args['path']); $sqlite3 = new \Pyrus\Registry\Sqlite3($args['path']); $xml->cloneRegistry($sqlite3); } if ($options['removeold']) { \Pyrus\Registry\Pear1::removeRegistry($args['path']); } }