Beispiel #1
0
 function __construct(\Pyrus\PackageFile\v2\Files $parent, \Pyrus\PackageFile\v2 $ultraparent, array $info)
 {
     $this->parent = $parent;
     $this->pkg = $ultraparent;
     $this->tasksNs = $ultraparent->getTasksNs() . ':';
     parent::__construct($info);
 }
Beispiel #2
0
 function fromPackageFile(\Pyrus\PackageFileInterface $package)
 {
     \Pyrus\PackageFile\v2::fromPackageFile($package);
     if (isset($this->packageInfo['contents']['dir']['attribs']['baseinstalldir'])) {
         $this->baseinstalldirs = array('/' => $this->packageInfo['contents']['dir']['attribs']['baseinstalldir']);
     }
 }
Beispiel #3
0
 function toArray($forpackaging = false)
 {
     if ($forpackaging) {
         return parent::toArray($forpackaging);
     }
     $a = parent::toArray();
     if (isset($a['package']['contents']['dir'])) {
         $a['package']['contents']['dir'] = $this->_recursiveXmlFilelist();
     }
     return $a;
 }
Beispiel #4
0
 /**
  * Allow setting of attributes and tasks directly
  *
  * @param string $var
  * @param string|object $value
  */
 function __set($var, $value)
 {
     if (strpos($var, $this->_packagefile->getTasksNs()) === 0) {
         // setting a file task
         if ($value instanceof \Pyrus\Task\Common) {
             $this->_packagefile->setFileAttribute($this->dir . $this['attribs']['name'], $var, $value);
             return;
         }
         throw new \Pyrus\PackageFile\Exception('Cannot set ' . $var . ' to non-' . '\\Pyrus\\Task\\Common object in file ' . $this->dir . $this['attribs']['name']);
     }
     $this->_packagefile->setFileAttribute($this->dir . $this['attribs']['name'], $var, $value);
     parent::__construct($this->_packagefile->files[$this->dir . $this['attribs']['name']]);
 }
Beispiel #5
0
 function _analyzePhpFiles()
 {
     if (!$this->_pf->packagefile) {
         throw new \Pyrus\PackageFile\Exception('Cannot validate files, no path to package file is set (use setPackageFile())');
     }
     foreach ($this->_pf->contents as $fa) {
         if (!file_exists($this->_pf->getFilePath($fa->name))) {
             $this->errors->E_ERROR[] = new \Pyrus\PackageFile\Exception('File "' . $this->_pf->getFilePath($fa->name) . '" in package.xml does not exist');
             continue;
         }
         $this->analyzeSourceCode($this->_pf->getFilePath($fa->name));
     }
     return !count($this->errors->E_ERROR);
 }
Beispiel #6
0
 function __set($var, $value)
 {
     if (!isset($this->packagename)) {
         throw new \Pyrus\Registry\Exception('Attempt to retrieve ' . $var . ' from unknown package');
     }
     \Pyrus\PackageFile\v2::__set($var, $value);
     // occasionally, this next line will result in failure to install when incomplete data is there,
     // so we silently skip the save, and mark the packagefile as dirty
     try {
         $this->reg->replace($this);
         $this->dirty = false;
     } catch (\Pyrus\Registry\Exception $e) {
         $this->dirty = true;
     }
 }
Beispiel #7
0
 function __set($var, $value)
 {
     if (!isset($this->packagename)) {
         throw new \Pyrus\Registry\Exception('Attempt to retrieve ' . $var . ' from unknown package');
     }
     parent::__set($var, $value);
     $this->reg->replace($this);
 }
Beispiel #8
0
 function getMaintainer()
 {
     // can't get email addresses from REST, have to grab the entire package.xml
     $this->grabEntirePackagexml();
     return parent::getMaintainer();
 }