本文整理汇总了PHP中PEAR_Config::store方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Config::store方法的具体用法?PHP PEAR_Config::store怎么用?PHP PEAR_Config::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Config
的用法示例。
在下文中一共展示了PEAR_Config::store方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPassword
/**
* (non-PHPdoc)
* @see lib/Faett/Core/Interfaces/Faett_Core_Interfaces_Service#setPassword()
*/
public function setPassword($password, $channel, $layer = 'user')
{
// set password for channel
$this->_config->set('password', $password, $layer, $channel);
// write config
$this->_config->store($layer);
}
示例2: doLogin
/**
* Execute the 'login' command.
*
* @param string $command command name
*
* @param array $options option_name => value
*
* @param array $params list of additional parameters
*
* @return bool TRUE on success or
* a PEAR error on failure
*
* @access public
*/
function doLogin($command, $options, $params)
{
$reg =& $this->config->getRegistry();
// If a parameter is supplied, use that as the channel to log in to
if (isset($params[0])) {
$channel = $params[0];
} else {
$channel = $this->config->get('default_channel');
}
$chan = $reg->getChannel($channel);
if (PEAR::isError($chan)) {
return $this->raiseError($chan);
}
$server = $this->config->get('preferred_mirror', null, $channel);
$remote =& $this->config->getRemote();
$username = $this->config->get('username', null, $channel);
if (empty($username)) {
$username = isset($_ENV['USER']) ? $_ENV['USER'] : null;
}
$this->ui->outputData("Logging in to {$server}.", $command);
list($username, $password) = $this->ui->userDialog($command, array('Username', 'Password'), array('text', 'password'), array($username, ''));
$username = trim($username);
$password = trim($password);
$ourfile = $this->config->getConfFile('user');
if (!$ourfile) {
$ourfile = $this->config->getConfFile('system');
}
$this->config->set('username', $username, 'user', $channel);
$this->config->set('password', $password, 'user', $channel);
if ($chan->supportsREST()) {
$ok = true;
} else {
$remote->expectError(401);
$ok = $remote->call('logintest');
$remote->popExpect();
}
if ($ok === true) {
$this->ui->outputData("Logged in.", $command);
// avoid changing any temporary settings changed with -d
$ourconfig = new PEAR_Config($ourfile, $ourfile);
$ourconfig->set('username', $username, 'user', $channel);
$ourconfig->set('password', $password, 'user', $channel);
$ourconfig->store();
} else {
return $this->raiseError("Login failed!");
}
return true;
}