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


PHP PEAR_Command类代码示例

本文整理汇总了PHP中PEAR_Command的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Command类的具体用法?PHP PEAR_Command怎么用?PHP PEAR_Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doDownloadAll

 /**
  * retrieves a list of avaible Packages from master server
  * and downloads them
  *
  * @access public
  * @param string $command the command
  * @param array $options the command options before the command
  * @param array $params the stuff after the command name
  * @return bool true if succesful
  * @throw PEAR_Error 
  */
 function doDownloadAll($command, $options, $params)
 {
     $this->config->set("php_dir", ".");
     $remote =& new PEAR_Remote($this->config);
     $remoteInfo = $remote->call("package.listAll");
     if (PEAR::isError($remoteInfo)) {
         return $remoteInfo;
     }
     $cmd =& PEAR_Command::factory("download", $this->config);
     if (PEAR::isError($cmd)) {
         return $cmd;
     }
     foreach ($remoteInfo as $pkgn => $pkg) {
         // error handling not neccesary, because
         // already done by the download command
         $cmd->run("download", array(), array($pkgn));
     }
     return true;
 }
开发者ID:valentijnvenus,项目名称:geocloud,代码行数:30,代码来源:Mirror.php

示例2: doInstallAll

 /**
  * do the install
  *
  * @access public
  * @param string $command the command
  * @param array $options the command options before the command
  * @param array $params the stuff after the command name
  * @return bool true if succesful
  * @throw PEAR_Error 
  */
 function doInstallAll($command, $options, $params)
 {
     $remote =& new PEAR_Remote($this->config);
     $remoteInfo = $remote->call("package.listAll");
     if (PEAR::isError($remoteInfo)) {
         return $remoteInfo;
     }
     $cmd =& PEAR_Command::factory("install", $this->config);
     if (PEAR::isError($cmd)) {
         return $cmd;
     }
     foreach ($remoteInfo as $pkgn => $pkg) {
         // error handling not neccesary, because
         // already done by the install command
         $options = array("nodeps" => true, "force" => true, "nobuild" => $options['nobuild']);
         $cmd->run("install", $options, array($pkgn));
     }
     return true;
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:29,代码来源:Fanatic.php

示例3: PEAR_Start_CLI

 function PEAR_Start_CLI()
 {
     parent::PEAR_Start();
     ini_set('html_errors', 0);
     define('WIN32GUI', OS_WINDOWS && php_sapi_name() == 'cli' && System::which('cscript'));
     $this->tty = OS_WINDOWS ? @fopen('\\con', 'r') : @fopen('/dev/tty', 'r');
     if (!$this->tty) {
         $this->tty = fopen('php://stdin', 'r');
     }
     $this->origpwd = getcwd();
     $this->config = array_keys($this->configPrompt);
     // make indices run from 1...
     array_unshift($this->config, "");
     unset($this->config[0]);
     reset($this->config);
     $this->descLength = max(array_map('strlen', $this->configPrompt));
     $this->descFormat = "%-{$this->descLength}s";
     $this->first = key($this->config);
     end($this->config);
     $this->last = key($this->config);
     PEAR_Command::setFrontendType('CLI');
 }
开发者ID:madberry,项目名称:WhiteLabelTransfer,代码行数:22,代码来源:CLI.php

示例4: invoke

 public function invoke()
 {
     $params = func_get_args();
     switch (func_num_args()) {
         case 1:
             list($command) = $params;
             $options = array();
             $args = array();
             break;
         case 2:
             list($command, $options) = $params;
             if (is_string($options)) {
                 $args = array($options);
                 $options = array();
             } else {
                 $args = array();
             }
             break;
         case 3:
             list($command, $options, $args) = $params;
             if (is_string($args)) {
                 if (is_string($options)) {
                     $args = array($options, $args);
                     $options = array();
                 } else {
                     $args = array($args);
                 }
             }
             break;
         default:
             $command = array_shift($params);
             if (is_array($params[0])) {
                 $options = array_shift($params);
             }
             $args = $params;
     }
     $cmd = \PEAR_Command::factory($command, $this->config);
     $cmd->run($command, $options, $args);
 }
开发者ID:pago,项目名称:pantr,代码行数:39,代码来源:Executor.php

示例5: run

 public function run($command, $options = array(), $params = array())
 {
     @set_time_limit(0);
     @ini_set('memory_limit', '256M');
     if (empty($this->_cmdCache[$command])) {
         $cmd = PEAR_Command::factory($command, $this->getConfig());
         if ($cmd instanceof PEAR_Error) {
             return $cmd;
         }
         $this->_cmdCache[$command] = $cmd;
     } else {
         $cmd = $this->_cmdCache[$command];
     }
     #$cmd = PEAR_Command::factory($command, $this->getConfig());
     $result = $cmd->run($command, $options, $params);
     return $result;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:17,代码来源:Pear.php

示例6: getHelp

 /**
  * Get help for command.
  *
  * @param string $command Name of the command to return help for
  *
  * @access public
  * @static
  */
 function getHelp($command)
 {
     $cmds = PEAR_Command::getCommands();
     if (isset($cmds[$command])) {
         $class = $cmds[$command];
         return $GLOBALS['_PEAR_Command_objects'][$class]->getHelp($command);
     }
     return false;
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:17,代码来源:Command.php

示例7: _command

 /**
  * Initializes the
  * @param unknown_type $command
  * @param array $opts
  * @param array $params
  * @return unknown_type
  */
 protected function _command($command, array $opts = array(), array $params = array())
 {
     // initialize the command
     $cmd = PEAR_Command::factory($command, $this->_config);
     if (PEAR::isError($cmd)) {
         throw new Exception($cmd->getMessage());
     }
     // run the command
     return $cmd->run($command, $opts, $params);
 }
开发者ID:BGCX067,项目名称:faett-core-svn-to-git,代码行数:17,代码来源:Service.php

示例8: array

                $command = 'config-set';
                $params = array($var, $value);
                $cmd = PEAR_Command::factory($command, $config);
                $res = $cmd->run($command, $opts, $params);
            }
            $URL .= '?command=config-show';
            Header("Location: " . $URL);
            exit;
        case 'list-all':
            $command = $_GET["command"];
            $params = array();
            if (isset($_GET["mode"])) {
                $opts['mode'] = $_GET["mode"];
            }
            $cmd = PEAR_Command::factory($command, $config);
            $ok = $cmd->run($command, $opts, $params);
            exit;
        case 'show-last-error':
            $GLOBALS['_PEAR_Frontend_Web_log'] = $_SESSION['_PEAR_Frontend_Web_LastError_log'];
            $ui->displayError($_SESSION['_PEAR_Frontend_Web_LastError'], 'Error', 'error', true);
            exit;
        default:
            $command = $_GET["command"];
            $cmd = PEAR_Command::factory($command, $config);
            $res = $cmd->run($command, $opts, $params);
            $URL .= '?command=' . $_GET["command"];
            Header("Location: " . $URL);
            exit;
    }
}
$ui->displayStart();
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:31,代码来源:WebInstaller.php

