Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
}
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;
Ejemplo n.º 8
0
<?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>";  
}  
?>
Ejemplo n.º 9
0
<?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";