当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_PackageFile::fromTgzFile方法代码示例

本文整理汇总了PHP中PEAR_PackageFile::fromTgzFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile::fromTgzFile方法的具体用法?PHP PEAR_PackageFile::fromTgzFile怎么用?PHP PEAR_PackageFile::fromTgzFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_PackageFile的用法示例。


在下文中一共展示了PEAR_PackageFile::fromTgzFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: infoFromTgzFile

 /**
  * Returns information about a package file.  Expects the name of
  * a gzipped tar file as input.
  *
  * @param string  $file  name of .tgz file
  *
  * @return array  array with package information
  *
  * @access public
  * @deprecated use PEAR_PackageFile->fromTgzFile() instead
  *
  */
 function infoFromTgzFile($file)
 {
     $config =& PEAR_Config::singleton();
     $packagefile = new PEAR_PackageFile($config);
     $pf =& $packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         $errs = $pf->getUserinfo();
         if (is_array($errs)) {
             foreach ($errs as $error) {
                 $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
             }
         }
         return $pf;
     }
     return $this->_postProcessValidPackagexml($pf);
 }
开发者ID:stof,项目名称:pearweb,代码行数:28,代码来源:apidoc-queue.php

示例2: realpath

 /**
  * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
  *
  * This method is able to extract information about a package from a .tgz
  * archive or from a XML package definition file.
  *
  * @access public
  * @param   string  $info file name
  * @param   int     $state package state (one of PEAR_VALIDATE_* constants)
  * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
  * @uses    fromPackageFile() if the file appears to be XML
  * @uses    fromTgzFile() to load all non-XML files
  */
 function &fromAnyFile($info, $state)
 {
     if (is_dir($info)) {
         $dir_name = realpath($info);
         if (file_exists($dir_name . '/package.xml')) {
             $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package.xml', $state);
         } elseif (file_exists($dir_name . '/package2.xml')) {
             $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package2.xml', $state);
         } else {
             $info = PEAR::raiseError("No package definition found in '{$info}' directory");
         }
         return $info;
     }
     $fp = false;
     if (is_string($info) && strlen($info) < 255 && (file_exists($info) || ($fp = @fopen($info, 'r')))) {
         if ($fp) {
             fclose($fp);
         }
         $tmp = substr($info, -4);
         if ($tmp == '.xml') {
             $info =& PEAR_PackageFile::fromPackageFile($info, $state);
         } elseif ($tmp == '.tar' || $tmp == '.tgz') {
             $info =& PEAR_PackageFile::fromTgzFile($info, $state);
         } else {
             $fp = fopen($info, "r");
             $test = fread($fp, 5);
             fclose($fp);
             if ($test == "<?xml") {
                 $info =& PEAR_PackageFile::fromPackageFile($info, $state);
             } else {
                 $info =& PEAR_PackageFile::fromTgzFile($info, $state);
             }
         }
     } else {
         $info = PEAR::raiseError("Cannot open '{$info}' for parsing");
         return $info;
     }
     return $info;
 }
开发者ID:jamesiarmes,项目名称:php-ups-api,代码行数:52,代码来源:PackageFile.php

示例3: fclose

 /**
  * Returns package information from different sources
  *
  * This method is able to extract information about a package
  * from a .tgz archive or from a XML package definition file.
  *
  * @access public
  * @return string
  * @static
  */
 function &fromAnyFile($info, $state)
 {
     $fp = false;
     if (is_string($info) && strlen($info) < 255 && (file_exists($info) || ($fp = @fopen($info, 'r')))) {
         if ($fp) {
             fclose($fp);
         }
         $tmp = substr($info, -4);
         if ($tmp == '.xml') {
             $info =& PEAR_PackageFile::fromPackageFile($info, $state);
         } elseif ($tmp == '.tar' || $tmp == '.tgz') {
             $info =& PEAR_PackageFile::fromTgzFile($info, $state);
         } else {
             $fp = fopen($info, "r");
             $test = fread($fp, 5);
             fclose($fp);
             if ($test == "<?xml") {
                 $info =& PEAR_PackageFile::fromPackageFile($info, $state);
             } else {
                 $info =& PEAR_PackageFile::fromTgzFile($info, $state);
             }
         }
     } else {
         return PEAR::raiseError("Cannot open '{$info}' for parsing");
     }
     return $info;
 }
开发者ID:alex-k,项目名称:velotur,代码行数:37,代码来源:PackageFile.php