示例9: nativePearUpgrade

 private static function nativePearUpgrade($package, $channel)
 {
     pake_echo_action('pear', 'upgrading ' . $channel . '/' . $package);
     self::initPearClasses();
     $front = PEAR_Frontend::singleton('PEAR_Frontend_CLI');
     $cfg = PEAR_Config::singleton();
     $cmd = PEAR_Command::factory('upgrade', $cfg);
     ob_start();
     $result = $cmd->doInstall('upgrade', array(), array($channel . '/' . $package));
     ob_end_clean();
     // we don't need output
     if ($result instanceof PEAR_Error) {
         throw new pakeException($result->getMessage());
     }
 }
开发者ID:JasonWayne,项目名称:markdown-resume,代码行数:15,代码来源:pakePearTask.class.php

示例10:

 /**
  * For unit-testing
  */
 function &factory($a)
 {
     $a =& PEAR_Command::factory($a, $this->config);
     return $a;
 }
开发者ID:shen0834,项目名称:util,代码行数:8,代码来源:Mirror.php

示例11: doInstall

 function doInstall()
 {
     print "Beginning install...\n";
     // finish php_bin config
     if (OS_WINDOWS) {
         $this->php_bin .= '\\php.exe';
     } else {
         $this->php_bin .= '/php';
     }
     $this->PEARConfig =& PEAR_Config::singleton($this->pear_conf, $this->pear_conf);
     $this->PEARConfig->set('preferred_state', 'stable');
     foreach ($this->config as $var) {
         if ($var == 'pear_conf' || $var == 'prefix') {
             continue;
         }
         $this->PEARConfig->set($var, $this->{$var});
     }
     $this->PEARConfig->store();
     //       $this->PEARConfig->set('verbose', 6);
     print "Configuration written to {$this->pear_conf}...\n";
     $this->registry =& $this->PEARConfig->getRegistry();
     print "Initialized registry...\n";
     $install =& PEAR_Command::factory('install', $this->PEARConfig);
     print "Preparing to install...\n";
     $options = array('nodeps' => true, 'force' => true, 'upgrade' => true);
     foreach ($this->tarball as $pkg => $src) {
         print "installing {$src}...\n";
     }
     $install->run('install', $options, array_values($this->tarball));
 }
