⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 remote.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php// /* vim: set expandtab tabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP Version 5                                                        |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2004 The PHP Group                                |// +----------------------------------------------------------------------+// | This source file is subject to version 3.0 of the PHP license,       |// | that is bundled with this package in the file LICENSE, and is        |// | available through the world-wide-web at the following url:           |// | http://www.php.net/license/3_0.txt.                                  |// | If you did not receive a copy of the PHP license and are unable to   |// | obtain it through the world-wide-web, please send a note to          |// | license@php.net so we can mail you a copy immediately.               |// +----------------------------------------------------------------------+// | Author: Stig Bakken <ssb@php.net>                                    |// |                                                                      |// +----------------------------------------------------------------------+//// $Id: Remote.php,v 1.39 2004/04/03 15:56:00 cellog Exp $require_once 'PEAR/Command/Common.php';require_once 'PEAR/Common.php';require_once 'PEAR/Remote.php';require_once 'PEAR/Registry.php';class PEAR_Command_Remote extends PEAR_Command_Common{    // {{{ command definitions    var $commands = array(        'remote-info' => array(            'summary' => 'Information About Remote Packages',            'function' => 'doRemoteInfo',            'shortcut' => 'ri',            'options' => array(),            'doc' => '<package>Get details on a package from the server.',            ),        'list-upgrades' => array(            'summary' => 'List Available Upgrades',            'function' => 'doListUpgrades',            'shortcut' => 'lu',            'options' => array(),            'doc' => 'List releases on the server of packages you have installed wherea newer version is available with the same release state (stable etc.).'            ),        'remote-list' => array(            'summary' => 'List Remote Packages',            'function' => 'doRemoteList',            'shortcut' => 'rl',            'options' => array(),            'doc' => 'Lists the packages available on the configured server along with thelatest stable release of each package.',            ),        'search' => array(            'summary' => 'Search remote package database',            'function' => 'doSearch',            'shortcut' => 'sp',            'options' => array(),            'doc' => 'Lists all packages which match the search parameters (first paramis package name, second package info)',            ),        'list-all' => array(            'summary' => 'List All Packages',            'function' => 'doListAll',            'shortcut' => 'la',            'options' => array(),            'doc' => 'Lists the packages available on the configured server along with thelatest stable release of each package.',            ),        'download' => array(            'summary' => 'Download Package',            'function' => 'doDownload',            'shortcut' => 'd',            'options' => array(                'nocompress' => array(                    'shortopt' => 'Z',                    'doc' => 'download an uncompressed (.tar) file',                    ),                ),            'doc' => '{package|package-version}Download a package tarball.  The file will be named as suggested by theserver, for example if you download the DB package and the latest stableversion of DB is 1.2, the downloaded file will be DB-1.2.tgz.',            ),        'clear-cache' => array(            'summary' => 'Clear XML-RPC Cache',            'function' => 'doClearCache',            'shortcut' => 'cc',            'options' => array(),            'doc' => 'Clear the XML-RPC cache.  See also the cache_ttl configurationparameter.',            ),        );    // }}}    // {{{ constructor    /**     * PEAR_Command_Remote constructor.     *     * @access public     */    function PEAR_Command_Remote(&$ui, &$config)    {        parent::PEAR_Command_Common($ui, $config);    }    // }}}    // {{{ doRemoteInfo()    function doRemoteInfo($command, $options, $params)    {        if (sizeof($params) != 1) {            return $this->raiseError("$command expects one param: the remote package name");        }        $r = new PEAR_Remote($this->config);        $info = $r->call('package.info', $params[0]);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $reg = new PEAR_Registry($this->config->get('php_dir'));        $installed = $reg->packageInfo($info['name']);        $info['installed'] = $installed['version'] ? $installed['version'] : '- no -';        $this->ui->outputData($info, $command);        return true;    }    // }}}    // {{{ doRemoteList()    function doRemoteList($command, $options, $params)    {        $r = new PEAR_Remote($this->config);        $list_options = false;        if ($this->config->get('preferred_state') == 'stable')            $list_options = true;        $available = $r->call('package.listAll', $list_options);        if (PEAR::isError($available)) {            return $this->raiseError($available);        }        $i = $j = 0;        $data = array(            'caption' => 'Available packages:',            'border' => true,            'headline' => array('Package', 'Version'),            );        foreach ($available as $name => $info) {            $data['data'][] = array($name, isset($info['stable']) ? $info['stable'] : '-n/a-');        }        if (count($available)==0) {            $data = '(no packages installed yet)';        }        $this->ui->outputData($data, $command);        return true;    }    // }}}    // {{{ doListAll()    function doListAll($command, $options, $params)    {        $r = new PEAR_Remote($this->config);        $reg = new PEAR_Registry($this->config->get('php_dir'));        $list_options = false;        if ($this->config->get('preferred_state') == 'stable')            $list_options = true;        $available = $r->call('package.listAll', $list_options);        if (PEAR::isError($available)) {            return $this->raiseError($available);        }        if (!is_array($available)) {            return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "'.$available.'")');        }        $data = array(            'caption' => 'All packages:',            'border' => true,            'headline' => array('Package', 'Latest', 'Local'),            );        $local_pkgs = $reg->listPackages();                foreach ($available as $name => $info) {            $installed = $reg->packageInfo($name);            $desc = $info['summary'];            if (isset($params[$name]))                $desc .= "\n\n".$info['description'];            if (isset($options['mode']))            {                if ($options['mode'] == 'installed' && !isset($installed['version']))                    continue;                if ($options['mode'] == 'notinstalled' && isset($installed['version']))                    continue;                if ($options['mode'] == 'upgrades'                    && (!isset($installed['version']) || $installed['version'] == $info['stable']))                {                    continue;                }            }            $pos = array_search(strtolower($name), $local_pkgs);            if ($pos !== false) {                unset($local_pkgs[$pos]);            }            $data['data'][$info['category']][] = array(                $name,                @$info['stable'],

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -