Пример #1
0
 function _parsePackageXml(&$descfile, &$tmpdir)
 {
     if (substr($descfile, -4) == '.xml') {
         $tmpdir = false;
     } else {
         // {{{ Decompress pack in tmp dir -------------------------------------
         // To allow relative package file names
         $descfile = realpath($descfile);
         if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
             return $tmpdir;
         }
         $this->log(3, '+ tmp dir created at ' . $tmpdir);
         // }}}
     }
     // Parse xml file -----------------------------------------------
     $pkg = new PEAR_PackageFile($this->config, $this->debug, $tmpdir);
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $p =& $pkg->fromAnyFile($descfile, PEAR_VALIDATE_INSTALLING);
     PEAR::staticPopErrorHandling();
     if (PEAR::isError($p)) {
         foreach ($pkg->getValidationWarnings(true) as $err) {
             $loglevel = $err['level'] == 'error' ? 0 : 1;
             if (!isset($this->_options['soft'])) {
                 $this->log($loglevel, ucfirst($err['level']) . ': ' . $err['message']);
             }
         }
         return $this->raiseError('Installation failed: invalid package file');
     } else {
         $descfile = $p->getPackageFile();
     }
     return $p;
 }