开发者ID:michabbb,项目名称:pear-core,代码行数:30,代码来源:Start.php

示例12: nativePearInstall

 private function nativePearInstall($package, $channel)
 {
     if (!class_exists('PEAR_Command')) {
         @(include 'PEAR/command.php');
         // loads frontend, among other things
         if (!class_exists('PEAR_Command')) {
             throw new pakeException('PEAR subsystem is unavailable (not in include_path?)');
         }
     }
     $front = PEAR_Frontend::singleton('PEAR_Frontend_CLI');
     $cfg = PEAR_Config::singleton();
     $cmd = PEAR_Command::factory('install', $cfg);
     ob_start();
     $result = $cmd->doInstall('install', array(), array($channel . '/' . $package));
     ob_end_clean();
     // we don't need output
     if ($result instanceof PEAR_Error) {
         throw new pakeException($result->getMessage());
     }
 }
开发者ID:piotras,项目名称:pake,代码行数:20,代码来源:pakePearTask.class.php

示例13: array

 /**
  * @access private
  */
 function &_makePackage($setting, $workdir)
 {
     // package.xml を作る
     $pkgconfig = array('packagedirectory' => $workdir, 'outputdirectory' => $workdir, 'ignore' => array('CVS/', '.cvsignore', '.svn/', 'package.xml', '*.ini', $setting['pkgname'] . '-*.tgz'), 'filelistgenerator' => 'file', 'changelogoldtonew' => false);
     $packagexml = new PEAR_PackageFileManager2();
     $pkgconfig = array_merge($pkgconfig, $setting['config']);
     $packagexml->setOptions($pkgconfig);
     $packagexml->setPackage($setting['pkgname']);
     $packagexml->setSummary($setting['summary']);
     $packagexml->setNotes($setting['notes']);
     $packagexml->setDescription($setting['description']);
     $packagexml->setChannel($setting['channel']);
     $packagexml->setAPIVersion($setting['version']);
     $packagexml->setReleaseVersion($setting['version']);
     $packagexml->setReleaseStability($setting['state']);
     $packagexml->setAPIStability($setting['state']);
     $packagexml->setPackageType('php');
     foreach ($setting['maintainers'] as $m) {
         $packagexml->addMaintainer($m['role'], $m['user'], $m['name'], $m['email'], $m['active']);
     }
     $packagexml->setLicense($setting['license']['name'], $setting['license']['uri']);
     $packagexml->addRole('css', 'php');
     $packagexml->addRole('tpl', 'php');
     $packagexml->addRole('ethna', 'php');
     $packagexml->addRole('sh', 'script');
     $packagexml->addRole('bat', 'script');
     $packagexml->setPhpDep('4.3.0');
     $packagexml->setPearinstallerDep('1.3.5');
     $packagexml->generateContents();
     foreach ($setting['callback'] as $method => $params) {
         $r = call_user_func_array(array(&$packagexml, $method), $params);
     }
     $r = $packagexml->writePackageFile();
     if (PEAR::isError($r)) {
         return Ethna::raiseError($r->getMessage, $r->getCode());
     }
     //  finally make package
     PEAR_Command::setFrontendType('CLI');
     $ui = PEAR_Command::getFrontendObject();
     $config = PEAR_Config::singleton();
     $ui->setConfig($config);
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$ui, 'displayFatalError'));
     $cmd = PEAR_Command::factory('package', $config);
     if (PEAR::isError($cmd)) {
         return Ethna::raiseError($cmd->getMessage, $cmd->getCode());
     }
     $r = $cmd->run('package', array(), array("{$workdir}/package.xml"));
     if (PEAR::isError($r)) {
         return Ethna::raiseError($r->getMessage, $r->getCode());
     }
 }
