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


PHP PEAR_PackageFile::fromPackageFile方法代码示例

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


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

示例1: __construct

 /**
  * Constructor.
  *
  * Searches all installed applications and libraries for migration
  * directories and builds lists of migrateable modules and directories.
  *
  * @param string $basedir   Base directory of a Git checkout. If provided
  *                          a framework/ sub directory is searched for
  *                          migration scripts too.
  * @param string $pearconf  Path to a PEAR configuration file.
  */
 public function __construct($basedir = null, $pearconf = null)
 {
     // Loop through all applications.
     foreach ($GLOBALS['registry']->listAllApps() as $app) {
         $dir = $GLOBALS['registry']->get('fileroot', $app) . '/migration';
         if (is_dir($dir)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     // Silence PEAR errors.
     $old_error_reporting = error_reporting();
     error_reporting($old_error_reporting & ~E_DEPRECATED);
     $pear = new PEAR_Config($pearconf);
     // Loop through local framework checkout.
     if ($basedir) {
         $packageFile = new PEAR_PackageFile($pear);
         foreach (glob($basedir . '/framework/*/migration') as $dir) {
             $package = $packageFile->fromPackageFile(dirname($dir) . '/package.xml', PEAR_VALIDATE_NORMAL);
             if ($package instanceof PEAR_Error) {
                 Horde::log(sprintf('%s: %s', $package->getMessage(), print_r($package->getUserInfo(), true)), Horde_Log::ERR);
                 continue;
             }
             $this->apps[] = $package->getName();
             $this->_lower[] = Horde_String::lower($package->getName());
             $this->dirs[] = realpath($dir);
         }
     }
     // Loop through installed PEAR packages.
     $registry = $pear->getRegistry();
     foreach (glob($pear->get('data_dir') . '/*/migration') as $dir) {
         $package = $registry->getPackage(basename(dirname($dir)), 'pear.horde.org');
         if ($package == false) {
             Horde::log("Ignoring package in directory {$dir}", Horde_Log::WARN);
             continue;
         }
         $app = $package->getName();
         if (!in_array($app, $this->apps)) {
             $this->apps[] = $app;
             $this->_lower[] = Horde_String::lower($app);
             $this->dirs[] = realpath($dir);
         }
     }
     error_reporting($old_error_reporting);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:57,代码来源:Migration.php

示例2: infoFromDescriptionFile

 /**
  * Returns information about a package file.  Expects the name of
  * a package xml file as input.
  *
  * @param string  $descfile  name of package xml file
  *
  * @return array  array with package information
  *
  * @access public
  * @deprecated use PEAR_PackageFile->fromPackageFile() instead
  *
  */
 function infoFromDescriptionFile($descfile)
 {
     $packagefile = new PEAR_PackageFile($this->config);
     $pf =& $packagefile->fromPackageFile($descfile, 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:harriswong,项目名称:AContent,代码行数:27,代码来源:Common.php

示例3: package

 function package($pkgfile = null, $compress = true, $pkg2 = null)
 {
     // {{{ validate supplied package.xml file
     if (empty($pkgfile)) {
         $pkgfile = 'package.xml';
     }
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $pkg = new PEAR_PackageFile($this->config, $this->debug);
     $pf =& $pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
     $main =& $pf;
     PEAR::staticPopErrorHandling();
     if (PEAR::isError($pf)) {
         if (is_array($pf->getUserInfo())) {
             foreach ($pf->getUserInfo() as $error) {
                 $this->log(0, 'Error: ' . $error['message']);
             }
         }
         $this->log(0, $pf->getMessage());
         return $this->raiseError("Cannot package, errors in package file");
     }
     foreach ($pf->getValidationWarnings() as $warning) {
         $this->log(1, 'Warning: ' . $warning['message']);
     }
     // }}}
     if ($pkg2) {
         $this->log(0, 'Attempting to process the second package file');
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $pf2 =& $pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL);
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($pf2)) {
             if (is_array($pf2->getUserInfo())) {
                 foreach ($pf2->getUserInfo() as $error) {
                     $this->log(0, 'Error: ' . $error['message']);
                 }
             }
             $this->log(0, $pf2->getMessage());
             return $this->raiseError("Cannot package, errors in second package file");
         }
         foreach ($pf2->getValidationWarnings() as $warning) {
             $this->log(1, 'Warning: ' . $warning['message']);
         }
         if ($pf2->getPackagexmlVersion() == '2.0' || $pf2->getPackagexmlVersion() == '2.1') {
             $main =& $pf2;
             $other =& $pf;
         } else {
             $main =& $pf;
             $other =& $pf2;
         }
         if ($main->getPackagexmlVersion() != '2.0' && $main->getPackagexmlVersion() != '2.1') {
             return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' . 'only package together a package.xml 1.0 and package.xml 2.0');
         }
         if ($other->getPackagexmlVersion() != '1.0') {
             return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' . 'only package together a package.xml 1.0 and package.xml 2.0');
         }
     }
     $main->setLogger($this);
     if (!$main->validate(PEAR_VALIDATE_PACKAGING)) {
         foreach ($main->getValidationWarnings() as $warning) {
             $this->log(0, 'Error: ' . $warning['message']);
         }
         return $this->raiseError("Cannot package, errors in package");
     }
     foreach ($main->getValidationWarnings() as $warning) {
         $this->log(1, 'Warning: ' . $warning['message']);
     }
     if ($pkg2) {
         $other->setLogger($this);
         $a = false;
         if (!$other->validate(PEAR_VALIDATE_NORMAL) || ($a = !$main->isEquivalent($other))) {
             foreach ($other->getValidationWarnings() as $warning) {
                 $this->log(0, 'Error: ' . $warning['message']);
             }
             foreach ($main->getValidationWarnings() as $warning) {
                 $this->log(0, 'Error: ' . $warning['message']);
             }
             if ($a) {
                 return $this->raiseError('The two package.xml files are not equivalent!');
             }
             return $this->raiseError("Cannot package, errors in package");
         }
         foreach ($other->getValidationWarnings() as $warning) {
             $this->log(1, 'Warning: ' . $warning['message']);
         }
         $gen =& $main->getDefaultGenerator();
         $tgzfile = $gen->toTgz2($this, $other, $compress);
         if (PEAR::isError($tgzfile)) {
             return $tgzfile;
         }
         $dest_package = basename($tgzfile);
         $pkgdir = dirname($pkgfile);
         // TAR the Package -------------------------------------------
         $this->log(1, "Package {$dest_package} done");
         if (file_exists("{$pkgdir}/CVS/Root")) {
             $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
             $cvstag = "RELEASE_{$cvsversion}";
             $this->log(1, 'Tag the released code with "pear cvstag ' . $main->getPackageFile() . '"');
             $this->log(1, "(or set the CVS tag {$cvstag} by hand)");
         } elseif (file_exists("{$pkgdir}/.svn")) {
             $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
             $svntag = $pf->getName() . "-{$svnversion}";
//.........这里部分代码省略.........
开发者ID:orcoliver,项目名称:oneye,代码行数:101,代码来源:Packager.php

示例4: 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

示例5: array

 /**
  * Convert a package xml 1.0 to 2.0 with user and default options
  *
  * @param string $packagefile name of package file
  * @param array  $options     (optional) list of generation options
  *
  * @return PEAR_PackageFileManager2|PEAR_Error
  * @static
  * @access public
  * @since  1.6.0a1
  */
 function &importFromPackageFile1($packagefile, $options = array())
 {
     $z =& PEAR_Config::singleton();
     $pkg = new PEAR_PackageFile($z);
     $pf = $pkg->fromPackageFile($packagefile, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         return $pf;
     }
     if ($pf->getPackagexmlVersion() == '1.0') {
         $packagefile =& $pf;
     }
     $a =& PEAR_PackageFileManager2::importOptions($packagefile, $options);
     return $a;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:25,代码来源:PackageFileManager2.php

示例6: getPackageFile

 /**
  * Return the PEAR Package representation.
  *
  * @param string                          $package_xml_path Path to the package.xml file.
  * @param Components_Pear_Environment $environment      The PEAR environment.
  *
  * @return PEAR_PackageFile
  */
 public function getPackageFile($package_xml_path, Components_Pear_Environment $environment)
 {
     $config = $environment->getPearConfig();
     $pkg = new PEAR_PackageFile($config);
     return Components_Exception_Pear::catchError($pkg->fromPackageFile($package_xml_path, PEAR_VALIDATE_NORMAL));
 }
开发者ID:horde,项目名称:horde,代码行数:14,代码来源:Factory.php

示例7: infoFromDescriptionFile

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

示例8: die

    die('Following packages were not available in tar format in go-pear-tarballs: ' . implode(', ', $required) . "\n");
}
if (!file_exists("{$tardir}/tmp")) {
    mkdir("{$tardir}/tmp");
}
// Use the tar files for required Phar files
require_once 'Archive/Tar.php';
require_once 'System.php';
foreach ($packages as $package) {
    $name = substr($package, 0, -4);
    $tar = new Archive_Tar("{$tardir}/{$package}");
    $tar->extractModify("{$tardir}/tmp", $name);
}
chdir(__DIR__);
$pkg = new PEAR_PackageFile($config);
$pf = $pkg->fromPackageFile(__DIR__ . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pf)) {
    foreach ($pf->getUserInfo() as $warn) {
        echo $warn['message'] . "\n";
    }
    die($pf->getMessage());
}
$pearver = $pf->getVersion();
$creator = new PHP_Archive_Creator('index.php', $outputFile);
// no compression
$creator->useDefaultFrontController('PEAR.php');
$creator->useSHA1Signature();
$install_files = '$install_files = array(';
foreach ($packages as $name => $package) {
    echo "{$name} => {$package}\n";
    $install_files .= "'{$name}' => 'phar://" . $outputFile . "/{$package}'," . "\n";
开发者ID:remicollet,项目名称:pear-core,代码行数:31,代码来源:make-installpear-nozlib-phar.php

示例9: array

$a = $registry->listAllApps();
/* Check for suspicious missing of migration data. */
if (!in_array('Horde_Core', $migration->apps)) {
    $notification->push(_("Database migration files not found. Please check PEAR's data_dir configuration setting."), 'horde.error');
}
/* Check for versions if requested. */
$versions = array();
if ($vars->check_versions) {
    $pearConfig = PEAR_Config::singleton();
    $packageFile = new PEAR_PackageFile($pearConfig);
    $packages = array();
    foreach ($pearConfig->getRegistry()->packageInfo(null, null, 'pear.horde.org') as $package) {
        $packages[$package['name']] = $package['version']['release'];
    }
    foreach (glob(__DIR__ . '/../../../framework/*/package.xml') as $packagexml) {
        $package = $packageFile->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
        if (!$package instanceof PEAR_Error) {
            $packages[$package->getName()] = $package->getVersion();
        }
    }
    try {
        $versions = $hconfig->checkVersions();
    } catch (Horde_Exception $e) {
        $notification->push(_("Could not contact server. Try again later."), 'horde.error');
    }
}
/* Update configurations if requested. */
if ($vars->action == 'config') {
    foreach ($a as $app) {
        $path = $registry->get('fileroot', $app) . '/config';
        if (!file_exists($path . '/conf.xml') || file_exists($path . '/conf.php') && ($xml_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.xml'))) !== false && ($php_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.php'))) !== false && $xml_ver == $php_ver) {
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:index.php

示例10: loadPackageInfo

 /**
  * Loads and returns the PEAR package information.
  *
  * @return PEAR_PackageFile_v2 Package information object
  *
  * @throws BuildException When the package does not exist
  */
 protected function loadPackageInfo()
 {
     $config = PEAR_Config::singleton($this->config);
     if (empty($this->packageFile)) {
         // loads informations from PEAR package installed
         $reg = $config->getRegistry();
         if (!$reg->packageExists($this->package, $this->channel)) {
             throw new BuildException(sprintf('PEAR package %s/%s does not exist', $this->channel, $this->package));
         }
         $packageInfo = $reg->getPackage($this->package, $this->channel);
     } else {
         // loads informations from PEAR package XML description file
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $pkg = new PEAR_PackageFile($config);
         $packageInfo = $pkg->fromPackageFile($this->packageFile, PEAR_VALIDATE_NORMAL);
         PEAR::staticPopErrorHandling();
         if (PEAR::isError($packageInfo)) {
             throw new BuildException("Errors in package file");
         }
     }
     return $packageInfo;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:29,代码来源:PearPackageScanner.php

示例11: fprintf

#!/usr/bin/env php
<?php 
error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
if ($argc < 2) {
    fprintf(STDERR, "Usage: %s <path/to/package.xml>\n", $argv[0]);
    exit(1);
}
require_once "PEAR/Config.php";
require_once "PEAR/PackageFile.php";
define("PACKAGE_XML", $argv[1]);
define("PACKAGE_DIR", dirname(PACKAGE_XML));
$factory = new PEAR_PackageFile(PEAR_Config::singleton());
$pf = $factory->fromPackageFile($argv[1], PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pf)) {
    fprintf(STDERR, "ERROR: %s\n", $pf->getMessage());
    exit(1);
}
foreach ($pf->getValidationWarnings() as $warning) {
    fprintf(STDERR, "%s: %s\n", strtoupper($warning["level"]), $warning["message"]);
}
$exit = 0;
foreach ($pf->getFilelist() as $file => $attr) {
    if (!file_exists(PACKAGE_DIR . "/" . $file)) {
        $exit++;
        fprintf(STDERR, "File '%s' with role '%s' not found in '%s'\n", $file, $attr["role"], PACKAGE_DIR);
    }
}
if ($exit) {
    fprintf(STDERR, "%3d failure(s)\n", $exit);
    exit(1);
}
开发者ID:0mars,项目名称:pecl-search_engine-solr,代码行数:31,代码来源:check-packagexml.php

示例12: build

 /**
  * Build an extension from source.  Runs "phpize" in the source
  * directory, but compiles in a temporary directory
  * (TMPDIR/pear-build-USER/PACKAGE-VERSION).
  *
  * @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or
  *               a PEAR_PackageFile object
  *
  * @param mixed $callback callback function used to report output,
  * see PEAR_Builder::_runCommand for details
  *
  * @return array an array of associative arrays with built files,
  * format:
  * array( array( 'file' => '/path/to/ext.so',
  *               'php_api' => YYYYMMDD,
  *               'zend_mod_api' => YYYYMMDD,
  *               'zend_ext_api' => YYYYMMDD ),
  *        ... )
  *
  * @access public
  *
  * @see PEAR_Builder::_runCommand
  */
 function build($descfile, $callback = null)
 {
     if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php([^\\/\\\\]+)?$/', $this->config->get('php_bin'), $matches)) {
         if (isset($matches[2]) && strlen($matches[2]) && trim($matches[2]) != trim($this->config->get('php_prefix'))) {
             $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . ' appears to have a prefix ' . $matches[2] . ', but' . ' config variable php_prefix does not match');
         }
         if (isset($matches[3]) && strlen($matches[3]) && trim($matches[3]) != trim($this->config->get('php_suffix'))) {
             $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . ' appears to have a suffix ' . $matches[3] . ', but' . ' config variable php_suffix does not match');
         }
     }
     $this->current_callback = $callback;
     if (PEAR_OS == "Windows") {
         return $this->_build_win32($descfile, $callback);
     }
     if (PEAR_OS != 'Unix') {
         return $this->raiseError("building extensions not supported on this platform");
     }
     if (is_object($descfile)) {
         $pkg = $descfile;
         $descfile = $pkg->getPackageFile();
         if (is_a($pkg, 'PEAR_PackageFile_v1')) {
             $dir = dirname($descfile);
         } else {
             $dir = $pkg->_config->get('temp_dir') . '/' . $pkg->getName();
             // automatically delete at session end
             $this->addTempFile($dir);
         }
     } else {
         $pf = new PEAR_PackageFile($this->config);
         $pkg =& $pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
         if (PEAR::isError($pkg)) {
             return $pkg;
         }
         $dir = dirname($descfile);
     }
     // Find config. outside of normal path - e.g. config.m4
     foreach (array_keys($pkg->getInstallationFileList()) as $item) {
         if (stristr(basename($item), 'config.m4') && dirname($item) != '.') {
             $dir .= DIRECTORY_SEPARATOR . dirname($item);
             break;
         }
     }
     $old_cwd = getcwd();
     if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
         return $this->raiseError("could not chdir to {$dir}");
     }
     $vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
     if (is_dir($vdir)) {
         chdir($vdir);
     }
     $dir = getcwd();
     $this->log(2, "building in {$dir}");
     putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH'));
     $err = $this->_runCommand($this->config->get('php_prefix') . "phpize" . $this->config->get('php_suffix'), array(&$this, 'phpizeCallback'));
     if (PEAR::isError($err)) {
         return $err;
     }
     if (!$err) {
         return $this->raiseError("`phpize' failed");
     }
     // {{{ start of interactive part
     $configure_command = "{$dir}/configure";
     $phpConfigName = $this->config->get('php_prefix') . 'php-config' . $this->config->get('php_suffix');
     $phpConfigPath = System::which($phpConfigName);
     if ($phpConfigPath !== false) {
         $configure_command .= ' --with-php-config=' . $phpConfigPath;
     }
     $configure_options = $pkg->getConfigureOptions();
     if ($configure_options) {
         foreach ($configure_options as $o) {
             $default = array_key_exists('default', $o) ? $o['default'] : null;
             list($r) = $this->ui->userDialog('build', array($o['prompt']), array('text'), array($default));
             if (substr($o['name'], 0, 5) == 'with-' && ($r == 'yes' || $r == 'autodetect')) {
                 $configure_command .= " --{$o['name']}";
             } else {
                 $configure_command .= " --{$o['name']}=" . trim($r);
             }
//.........这里部分代码省略.........
开发者ID:crazy-max,项目名称:neard-bin-php,代码行数:101,代码来源:Builder.php

示例13: array

$a->addPackageDepWithChannel('required', 'Services_Trackback', 'pear.php.net', '0.4.0');
$a->addPackageDepWithChannel('required', 'HTML_QuickForm', 'pear.php.net', '3.2.3');
$a->addPackageDepWithChannel('required', 'HTML_QuickForm2', 'pear.php.net', '0.5.0');
// This is used in the admin menu for category
$a->addPackageDepWithChannel('required', 'HTML_TreeMenu', 'pear.php.net', '1.2.0');
$a->addPackageDepWithChannel('required', 'MDB2_Driver_mysqli', 'pear.php.net');
$a->addExtensionDep('required', 'pcre');
$a->addExtensionDep('required', 'mysqli');
$a->addExtensionDep('required', 'fileinfo');
$a->addPackageDepWithChannel('required', 'Graph', 'components.ez.no');
include_once 'PEAR/Config.php';
include_once 'PEAR/PackageFile.php';
$config = PEAR_Config::singleton();
$p = new PEAR_PackageFile($config);
// Specify subpackages
$e = $p->fromPackageFile($dir . '/package-channel.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($e, false);
$b = $p->fromPackageFile($dir . '/package-election.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($b, false);
$f = $p->fromPackageFile($dir . '/package-gopear.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($f, false);
$d = $p->fromPackageFile($dir . '/package-index.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($d, false);
$h = $p->fromPackageFile($dir . '/package-manual.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($h, false);
$c = $p->fromPackageFile($dir . '/package-pepr.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($c, false);
$g = $p->fromPackageFile($dir . '/package-qa.xml', PEAR_VALIDATE_NORMAL);
$a->specifySubpackage($g, false);
$script =& $a->initPostinstallScript('pearweb.php');
$script->addParamGroup('askdb', array($script->getParam('yesno', 'Update pearweb database?', 'yesno', 'y')));
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:package.php

示例14: 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

示例15: build

 /**
  * Build an extension from source.  Runs "phpize" in the source
  * directory, but compiles in a temporary directory
  * (/var/tmp/pear-build-USER/PACKAGE-VERSION).
  *
  * @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or
  *               a PEAR_PackageFile object
  *
  * @param mixed $callback callback function used to report output,
  * see PEAR_Builder::_runCommand for details
  *
  * @return array an array of associative arrays with built files,
  * format:
  * array( array( 'file' => '/path/to/ext.so',
  *               'php_api' => YYYYMMDD,
  *               'zend_mod_api' => YYYYMMDD,
  *               'zend_ext_api' => YYYYMMDD ),
  *        ... )
  *
  * @access public
  *
  * @see PEAR_Builder::_runCommand
  */
 function build($descfile, $callback = null)
 {
     $this->current_callback = $callback;
     if (PEAR_OS == "Windows") {
         return $this->_build_win32($descfile, $callback);
     }
     if (PEAR_OS != 'Unix') {
         return $this->raiseError("building extensions not supported on this platform");
     }
     if (is_object($descfile)) {
         $pkg = $descfile;
         $descfile = $pkg->getPackageFile();
     } else {
         $pf = new PEAR_PackageFile($this->config);
         $pkg =& $pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
         if (PEAR::isError($pkg)) {
             return $pkg;
         }
     }
     $dir = dirname($descfile);
     $old_cwd = getcwd();
     if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
         return $this->raiseError("could not chdir to {$dir}");
     }
     $vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
     if (is_dir($vdir)) {
         chdir($vdir);
     }
     $dir = getcwd();
     $this->log(2, "building in {$dir}");
     putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH'));
     $err = $this->_runCommand("phpize", array(&$this, 'phpizeCallback'));
     if (PEAR::isError($err)) {
         return $err;
     }
     if (!$err) {
         return $this->raiseError("`phpize' failed");
     }
     // {{{ start of interactive part
     $configure_command = "{$dir}/configure";
     $configure_options = $pkg->getConfigureOptions();
     if ($configure_options) {
         foreach ($configure_options as $o) {
             $default = array_key_exists('default', $o) ? $o['default'] : null;
             list($r) = $this->ui->userDialog('build', array($o['prompt']), array('text'), array($default));
             if (substr($o['name'], 0, 5) == 'with-' && ($r == 'yes' || $r == 'autodetect')) {
                 $configure_command .= " --{$o['name']}";
             } else {
                 $configure_command .= " --{$o['name']}=" . trim($r);
             }
         }
     }
     // }}} end of interactive part
     // FIXME make configurable
     if (!($user = getenv('USER'))) {
         $user = 'defaultuser';
     }
     $build_basedir = "/var/tmp/pear-build-{$user}";
     $build_dir = "{$build_basedir}/{$vdir}";
     $inst_dir = "{$build_basedir}/install-{$vdir}";
     $this->log(1, "building in {$build_dir}");
     if (is_dir($build_dir)) {
         System::rm(array('-rf', $build_dir));
     }
     if (!System::mkDir(array('-p', $build_dir))) {
         return $this->raiseError("could not create build dir: {$build_dir}");
     }
     $this->addTempFile($build_dir);
     if (!System::mkDir(array('-p', $inst_dir))) {
         return $this->raiseError("could not create temporary install dir: {$inst_dir}");
     }
     $this->addTempFile($inst_dir);
     if (getenv('MAKE')) {
         $make_command = getenv('MAKE');
     } else {
         $make_command = 'make';
     }
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Builder.php


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