本文整理汇总了PHP中io::dialog方法的典型用法代码示例。如果您正苦于以下问题:PHP io::dialog方法的具体用法?PHP io::dialog怎么用?PHP io::dialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::dialog方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RestartById
public function RestartById($c)
{
if (!count(DB::query('SELECT * from ' . self::TABLE . ' WHERE id="' . $c . '"'))) {
io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
return;
}
$list = DB::query('SELECT * FROM ' . self::TABLE . ' where isnull(finished_at) and not
isnull(locked_at) and isnull(failed_at) and id=' . $c . ' ORDER BY run_at DESC');
if (count($list)) {
IO::out("This is working now...You cant restart!", IO::MESSAGE_FAIL);
return;
}
if (IO::YES == io::dialog('Do you really want to restart work with id ' . $c . '?', IO::NO | IO::YES, IO::NO)) {
DB::query("UPDATE " . self::TABLE . " set attempts='1',finished_at=null, locked_at=null, \n failed_at=null, run_at=now() WHERE id='" . $c . "'");
$php_path = exec("which php");
if (empty($php_path)) {
return $this->log("###" . date("c") . " Call from console PHP executable not found");
}
if (!is_executable($php_path)) {
return $this->log("###" . date("c") . " Call from console {$php_path} could not be executed");
}
exec($php_path . ' ' . trim(escapeshellarg(Config::get('ROOT_DIR') . "/vendors/delayedjob/JobHandler.php"), "'") . ' >> ' . Config::get('ROOT_DIR') . '/logs/delayedjob.log 2>&1 &');
io::done('Restarting...');
} else {
io::done('Cancel restart');
}
IO::out("");
}
示例2: cmdDel
public function cmdDel()
{
if (($login = ArgsHolder::get()->shiftCommand()) === false) {
return io::out('Incorrect param count', IO::MESSAGE_FAIL) | 1;
}
if (IO::YES != io::dialog('Do You really want to delete user ~RED~' . $login . '~~~?', IO::NO | IO::YES, IO::NO)) {
return io::out('Cancelled ', IO::MESSAGE_FAIL) | 2;
}
try {
if (ArgsHolder::get()->getOption('confirm')) {
if (OneTimeTokenAuth::exists($user_id = User::findIdBy('login', $login))) {
io::out('Deleting User... ', false);
OneTimeTokenAuth::deleteByUserId($user_id);
return io::done();
} else {
return io::out('There is no user ~WHITE~' . $login . '~~~', IO::MESSAGE_FAIL) | 2;
}
}
if ($user = User::findBy("login", $login)) {
io::out('Deleting user ', false);
$user->delete();
io::done();
} else {
return io::out('There is no user ~WHITE~' . $login . '~~~', IO::MESSAGE_FAIL) | 2;
}
} catch (UserException $e) {
return io::out($e->getMessage(), IO::MESSAGE_FAIL) | 127;
}
}
示例3: deleteQueue
public function deleteQueue($c)
{
if (!DB::query('SELECT id from ' . self::TABLE . ' WHERE queue="' . $c . '"')) {
io::out("Queue {$c} is not exists", IO::MESSAGE_FAIL);
return;
}
if (IO::YES == io::dialog('Realy you really want to delete all jobs with queue ' . $c . '?', IO::NO | IO::YES, IO::NO)) {
DB::query("DELETE FROM " . self::TABLE . " WHERE queue='" . $c . "'");
io::done('Deleting...');
} else {
io::done('Cancel delete');
}
}
示例4: cmdDeluser
public function cmdDeluser()
{
$login = ArgsHolder::get()->shiftCommand();
$group = ArgsHolder::get()->shiftCommand();
if ($login === false || $group === false) {
return io::out('Incorrect param count', IO::MESSAGE_FAIL) | 1;
}
if (!in_array($group, array_values(ACL::getGroups()))) {
return io::out("No such group {$group}", IO::MESSAGE_FAIL) | 3;
}
if (!($id = UserManager::get()->getIdByLogin($login))) {
return io::out("No such user {$login}", IO::MESSAGE_FAIL) | 3;
}
if (IO::YES == io::dialog('Remove user ~WHITE~ ' . $login . '~~~ from group ~WHITE~' . $group . '~~~', IO::NO | IO::YES, IO::YES)) {
io::out('deleting...', false);
ACL::deleteUserFromGroup($id, $group);
io::done();
}
}
示例5: cmdRemove
public function cmdRemove()
{
if (($name = ArgsHolder::get()->shiftCommand()) === false) {
return io::out('Incorrect param count', IO::MESSAGE_FAIL);
}
if (file_exists($this->root_dir . '/controllers/' . $name . '.php')) {
if (IO::YES == io::dialog('Realy Delete controller,models,pages with name ~WHITE~' . $name . '~~~?', IO::NO | IO::YES, IO::NO)) {
IO::out('~WHITE~Removing:~~~');
self::rRem($this->root_dir . '/controllers/' . $name . '.php');
io::done(' controllers/' . $name . '.php');
self::rRem($this->root_dir . $this->models_dir . '/' . $name);
io::done(' ' . $this->models_dir . '/' . $name);
self::rRem($this->root_dir . '/pages/' . $name);
io::done(' pages/' . $name);
}
} else {
io::out('Controller with name ~WHITE~' . $name . '~~~ not exist ', IO::MESSAGE_FAIL);
}
}
示例6: uninstall
/**
* Удаление пакета
*/
static function uninstall($package)
{
$nvr = PackageManager::parseNRV($package);
// проверка обратных зависимостей
$res = Deps::isNoNeeded($nvr, $unstatisfied);
if (count($res) == 0) {
return IO::out('Packages to uninstall not found', IO::MESSAGE_FAIL);
}
if ($res === false) {
io::out('Unable uninstall package ~WHITE~' . $nvr['name'] . '~~~ because', IO::MESSAGE_FAIL);
foreach ($unstatisfied as $p => $d) {
io::out('Package ' . $p . ' require ' . implode(', ', array_keys($d)));
}
return false;
}
io::out('Packages to be removed: ', false);
foreach ($res as $p) {
io::out($p->name . '(' . $p->version . ') ', false);
}
io::out();
if (IO::NO == io::dialog('Continue?', IO::YES | IO::NO, IO::NO)) {
return 1;
}
foreach ($res as $p) {
io::out('~WHITE~Undeploying ' . $p->name . '(' . $p->version . '):~~~');
$r = Deployer::undeploy(Deployer::getPackageRollbackDir($p));
if ($r || IO::OK != IO::dialog('Some part of rollback failed. Remove anyway?', IO::YES | IO::NO, IO::YES)) {
Deployer::getPackageRollbackDir($p)->delete();
$p->file->delete();
PackageManager::get()->packagesSequence->removePackage($p->name, $p->version);
}
}
}