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


PHP PEAR_Command::setFrontendType方法代码示例

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


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

示例1: init

 /**
  *  setup PEAR_Config and so on.
  *
  *  @param  string      $target     whether 'master' or 'local'
  *  @param  string|null $app_dir    local application directory.
  *  @param  string|null $channel    channel for the package repository.
  *  @return true|Ethna_Error
  */
 public function init($target, $app_dir = null, $channel = null)
 {
     $true = true;
     if ($target == 'master') {
         $this->target = 'master';
     } else {
         // default target is 'local'.
         $this->target = 'local';
     }
     // setup PEAR_Frontend
     PEAR_Command::setFrontendType('CLI');
     $this->ui = PEAR_Command::getFrontendObject();
     // set PEAR's error handling
     // TODO: if PEAR/Command/Install.php is newer than 1.117, displayError goes well.
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$this->ui, 'displayFatalError'));
     // set channel
     $master_setting = Ethna_Handle::getMasterSetting('repositry');
     if ($channel !== null) {
         $this->channel = $channel;
     } else {
         if (isset($master_setting["channel_{$target}"])) {
             $this->channel = $master_setting["channel_{$target}"];
         } else {
             $this->channel = 'pear.ethna.jp';
         }
     }
     // set target controller
     if ($target == 'master') {
         $this->target_ctl = Ethna_Handle::getEthnaController();
     } else {
         $this->target_ctl = Ethna_Handle::getAppController($app_dir);
     }
     if (Ethna::isError($this->target_ctl)) {
         return $this->target_ctl;
     }
     // setup PEAR_Config
     if ($target == 'master') {
         $ret = $this->_setMasterConfig();
     } else {
         $ret = $this->_setLocalConfig();
     }
     if (Ethna::isError($ret)) {
         return $ret;
     }
     $this->ui->setConfig($this->config);
     // setup PEAR_Registry
     $this->registry = $this->config->getRegistry();
     return $true;
 }
开发者ID:riaf,项目名称:pastit,代码行数:57,代码来源:PearWrapper.php

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

示例3: foreach

$pear_user_config = '';
$pear_system_config = '';
$store_user_config = false;
$store_system_config = false;
$verbose = 1;
foreach ($opts as $opt) {
    switch ($opt[0]) {
        case 'c':
            $pear_user_config = $opt[1];
            break;
        case 'C':
            $pear_system_config = $opt[1];
            break;
    }
}
PEAR_Command::setFrontendType($fetype);
$ui =& PEAR_Command::getFrontendObject();
$config =& PEAR_Config::singleton($pear_user_config, $pear_system_config);
if (PEAR::isError($config)) {
    $_file = '';
    if ($pear_user_config !== false) {
        $_file .= $pear_user_config;
    }
    if ($pear_system_config !== false) {
        $_file .= '/' . $pear_system_config;
    }
    if ($_file == '/') {
        $_file = 'The default config file';
    }
    $config->getMessage();
    $ui->outputData("ERROR: {$_file} is not a valid config file or is corrupted.");
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:31,代码来源:pearcmd.php

示例4: foreach

if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
    $config =& PEAR_Config::singleton($prefix . "/pear.conf", '');
} else {
    $config =& PEAR_Config::singleton();
}
$config->set('preferred_state', 'stable');
foreach ($config_vars as $var) {
    if (isset(${$var}) && ${$var} != '') {
        $config->set($var, ${$var});
    }
}
$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 {
开发者ID:swat30,项目名称:safeballot,代码行数:31,代码来源:go-pear.php

示例5: define

}
if (isset($_GET['enableJS']) && $_GET['enableJS'] == 1) {
    $_SESSION['_PEAR_Frontend_Web_js'] = true;
}
define('USE_DHTML_PROGRESS', @$useDHTML && $_SESSION['_PEAR_Frontend_Web_js']);
if (!isset($pear_user_config)) {
    $pear_user_config = dirname(__FILE__) . "/pear.conf";
}
// Include needed files
require_once 'PEAR.php';
require_once 'PEAR/Registry.php';
require_once 'PEAR/Config.php';
require_once 'PEAR/Command.php';
// Init PEAR Installer Code and WebFrontend
$config = $GLOBALS['_PEAR_Frontend_Web_config'] =& PEAR_Config::singleton($pear_user_config, '');
PEAR_Command::setFrontendType("Web");
$ui =& PEAR_Command::getFrontendObject();
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
// Cient requests an Image/Stylesheet/Javascript
if (isset($_GET["css"])) {
    $ui->outputFrontendFile($_GET["css"], 'css');
}
if (isset($_GET["js"])) {
    $ui->outputFrontendFile($_GET["js"], 'js');
}
if (isset($_GET["img"])) {
    $ui->outputFrontendFile($_GET["img"], 'image');
}
$verbose = $config->get("verbose");
$cmdopts = array();
$opts = array();
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:31,代码来源:WebInstaller.php

示例6: _pear_init

