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


PHP PEAR_Command::factory方法代码示例

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


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

示例1: _pear_run_command

function _pear_run_command($config, $command, $opts, $params)
{
    ob_start('_pear_echo_message', 2);
    $cmd = PEAR_Command::factory($command, $config);
    $ret = ob_get_clean();
    if (PEAR::isError($cmd)) {
        throw new Exception($cmd->getMessage());
    }
    ob_start('_pear_echo_message', 2);
    $ok = $cmd->run($command, $opts, $params);
    $ret .= ob_get_clean();
    $ret = trim($ret);
    return PEAR::isError($ok) ? array($ret, $ok->getMessage()) : array($ret, null);
}
开发者ID:taryono,项目名称:school,代码行数:14,代码来源:sfPakePlugins.php

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

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

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

}
if ($fetype == 'Gtk' || $fetype == 'Gtk2') {
    if (!$config->validConfiguration()) {
        PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' . "'{$pear_user_config}' or '{$pear_system_config}', please copy an existing configuration" . 'file to one of these locations, or use the -c and -s options to create one');
    }
    Gtk::main();
} else {
    do {
        if ($command == 'help') {
            usage(null, @$options[1][1]);
        }
        if (!$config->validConfiguration()) {
            PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files ' . "'{$pear_user_config}' or '{$pear_system_config}', please copy an existing configuration" . 'file to one of these locations, or use the -c and -s options to create one');
        }
        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
        $cmd = PEAR_Command::factory($command, $config);
        PEAR::popErrorHandling();
        if (PEAR::isError($cmd)) {
            usage(null, @$options[1][0]);
        }
        $short_args = $long_args = null;
        PEAR_Command::getGetoptArgs($command, $short_args, $long_args);
        if (in_array('getopt2', get_class_methods('Console_Getopt'))) {
            array_shift($options[1]);
            $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args);
        } else {
            $tmp = Console_Getopt::getopt($options[1], $short_args, $long_args);
        }
        if (PEAR::isError($tmp)) {
            break;
        }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:31,代码来源:pearcmd.php

示例6:

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

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

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

示例9: _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

示例10: _run

 /**
  *  run PEAR_Command.
  *
  *  @param  string  $command    command name
  *  @param  array   $options    options
  *  @param  array   $params     parameters
  *  @return true|Ethna_Error
  *  @access private 
  *  @see PEAR_Command_Common::run, etc.
  */
 protected function _run($command, $options, $params)
 {
     if ($this->config === null) {
         return Ethna::raiseError('configuration not initialized.');
     }
     $true = true;
     $cmd = PEAR_Command::factory($command, $this->config);
     if (PEAR::isError($cmd)) {
         return $cmd;
     }
     // pear command options
     if (is_array($this->_pearopt) && count($this->_pearopt) > 0) {
         $pearopts = $this->_getPearOpt($cmd, $command, $this->_pearopt);
         $options = array_merge($pearopts, $options);
     }
     $ret = $cmd->run($command, $options, $params);
     if (PEAR::isError($ret)) {
         return $ret;
     }
     return $true;
 }
开发者ID:riaf,项目名称:pastit,代码行数:31,代码来源:PearWrapper.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: run


//.........这里部分代码省略.........
         $param = !empty($opt[1]) ? $opt[1] : true;
         switch ($opt[0]) {
             case 'd':
                 if ($param === true) {
                     die('Invalid usage of "-d" option, expected -d config_value=value, ' . 'received "-d"' . "\n");
                 }
                 $possible = explode('=', $param);
                 if (count($possible) != 2) {
                     die('Invalid usage of "-d" option, expected -d config_value=value, received "' . $param . '"' . "\n");
                 }
                 list($key, $value) = explode('=', $param);
                 $config->set($key, $value, 'user');
                 break;
             case 'D':
                 if ($param === true) {
                     die('Invalid usage of "-d" option, expected -d config_value=value, ' . 'received "-d"' . "\n");
                 }
                 $possible = explode('=', $param);
                 if (count($possible) != 2) {
                     die('Invalid usage of "-d" option, expected -d config_value=value, received "' . $param . '"' . "\n");
                 }
                 list($key, $value) = explode('=', $param);
                 $config->set($key, $value, 'system');
                 break;
             case 's':
                 $store_user_config = true;
                 break;
             case 'u':
                 $config->remove($param, 'user');
                 break;
             case 'v':
                 $config->set('verbose', $config->get('verbose') + 1);
                 break;
             case 'q':
                 $config->set('verbose', $config->get('verbose') - 1);
                 break;
             case 'V':
                 $this->usage(null, 'version');
             case 'c':
             case 'C':
                 break;
             default:
                 // all non pear params goes to the command
                 $cmdopts[$opt[0]] = $param;
                 break;
         }
     }
     if ($store_user_config) {
         $config->store('user');
     }
     $command = isset($options[1][0]) ? $options[1][0] : null;
     if (empty($command) && $store_user_config) {
         exit;
     }
     if ($command == 'help') {
         $this->usage(null, @$options[1][1]);
     }
     if (!$config->validConfiguration()) {
         PEAR::raiseError('CRITICAL ERROR: no existing valid configuration files found in files found');
     }
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     $cmd = PEAR_Command::factory($command, $config);
     PEAR::popErrorHandling();
     if (PEAR::isError($cmd)) {
         $this->usage(null, @$options[1][0]);
     }
     $short_args = $long_args = null;
     PEAR_Command::getGetoptArgs($command, $short_args, $long_args);
     array_shift($options[1]);
     $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args);
     if (PEAR::isError($tmp)) {
         break;
     }
     list($tmpopt, $params) = $tmp;
     $opts = array();
     foreach ($tmpopt as $foo => $tmp2) {
         list($opt, $value) = $tmp2;
         if ($value === null) {
             $value = true;
             // options without args
         }
         if (strlen($opt) == 1) {
             $cmdoptions = $cmd->getOptions($command);
             foreach ($cmdoptions as $o => $d) {
                 if (isset($d['shortopt']) && $d['shortopt'] == $opt) {
                     $opts[$o] = $value;
                 }
             }
         } else {
             if (substr($opt, 0, 2) == '--') {
                 $opts[substr($opt, 2)] = $value;
             }
         }
     }
     $ok = $cmd->run($command, $opts, $params);
     if ($ok === false) {
         PEAR::raiseError("unknown command `{$command}'");
     }
     //        error_reporting($old);
 }
开发者ID:pago,项目名称:pantr,代码行数:101,代码来源:PearRunner.php

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

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

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


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