开发者ID:riaf,项目名称:pastit,代码行数:54,代码来源:MakePluginPackage.php

示例14: PEAR_Registry

}
$config->set('download_dir', $temp_dir . '/download');
$config->set('temp_dir', $temp_dir);
$config->store();
$registry = new PEAR_Registry($php_dir);
PEAR_Command::setFrontendType('CLI');
PEAR::staticPushErrorHandling(PEAR_ERROR_DIE);
//fail silently
$ch_cmd =& PEAR_Command::factory('update-channels', $config);
$ch_cmd->run('update-channels', $options, array());
PEAR::staticPopErrorHandling();
// reset error handling
unset($ch_cmd);
print "\n" . 'Installing selected packages..................' . "\n";
displayHTMLProgress($progress = 45);
$install =& PEAR_Command::factory('install', $config);
foreach ($to_install as $pkg) {
    $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
    if (in_array($pkg, $installer_packages)) {
        $options = array('nodeps' => true);
    } else {
        $options = array('onlyreqdeps' => true);
    }
    if ($registry->packageExists($pkg) || $registry->packageExists($pkg_basename)) {
        print str_pad("Package: {$pkg}", max(50, 9 + strlen($pkg) + 4), '.') . ' already installed ... ok' . "\n";
        displayHTMLProgress($progress += round(50 / count($to_install)));
        continue;
    }
    $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
    if (in_array($pkg_basename, $bootstrap_pkgs)) {
        print str_pad("Installing bootstrap package: {$pkg_basename}", max(50, 30 + strlen($pkg_basename) + 4), '.') . "...";
开发者ID:swat30,项目名称:safeballot,代码行数:31,代码来源:go-pear.php

示例15: _getPearOpt

 /**
  *  (experimental)
  *  @return array
  */
 private function _getPearOpt(&$cmd_obj, $cmd_str, $opt_array)
 {
     $short_args = $long_args = null;
     PEAR_Command::getGetOptArgs($cmd_str, $short_args, $long_args);
     $opt = new Ethna_Getopt();
     $opt_arg = $opt->getopt($opt_array, $short_args, $long_args);
     if (Ethna::isError($opt_arg)) {
         return array();
     }
     $opts = array();
     foreach ($opt_arg[0] as $tmp) {
         list($opt, $val) = $tmp;
         if ($val === null) {
             $val = true;
         }
         if (strlen($opt) == 1) {
             $cmd_opts = $cmd_obj->getOptions($cmd_str);
             foreach ($cmd_opts as $o => $d) {
                 if (isset($d['shortopt']) && $d['shortopt'] == $opt) {
                     $opts[$o] = $val;
                 }
             }
         } else {
             if (substr($opt, 0, 2) == '--') {
                 $opts[substr($opt, 2)] = $val;
             }
         }
     }
     return $opts;
 }
开发者ID:riaf,项目名称:pastit,代码行数:34,代码来源:PearWrapper.php


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