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


PHP PEAR_Registry::listPackages方法代码示例

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


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

示例1: substr

 function PEAR_Downloader(&$ui, $options, &$config)
 {
     $this->_options = $options;
     $this->_config =& $config;
     $this->_preferredState = $this->_config->get('preferred_state');
     $this->ui =& $ui;
     if (!$this->_preferredState) {
         // don't inadvertantly use a non-set preferred_state
         $this->_preferredState = null;
     }
     $php_dir = $this->_config->get('php_dir');
     if (isset($this->_options['installroot'])) {
         if (substr($this->_options['installroot'], -1) == DIRECTORY_SEPARATOR) {
             $this->_options['installroot'] = substr($this->_options['installroot'], 0, -1);
         }
         $php_dir = $this->_prependPath($php_dir, $this->_options['installroot']);
     }
     $this->_registry =& new PEAR_Registry($php_dir);
     $this->_remote =& new PEAR_Remote($config);
     if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) {
         $this->_installed = $this->_registry->listPackages();
         array_walk($this->_installed, create_function('&$v,$k', '$v = strtolower($v);'));
         $this->_installed = array_flip($this->_installed);
     }
     parent::PEAR_Common();
 }
开发者ID:hendricson,项目名称:couponator,代码行数:26,代码来源:Downloader.php

示例2: packages

 /**
  * Return PEAR packages, versions, etc.
  *
  * @see PEAR_Registry, PEAR_Registry::listPackages()
  * @return array
  */
 public function packages()
 {
     $reg = new PEAR_Registry();
     $packages = $reg->listPackages();
     $p = array();
     foreach ($packages as $package) {
         $pkg = $reg->getPackage($package);
         $p[] = array('package' => $pkg->getName(), 'released' => $pkg->getDate(), 'version' => $pkg->getVersion(), 'state' => $pkg->getState());
     }
     return array('packages' => $p);
 }
开发者ID:jacques,项目名称:butler,代码行数:17,代码来源:pear.php

示例3: pear_prerequisutes

function pear_prerequisutes()
{
    $exists = include_exists('PEAR' . DIRECTORY_SEPARATOR . 'Registry.php');
    if ($exists['result']) {
        require_once 'PEAR/Registry.php';
        $reg = new PEAR_Registry();
        $packages = $reg->listPackages();
        if (in_array('http_request2', $packages)) {
            $results = array('pear' => "Pass", 'http_request2' => "Pass", 'path' => $exists['path']);
        } else {
            $results = array('pear' => "Pass", 'http_request2' => "Fail", 'path' => $exists['path']);
        }
    } else {
        $results = array('pear' => "Fail", 'http_request2' => "Fail", 'path' => $exists['path']);
    }
    return $results;
}
开发者ID:muhamadanjar,项目名称:SIMTARU,代码行数:17,代码来源:proxy-verification.php

