當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IO::out方法代碼示例

本文整理匯總了PHP中IO::out方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::out方法的具體用法?PHP IO::out怎麽用?PHP IO::out使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IO的用法示例。


在下文中一共展示了IO::out方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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("");
 }
開發者ID:point,項目名稱:cassea,代碼行數:28,代碼來源:CmdBgworkRestart.php

示例2: process

 function process()
 {
     Console::initCore();
     if ($r = ArgsHolder::get()->getOption('count')) {
         $this->count = $r;
     }
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         IO::out("");
         $sql = 'SELECT * FROM ' . self::TABLE . ' where not isnull(finished_at) and not 
             isnull(locked_at) and isnull(failed_at) ORDER BY run_at DESC';
         if ($this->count) {
             $list = DB::query($sql . ' LIMIT ' . $this->count);
         } else {
             $list = DB::query($sql);
         }
         if (!count($list)) {
             IO::out("No finished work!", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf("%-10s %-7s %-3s %-20s %-20s %-19s %-4s %-5s", "~CYAN~id", "queue", "pr", "run_at", "locked_at", "finished_at", "att", "call_to~~~"));
         foreach ($list as $l) {
             $handler = unserialize($l["handler"]);
             io::out(sprintf("%-4s %-7s %-3s %-20s %-20s %-20s %-3s %-5s", $l["id"], $l["queue"], $l["priority"], $l["run_at"], $l["locked_at"], $l["finished_at"], $l["attempts"], $handler["class"] . "::" . $handler["method"] . "(...)"));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
開發者ID:point,項目名稱:cassea,代碼行數:33,代碼來源:CmdBgworkCompleted.php

示例3: process

 function process()
 {
     Console::initCore();
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         $format = "%-25s %s";
         IO::out("");
         $s = DB::query('SELECT * FROM ' . self::TABLE . ' where id="' . $c . '"');
         if (!count($s)) {
             io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf($format, "~CYAN~id~~~", $c));
         io::out(sprintf($format, "~CYAN~queue~~~", $this->emp($s[0]['queue'])));
         io::out(sprintf($format, "~CYAN~priority~~~", $this->emp($s[0]['priority'])));
         io::out(sprintf($format, "~CYAN~run at~~~", $this->emp($s[0]['run_at'])));
         io::out(sprintf($format, "~CYAN~locked at~~~", $this->emp($s[0]['locked_at'])));
         io::out(sprintf($format, "~CYAN~finished at~~~", $this->emp($s[0]['finished_at'])));
         io::out(sprintf($format, "~CYAN~failed at~~~", $this->emp($s[0]['failed_at'])));
         io::out(sprintf($format, "~CYAN~attemts~~~", $this->emp($s[0]['attempts'])));
         $handler = unserialize($s[0]["handler"]);
         io::out(sprintf($format, "~CYAN~call~~~", $handler["class"] . "::" . $handler["method"]) . "(...)");
         if (isset($handler["param"])) {
             io::out(sprintf($format, "~CYAN~params~~~", trim(self::walker($handler['param']), ',')));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
開發者ID:point,項目名稱:cassea,代碼行數:33,代碼來源:CmdBgworkSingle.php

示例4: cmdUnlock

 function cmdUnlock()
 {
     IO::out('Unlocking Package Manager', false);
     $pm = new PM();
     if ($pm->unlock(true)) {
         io::done();
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:8,代碼來源:PackageManagerFacade.php

示例5: cmdList

 function cmdList()
 {
     $list = $this->rl->getList();
     if (!count($list)) {
         return IO::out('Repository List empty.');
     }
     io::out('~WHITE~List of  Repositories~~~:');
     for ($i = 0, $c = count($list); $i < $c; $i++) {
         io::out($list[$i]);
     }
     io::out();
     io::out('Total: ' . $c);
 }
開發者ID:point,項目名稱:cassea,代碼行數:13,代碼來源:RepositoryManager.php

示例6: deleteById

 public function deleteById($c)
 {
     if (!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 delete!");
         return;
     }
     if (IO::YES == io::dialog('Do you really want to delete work with id ' . $c . '? ', IO::NO | IO::YES, IO::NO)) {
         DB::query("DELETE FROM " . self::TABLE . " WHERE  id='" . $c . "'");
         io::done('Deleting...');
     } else {
         io::done('Cancel delete');
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:19,代碼來源:CmdBgworkDelete.php

示例7: process

 function process()
 {
     if (!($c = ArgsHolder::get()->shiftCommand())) {
         return io::out('Incorrect parameter', IO::MESSAGE_FAIL) | 1;
     }
     $root = Config::get('ROOT_DIR');
     $file = $root . '/includes/env/' . strtolower($c) . '_env.php';
     if (!file_exists($file)) {
         return io::out('Mode ' . $c . ' not exists', IO::MESSAGE_FAIL) | 1;
     }
     IO::out('Updating Loader', false);
     $loader = fopen($root . '/includes/env/Loader.php', 'w');
     flock($loader, LOCK_EX);
     $put = '<?php require_once("' . $c . '_env.php");';
     fwrite($loader, $put);
     flock($loader, LOCK_UN);
     fclose($loader);
     io::done();
     io::out('Backup config.ini', false);
     if (copy($root . '/config/config.ini', $root . '/config/config.ini.bak')) {
         io::done();
     } else {
         return IO::out('Can\'t backup file config.ini', IO::MESSAGE_FAIL) | 1;
     }
     IO::out('Updating config.ini', false);
     $file_array = file($root . '/config/config.ini');
     $str = null;
     foreach ($file_array as $fa) {
         if (preg_match('/\\[\\s*config\\s*:\\s*\\S+\\]/', $fa, $match)) {
             $str .= '[config : ' . $c . ']' . PHP_EOL;
         } else {
             $str .= $fa;
         }
     }
     $config = fopen($root . '/config/config.ini', 'w');
     flock($config, LOCK_EX);
     fwrite($config, $str);
     flock($config, LOCK_UN);
     fclose($config);
     io::done();
     IO::done('Enviroments set to ~WHITE~' . $c . '~~~');
 }
開發者ID:point,項目名稱:cassea,代碼行數:42,代碼來源:CmdSwitch.php

示例8: cmdUserlist

 public function cmdUserlist()
 {
     if (!count(ACL::getGroups())) {
         return io::out('There is no groups yet.');
     }
     $users = ACL::getUsers();
     if ($group = ArgsHolder::get()->shiftCommand()) {
         if (!in_array($group, array_values(ACL::getGroups()))) {
             return io::out("No such group {$group}", IO::MESSAGE_FAIL) | 3;
         }
         IO::out("~WHITE~User(s) from group " . $group . "~~~:");
         foreach ($users[$group] as $u) {
             IO::out(" " . $u);
         }
     } else {
         foreach (array_keys($users) as $g) {
             IO::out("~WHITE~Group " . $g . "~~~:");
             foreach ($users[$g] as $u) {
                 IO::out(" " . $u);
             }
         }
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:23,代碼來源:CmdGroup.php

示例9: processException

 /**
  * Обработка исключений, возникающих в процессе работы консоли.
  *
  * @param Exception $e исключение для обработки
  */
 static function processException($e)
 {
     if ($e instanceof IOException) {
         IO::out('IO error : ' . $e->getMessage(), IO::MESSAGE_FAIL);
     } else {
         IO::out($e, IO::MESSAGE_FAIL);
     }
     exit(254);
 }
開發者ID:point,項目名稱:cassea,代碼行數:14,代碼來源:Console.php

示例10: 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);
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:19,代碼來源:CmdController.php

示例11: createTar

 public function createTar($root, $name, $separate = null)
 {
     if (file_exists($root . '/' . $name . "_" . date('Ymd') . ".tar.bz2")) {
         $filename = $name . "_" . date('Ymd_H_i_s') . '.tar';
     } else {
         $filename = $name . "_" . date('Ymd') . '.tar';
     }
     //$cmd="tar -cvf ".$root."/".$filename." ".$root." --exclude='*web*' --exclude='*~'";
     chdir($root);
     IO::out('Packing main... ' . "\t", false);
     if ($this->all) {
         $cmd = "tar --exclude='.svn' --exclude='*~' -cvf " . $root . "/" . $filename . " * 2>&1";
     } else {
         $cmd = "tar --exclude='web' --exclude='.svn' --exclude='*~' -cvf " . $root . "/" . $filename . " * 2>&1";
     }
     exec($cmd, $out, $return);
     if ($return == 0) {
         io::done();
     }
     if (IO::getVerboseLevel() == IO::MESSAGE_INFO || $return) {
         foreach ($out as $o) {
             io::out($o);
         }
     }
     if ($return) {
         io::out('Return code ' . $return, IO::MESSAGE_FAIL);
         io::out('Executed command: ' . $cmd);
         return;
     }
     if (!$this->all) {
         $cmd = "tar --exclude='*~'  --exclude='.svn'  -uvf " . $root . "/" . $filename . " ./web/css/ ./web/js/  2>&1";
         io::out('Adding web/css, web/js...', false);
         exec($cmd, $out, $return);
         if ($return == 0 && !$this->all) {
             io::done();
         }
         if (IO::getVerboseLevel() == IO::MESSAGE_INFO || $return) {
             foreach ($out as $o) {
                 io::out($o);
             }
         }
         if ($return) {
             io::out('Return code ' . $return, IO::MESSAGE_FAIL);
             io::out('Executed command: ' . $cmd);
             return;
         }
     }
     io::out('Bzip ' . $filename . '...', false);
     $cmd = "bzip2 -9 " . $root . "/" . $filename;
     exec($cmd, $out, $return);
     if ($return == 0) {
         io::done();
     }
     if (IO::getVerboseLevel() == IO::MESSAGE_INFO || $return) {
         foreach ($out as $o) {
             io::out($o);
         }
     }
     if ($return) {
         io::out('Return code ' . $return, IO::MESSAGE_FAIL);
         io::out('Executed command: ' . $cmd);
         return;
     }
     return $filename . ".bz2";
 }
開發者ID:point,項目名稱:cassea,代碼行數:65,代碼來源:CmdBackup.php

示例12: processException

 /**
  * Oбработка исключений возникших при работе комманды
  */
 static function processException($e, $cmdName = '')
 {
     IO::out('Command Exception ~WHITE~' . $cmdName . '~~~', IO::MESSAGE_FAIL);
     return Console::processException($e);
 }
開發者ID:point,項目名稱:cassea,代碼行數:8,代碼來源:Command.php

示例13: cmdUnlock

 /**
  * Снимает блокировку системы.
  *
  */
 function cmdUnlock()
 {
     IO::out('Unlocking Package Manager', false);
     if (PackageManager::get()->unlock(true)) {
         io::done();
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:11,代碼來源:PackageManagerFacade.php

示例14: cmdPassword

 public function cmdPassword()
 {
     try {
         $login = ArgsHolder::get()->shiftCommand();
         $password = ArgsHolder::get()->shiftCommand();
         if ($login === false) {
             return io::out('Incorrect param count', IO::MESSAGE_FAIL) | 1;
         }
         if ($user = User::findBy("login", $login)) {
             if (!$password) {
                 IO::out('New password: ', false);
                 $password = IO::in(IO::TYPE_STRING);
                 IO::out('Confirm New password: ', false);
                 $p2 = IO::in(IO::TYPE_STRING);
                 if ($password != $p2) {
                     return io::out('Passwords not match.', IO::MESSAGE_FAIL) | 2;
                 }
             }
             $user->setPassword($password);
         } else {
             return io::out(PHP_EOL . 'User ~WHITE~' . $login . '~~~ not found', IO::MESSAGE_FAIL) | 3;
         }
     } catch (UserException $e) {
         return io::out($e->getMessage(), IO::MESSAGE_FAIL) | 127;
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:26,代碼來源:CmdUser.php

示例15: 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);
         }
     }
 }
開發者ID:point,項目名稱:cassea,代碼行數:36,代碼來源:PackageManager.php


注:本文中的IO::out方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。