function _pear_init()
{
    // Remove E_STRICT from error_reporting
    error_reporting(error_reporting() & ~E_STRICT);
    require_once 'PEAR.php';
    require_once 'PEAR/Frontend.php';
    require_once 'PEAR/Config.php';
    require_once 'PEAR/Registry.php';
    require_once 'PEAR/Command.php';
    require_once 'PEAR/Remote.php';
    // current symfony release
    $sf_version = preg_replace('/\\-\\w+$/', '', file_get_contents(sfConfig::get('sf_symfony_lib_dir') . '/VERSION'));
    // PEAR
    PEAR_Command::setFrontendType('CLI');
    $ui =& PEAR_Command::getFrontendObject();
    // read user/system configuration (don't use the singleton)
    $config = new PEAR_Config();
    $config_file = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '.pearrc';
    // change the configuration for symfony use
    $config->set('php_dir', sfConfig::get('sf_plugins_dir'));
    $config->set('data_dir', sfConfig::get('sf_plugins_dir'));
    $config->set('test_dir', sfConfig::get('sf_plugins_dir'));
    $config->set('doc_dir', sfConfig::get('sf_plugins_dir'));
    $config->set('bin_dir', sfConfig::get('sf_plugins_dir'));
    // change the PEAR temp dir
    $config->set('cache_dir', sfConfig::get('sf_cache_dir'));
    $config->set('download_dir', sfConfig::get('sf_cache_dir'));
    $config->set('tmp_dir', sfConfig::get('sf_cache_dir'));
    // save out configuration file
    $config->writeConfigFile($config_file, 'user');
    // use our configuration file
    $config =& PEAR_Config::singleton($config_file);
    $config->set('verbose', 1);
    $ui->setConfig($config);
    date_default_timezone_set('UTC');
    // register our channel
    $symfony_channel = array('attribs' => array('version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd'), 'name' => 'pear.symfony-project.com', 'summary' => 'symfony project PEAR channel', 'suggestedalias' => 'symfony', 'servers' => array('primary' => array('rest' => array('baseurl' => array(array('attribs' => array('type' => 'REST1.0'), '_content' => 'http://pear.symfony-project.com/Chiara_PEAR_Server_REST/'), array('attribs' => array('type' => 'REST1.1'), '_content' => 'http://pear.symfony-project.com/Chiara_PEAR_Server_REST/'))))), '_lastmodified' => array('ETag' => "113845-297-dc93f000", 'Last-Modified' => date('r')));
    pake_mkdirs(sfConfig::get('sf_plugins_dir') . '/.channels/.alias');
    file_put_contents(sfConfig::get('sf_plugins_dir') . '/.channels/pear.symfony-project.com.reg', serialize($symfony_channel));
    file_put_contents(sfConfig::get('sf_plugins_dir') . '/.channels/.alias/symfony.txt', 'pear.symfony-project.com');
    // register symfony for dependencies
    $symfony = array('name' => 'symfony', 'channel' => 'pear.symfony-project.com', 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'version' => array('release' => $sf_version, 'api' => '1.0.0'), 'stability' => array('release' => 'stable', 'api' => 'stable'), 'xsdversion' => '2.0', '_lastmodified' => time(), 'old' => array('version' => $sf_version, 'release_state' => 'stable'));
    $dir = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '.registry' . DIRECTORY_SEPARATOR . '.channel.pear.symfony-project.com';
    pake_mkdirs($dir);
    file_put_contents($dir . DIRECTORY_SEPARATOR . 'symfony.reg', serialize($symfony));
    return $config;
}
开发者ID:taryono,项目名称:school,代码行数:47,代码来源:sfPakePlugins.php

示例7: __construct

 public function __construct($config)
 {
     $this->config = $config;
     \PEAR_Command::setFrontendType('CLI');
     \PEAR_Command::getFrontendObject()->setConfig($this->config);
 }
开发者ID:pago,项目名称:pantr,代码行数:6,代码来源:Executor.php

示例8: run

 public function run($argv)
 {
     //        $old = error_reporting(0);
     if (!defined('PEAR_RUNTYPE')) {
         define('PEAR_RUNTYPE', 'pear');
     }
     if (!defined('PEAR_IGNORE_BACKTRACE')) {
         define('PEAR_IGNORE_BACKTRACE', 1);
     }
     @ini_set('allow_url_fopen', true);
     if (!ini_get('safe_mode')) {
         @set_time_limit(0);
     }
     ob_implicit_flush(true);
     @ini_set('track_errors', true);
     @ini_set('html_errors', false);
     @ini_set('magic_quotes_runtime', false);
     $pear_package_version = "1.9.0";
     PEAR_Command::setFrontendType('CLI');
     $this->_allCommands = PEAR_Command::getCommands();
     $progname = PEAR_RUNTYPE;
     array_shift($argv);
     $options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV");
     if (PEAR::isError($options)) {
         $this->usage($options);
     }
     $opts = $options[0];
     $store_user_config = false;
     $verbose = 1;
     $config = PEAR_Config::singleton($this->_pearConfigFile, "#no#system#config#");
     if ($config instanceof PEAR_Error) {
         echo $config, "\n";
         exit(1);
     }
     $config->set('verbose', 1);
     //        $config->set('verbose', -1); // supress all kind of annoying stuff.
     $ui = PEAR_Command::getFrontendObject();
     $ui->setConfig($config);
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, "throwException"));
     if (ini_get('safe_mode')) {
         $ui->outputData('WARNING: running in safe mode requires that all files created ' . 'be the same uid as the current script. PHP reports this script is uid: ' . @getmyuid() . ', and current user is: ' . @get_current_user());
     }
     $verbose = $config->get("verbose");
     $cmdopts = array();
     foreach ($opts as $opt) {
         $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') {
//.........这里部分代码省略.........
开发者ID:pago,项目名称:pantr,代码行数:101,代码来源:PearRunner.php

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


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