示例4: getPackageFileFromTgz

 /**
  * Return the PEAR Package representation based on a local *.tgz archive.
  *
  * @param string                          $package_tgz_path Path to the *.tgz file.
  * @param Components_Pear_Environment $environment      The PEAR environment.
  *
  * @return PEAR_PackageFile
  */
 public function getPackageFileFromTgz($package_tgz_path, Components_Pear_Environment $environment)
 {
     $pkg = new PEAR_PackageFile($environment->getPearConfig());
     return Components_Exception_Pear::catchError($pkg->fromTgzFile($package_tgz_path, PEAR_VALIDATE_NORMAL));
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:Factory.php

示例5: getPackageNameFromTgz

 /**
  *  get package info from tar/tgz file.
  *
  *  @param  string  $filename   package file name.
  *  @return string  package name
  *  @access public
  *  @static
  */
 public function getPackageNameFromTgz($filename)
 {
     $config = PEAR_Config::singleton();
     $packagefile = new PEAR_PackageFile($config);
     $info = $packagefile->fromTgzFile($filename, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($info)) {
         return $info;
     }
     $info_array = $info->toArray();
     return $info_array['name'];
 }
开发者ID:riaf,项目名称:pastit,代码行数:19,代码来源:PearWrapper.php

示例6: infoFromTgzFile

 /**
  * Returns information about a package file.  Expects the name of
  * a gzipped tar file as input.
  *
  * @param string  $file  name of .tgz file
  *
  * @return array  array with package information
  *
  * @access public
  * @deprecated use PEAR_PackageFile->fromTgzFile() instead
  *
  */
 function infoFromTgzFile($file)
 {
     $packagefile = new PEAR_PackageFile($this->config);
     $pf =& $packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
     return $this->_postProcessChecks($pf);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:18,代码来源:Common.php

示例7: realpath

 /**
  * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
  *
  * This method is able to extract information about a package from a .tgz
  * archive or from a XML package definition file.
  *
  * @access public
  * @param   string  $info file name
  * @param   int     $state package state (one of PEAR_VALIDATE_* constants)
  * @return  PEAR_PackageFile_v1|PEAR_PackageFile_v2
  * @uses    fromPackageFile() if the file appears to be XML
  * @uses    fromTgzFile() to load all non-XML files
  */
 function &fromAnyFile($info, $state)
 {
     if (is_dir($info)) {
         $dir_name = realpath($info);
         if (file_exists($dir_name . '/package.xml')) {
             $fname = $dir_name . '/package.xml';
             $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package.xml', $state);
         } elseif (file_exists($dir_name . '/package2.xml')) {
             $fname = $dir_name . '/package2.xml';
             $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package2.xml', $state);
         } else {
             return PEAR::raiseError("No package definition found in '{$info}' directory");
         }
         if (file_exists($dir_name . '/package.sig')) {
             require_once 'PEAR/Gnupg.php';
             $gnupg = new PEAR_Gnupg($this->_config);
             $result = $gnupg->validateSig($fname, $dir_name . '/package.sig');
             if (PEAR::isError($result)) {
                 return $result;
             }
         }
         return $info;
     }
     $fp = false;
     if (is_string($info) && strlen($info) < 255 && (file_exists($info) || ($fp = @fopen($info, 'r')))) {
         if ($fp) {
             fclose($fp);
         }
         $tmp = substr($info, -4);
         if ($tmp == '.xml') {
             $info =& PEAR_PackageFile::fromPackageFile($info, $state);
         } elseif ($tmp == '.tar' || $tmp == '.tgz') {
             $info =& PEAR_PackageFile::fromTgzFile($info, $state);
         } else {
             $fp = fopen($info, 'r');
             $test = fread($fp, 5);
             fclose($fp);
             if ($test == '<?xml') {
                 $info =& PEAR_PackageFile::fromPackageFile($info, $state);
             } else {
                 $info =& PEAR_PackageFile::fromTgzFile($info, $state);
             }
         }
         return $info;
     }
     $info = PEAR::raiseError("Cannot open '{$info}' for parsing");
     return $info;
 }
开发者ID:cheeepsan,项目名称:pear-core,代码行数:61,代码来源:PackageFile.php

示例8: elseif

         $errors[] = $tmpfile->getMessage();
         break;
     }
     $tmpsize = $file->getProp('size');
 } elseif ($file->isMissing()) {
     $errors[] = 'No file has been uploaded.';
     break;
 } elseif ($file->isError()) {
     $errors[] = $file->errorMsg();
     break;
 }
 include_once 'PEAR/PackageFile.php';
 include_once 'PEAR/Config.php';
 $config = PEAR_Config::singleton();
 $pkg = new PEAR_PackageFile($config);
 $info = $pkg->fromTgzFile(PEAR_UPLOAD_TMPDIR . '/' . $tmpfile, PEAR_VALIDATE_NORMAL);
 $errors = $warnings = array();
 if (PEAR::isError($info)) {
     if (is_array($info->getUserInfo())) {
         foreach ($info->getUserInfo() as $err) {
             if ($err['level'] == 'error') {
                 $errors[] = $err['message'];
             } else {
                 $warnings[] = $err['message'];
             }
         }
     }
     $errors[] = $info->getMessage();
     break;
 }
 if (version_compare($info->getPackageXmlVersion(), '2.0', '<')) {
开发者ID:phpsource,项目名称:web-pecl,代码行数:31,代码来源:release-upload.php


注:本文中的PEAR_PackageFile::fromTgzFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。