示例4: doListUpgrades

 function doListUpgrades($command, $options, $params)
 {
     include_once "PEAR/Registry.php";
     $remote = new PEAR_Remote($this->config);
     if (empty($params[0])) {
         $state = $this->config->get('preferred_state');
     } else {
         $state = $params[0];
     }
     $caption = 'Available Upgrades';
     if (empty($state) || $state == 'any') {
         $latest = $remote->call("package.listLatestReleases");
     } else {
         $latest = $remote->call("package.listLatestReleases", $state);
         $caption .= ' (' . $state . ')';
     }
     $caption .= ':';
     if (PEAR::isError($latest)) {
         return $latest;
     }
     $reg = new PEAR_Registry($this->config->get('php_dir'));
     $inst = array_flip($reg->listPackages());
     $data = array('caption' => $caption, 'border' => 1, 'headline' => array('Package', 'Version', 'Size'));
     foreach ($latest as $package => $info) {
         if (!isset($inst[$package])) {
             // skip packages we don't have installed
             continue;
         }
         extract($info);
         $inst_version = $reg->packageInfo($package, 'version');
         if (version_compare("{$version}", "{$inst_version}", "le")) {
             // installed version is up-to-date
             continue;
         }
         if ($filesize >= 20480) {
             $filesize += 1024 - $filesize % 1024;
             $fs = sprintf("%dkB", $filesize / 1024);
         } elseif ($filesize > 0) {
             $filesize += 103 - $filesize % 103;
             $fs = sprintf("%.1fkB", $filesize / 1024.0);
         } else {
             $fs = "  -";
             // XXX center instead
         }
         $data['data'][] = array($package, $version, $fs);
     }
     if (empty($data['data'])) {
         $this->ui->outputData('No upgrades available');
     } else {
         $this->ui->outputData($data, $command);
     }
     return true;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:53,代码来源:Remote.php

示例5: doInstall

 function doInstall($command, $options, $params)
 {
     if (empty($this->installer)) {
         $this->installer =& new PEAR_Installer($this->ui);
     }
     if ($command == 'upgrade') {
         $options[$command] = true;
     }
     if ($command == 'upgrade-all') {
         include_once "PEAR/Remote.php";
         $options['upgrade'] = true;
         $remote = new PEAR_Remote($this->config);
         $state = $this->config->get('preferred_state');
         if (empty($state) || $state == 'any') {
             $latest = $remote->call("package.listLatestReleases");
         } else {
             $latest = $remote->call("package.listLatestReleases", $state);
         }
         if (PEAR::isError($latest)) {
             return $latest;
         }
         $reg = new PEAR_Registry($this->config->get('php_dir'));
         $installed = array_flip($reg->listPackages());
         $params = array();
         foreach ($latest as $package => $info) {
             if (!isset($installed[$package])) {
                 // skip packages we don't have installed
                 continue;
             }
             $inst_version = $reg->packageInfo($package, 'version');
             if (version_compare("{$info['version']}", "{$inst_version}", "le")) {
                 // installed version is up-to-date
                 continue;
             }
             $params[] = $package;
             $this->ui->outputData("will upgrade {$package}", $command);
         }
     }
     foreach ($params as $pkg) {
         $bn = basename($pkg);
         $info = $this->installer->install($pkg, $options, $this->config);
         if (is_array($info)) {
             if ($this->config->get('verbose') > 0) {
                 $label = "{$info['package']} {$info['version']}";
                 $out = array('data' => "{$command} ok: {$label}");
                 if (isset($info['release_warnings'])) {
                     $out['release_warnings'] = $info['release_warnings'];
                 }
                 $this->ui->outputData($out, $command);
             }
         } else {
             return $this->raiseError("{$command} failed");
         }
     }
     return true;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:56,代码来源:Install.php

示例6: doInstall

 function doInstall($command, $options, $params)
 {
     if (empty($this->installer)) {
         $this->installer =& new PEAR_Installer($this->ui);
     }
     if ($command == 'upgrade') {
         $options['upgrade'] = true;
     }
     if ($command == 'upgrade-all') {
         include_once "PEAR/Remote.php";
         $options['upgrade'] = true;
         $remote = new PEAR_Remote($this->config);
         $state = $this->config->get('preferred_state');
         if (empty($state) || $state == 'any') {
             $latest = $remote->call("package.listLatestReleases");
         } else {
             $latest = $remote->call("package.listLatestReleases", $state);
         }
         if (PEAR::isError($latest)) {
             return $latest;
         }
         $reg = new PEAR_Registry($this->config->get('php_dir'));
         $installed = array_flip($reg->listPackages());
         $params = array();
         foreach ($latest as $package => $info) {
             $package = strtolower($package);
             if (!isset($installed[$package])) {
                 // skip packages we don't have installed
                 continue;
             }
             $inst_version = $reg->packageInfo($package, 'version');
             if (version_compare("{$info['version']}", "{$inst_version}", "le")) {
                 // installed version is up-to-date
                 continue;
             }
             $params[] = $package;
             $this->ui->outputData(array('data' => "Will upgrade {$package}"), $command);
         }
     }
     $errors = array();
     $downloaded = array();
     $this->installer->download($params, $options, $this->config, $downloaded, $errors);
     if ($command != 'upgrade-all') {
         for ($i = 0; $i < count($params); $i++) {
             $params[$i] = $this->installer->extractDownloadFileName($params[$i], $_tmp);
         }
     }
     if (count($errors)) {
         $err['data'] = array($errors);
         $err['headline'] = 'Install Errors';
         $this->ui->outputData($err);
         return $this->raiseError("{$command} failed");
     }
     $this->installer->sortPkgDeps($downloaded);
     foreach ($downloaded as $pkg) {
         $bn = basename($pkg['file']);
         $info = $this->installer->install($pkg['file'], $options, $this->config);
         if (is_array($info)) {
             if ($this->config->get('verbose') > 0) {
                 $label = "{$info['package']} {$info['version']}";
                 $out = array('data' => "{$command} ok: {$label}");
                 if (isset($info['release_warnings'])) {
                     $out['release_warnings'] = $info['release_warnings'];
                 }
                 $this->ui->outputData($out, $command);
             }
         } else {
             return $this->raiseError("{$command} failed");
         }
     }
     return true;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:72,代码来源:Install.php

示例7:

}
print_row("Database Support", $result, $status);
// PEAR
$have_pear = false;
if (!($pear_dir = find_path($path_list, "PEAR"))) {
    $result = "Not installed.  The PEAR extension is required by several other " . "PHP extensions that Maia needs.  See <a href=\"http://pear.php.net/\">this page</a> " . "for more information about downloading and installing PEAR.";
    $status = ERROR;
} else {
    // include_once ("PEAR/Remote.php");      // PEAR::Remote
    include_once "PEAR/Registry.php";
    // PEAR::Registry
    $have_pear = true;
    $pear = new PEAR_Config();
    $pear_reg = new PEAR_Registry($pear->get('php_dir'));
    $pear_info = $pear_reg->packageInfo("PEAR");
    $pear_list = $pear_reg->listPackages();
    $pear_version = is_array($pear_info["version"]) ? $pear_info["version"]["release"] : $pear_info["version"];
    $result = $pear_version;
    $status = OK;
}
print_row("PEAR", $result, $status);
// PEAR::Mail_Mime
if ($have_pear) {
    if (!in_array("mail_mime", $pear_list)) {
        $result = "Not installed.  This PHP extension is required to decode " . "MIME-structured e-mail.  Use <b>pear install Mail_Mime</b> to " . "install this.";
        $status = ERROR;
    } else {
        $info = $pear_reg->packageInfo("Mail_Mime");
        $result = is_array($info["version"]) ? $info["version"]["release"] : $info["version"];
        if (version_compare($result, "1.3.0") < 0) {
            $version = $result;
开发者ID:einheit,项目名称:mailguard_legacy,代码行数:31,代码来源:configtest.php

示例8:

<?php
require_once 'PEAR/Config.php';  
require_once 'PEAR/Registry.php';  
  
$config = new PEAR_Config();  
$reg = new PEAR_Registry($config->get('php_dir'));  
$packages = $reg->listPackages();  
  
foreach($packages as $value)  
{  
    echo $value."<br>";  
}  
?>
开发者ID:kitaindia,项目名称:DGMG_online,代码行数:13,代码来源:check.php

示例9: array

<?php

/**
 * @version  $Revision$
 * @package  liberty
 * @subpackage plugins_format
 */
/**
 * definitions
 */
global $gLibertySystem;
if (@(include_once 'PEAR/Registry.php')) {
    if (@(include_once 'Text/Wiki.php')) {
        $genPluginParams = array('store_function' => 'pearwiki_general_save_data', 'verify_function' => 'pearwiki_general_verify_data', 'plugin_type' => FORMAT_PLUGIN, 'linebreak' => "\r\n");
        $reg = new PEAR_Registry();
        foreach ($reg->listPackages() as $package) {
            if (preg_match('!^text_wiki!', $package)) {
                // get package information
                $inf = $reg->packageInfo($package);
                // package information is all over the place. this should clean it up a bit
                if (!empty($inf['name'])) {
                    $package = $inf['name'];
                } elseif (!empty($inf['name'])) {
                    $package = $inf['package'];
                } else {
                    continue;
                }
                // fetch parser name
                $p = substr($package, strlen("text_wiki"));
                if (empty($p)) {
                    $parser = "Text_Wiki";
开发者ID:kailIII,项目名称:liberty,代码行数:31,代码来源:format.pearwiki_general.php


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