本文整理汇总了PHP中Server::getDaemon方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getDaemon方法的具体用法?PHP Server::getDaemon怎么用?PHP Server::getDaemon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::getDaemon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionConfigs
public function actionConfigs($id)
{
Yii::app()->user->can($id, 'edit configs', true);
$configs = ConfigFile::model()->findAll();
$dmn = Server::getDaemon($id);
$list = array();
$error = '';
foreach ($configs as $cfg) {
if (!$cfg->enabled) {
continue;
}
$res = McBridge::get()->cmd($dmn, 'server ' . $id . ':cfgfile check:' . $cfg->file . ':' . $cfg->dir . ':');
if (!$res['success'] || !isset($res['data'][0])) {
$error = CHtml::encode($res['error']);
continue;
}
foreach ($res['data'] as $data) {
if ($data['valid'] != 'True') {
continue;
}
$name = $this->replData($cfg->name, $data['file'], $data['dir']);
$desc = $this->replData($cfg->description, $data['file'], $data['dir']);
$list[] = array('id' => $cfg->id, 'name' => $name, 'desc' => $desc, 'ro' => $data['ro'], 'file' => $data['file'], 'dir' => $data['dir'], 'action' => $data['ro'] == 'True' ? 'View' : 'Edit');
}
}
$perm = McBridge::get()->cmd($dmn, 'server ' . $id . ':cfgfile check:[Pp]ermissions.[Jj][Aa][Rr]:plugins/:');
if ($perm['success'] && isset($perm['data'][0])) {
$perm = true;
} else {
$perm = false;
}
$this->render('configs', array('dataProvider' => new CArrayDataProvider($list, array('sort' => array('attributes' => array('name')), 'pagination' => array('pageSize' => 10))), 'model' => $this->loadModel($id), 'error' => $error, 'perm' => $perm));
}
示例2: serverCmd
public function serverCmd($server, $cmd, &$data = null, $broadcast = false, $nocache = false)
{
$command = $cmd;
$r = array();
if (($cache = CommandCache::get($server, $command, $r)) === 1) {
if (@$r['success']) {
$data = @$r['data'];
return true;
}
$this->addError(@$r['error']);
return false;
}
$cmd = 'server ' . $server . ':' . $cmd;
$ret = array();
if ($broadcast) {
$ret = $this->globalCmd($cmd);
} else {
$ret = array($this->cmd(Server::getDaemon($server), $cmd));
}
$e = '';
foreach ($ret as $r) {
if ($cache !== 0) {
CommandCache::set($server, $command, $r);
}
if ($r['success']) {
$data = $r['data'];
return true;
}
$e = $r['error'];
}
$this->addError($e);
return false;
}