当前位置: 首页>>代码示例>>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 (($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

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

示例4: CmdList

 function CmdList()
 {
     io::out('~WHITE~Current env~~~: ' . ($env = EnvManager::getCurrent()));
     io::out();
     IO::OUt('~WHITE~Avaible enviroments:~~~');
     foreach (EnvManager::envList() as $e) {
         if ($e != $env) {
             io::out('    ' . $e);
         }
     }
 }
开发者ID:point,项目名称:cassea,代码行数:11,代码来源:CmdEnv.php

示例5: 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');
     }
 }
开发者ID:point,项目名称:cassea,代码行数:13,代码来源:CmdBgworkDelete.php

示例6: delete

 function delete($what)
 {
     io::out('Deleting: ');
     foreach ($what as $t) {
         echo $t;
         if (file_exists($t)) {
             if (is_dir($t)) {
                 $t = new Dir($t, true);
             } else {
                 $t = new File($t, true);
             }
             $r = $t->delete();
             io::done();
         } else {
             echo " Not found.";
         }
         echo PHP_EOL;
     }
 }
开发者ID:point,项目名称:cassea,代码行数:19,代码来源:RollBack.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: process

 function process()
 {
     $root = Config::get('ROOT_DIR');
     if (($src = ArgsHolder::get()->shiftCommand()) === false || ($new = ArgsHolder::get()->shiftCommand()) === false) {
         return io::out('Incorrect param count', IO::MESSAGE_FAIL) | 1;
     }
     $src_file = $root . '/includes/env/' . strtolower($src) . '_env.php';
     $new_file = $root . '/includes/env/' . strtolower($new) . '_env.php';
     if (file_exists($new_file)) {
         return io::out('Enviroments ~WHITE~' . $new . '~~~ already exists!', IO::MESSAGE_FAIL) | 2;
     }
     if (!file_exists($src_file)) {
         return io::out('Source enviroments ~WHITE~' . $src . '~~~ is not exists!', IO::MESSAGE_FAIL) | 2;
     }
     io::out('Writing files', false);
     if (!copy($src_file, $new_file)) {
         return io::out('Unable copy env files (' . $src_file . ' to ' . $new_file . ')', IO::MESSAGE_FAIL) | 3;
     }
     $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 .= '[' . $new . ': base ]' . PHP_EOL . $match[0] . PHP_EOL;
         } else {
             $str .= $fa;
         }
     }
     $config = fopen($root . '/config/config.ini', 'w');
     flock($config, LOCK_EX);
     $r = fwrite($config, $str);
     flock($config, LOCK_UN);
     fclose($config);
     if (!$r) {
         return io::out('Cant write ~WHITE~config.ini~~~', IO::MESSAGE_FAIL) | 4;
     }
     io::done();
 }
开发者ID:point,项目名称:cassea,代码行数:37,代码来源:CmdClone.php

示例10: infoByExt

 private function infoByExt($ext)
 {
     $info = $this->extInfo();
     if (isset($info[$ext])) {
         $extinfo = $info[$ext];
         io::out('');
         io::out('~WHITE~Information about extension ' . $ext . ":~~~");
         foreach ($extinfo as $ei) {
             foreach ($ei as $k => $v) {
                 if (is_array($v)) {
                     array_pop($v);
                     foreach ($v as $kk => $vv) {
                         io::out(sprintf("%-40s %s", $k, "~CYAN~" . $vv . "~~~"));
                     }
                 } else {
                     io::out(sprintf("%-40s %s", $k, "~CYAN~" . $v . "~~~"));
                 }
             }
         }
         io::out('');
     } else {
         io::out('No such extension  ' . $ext, IO::MESSAGE_FAIL);
     }
 }
开发者ID:point,项目名称:cassea,代码行数:24,代码来源:CmdPhpInfo.php

示例11: cmdHelp

 /**
  * Встроенная комманда help реализует отображение справочной информации.
  *
  * Если передедан необязательный параметр $command отображается справка
  * подкомманды.
  * 
  * @param string $command 
  * @return int 0
  */
 protected function cmdHelp($command = null)
 {
     $help = $this->parseHelpFile();
     $subCommands = is_null($command) ? $this->getCommands() : array();
     if (!is_null($command)) {
         $help = $help['inclass'][$command];
     }
     IO::out($help['short']);
     if (!empty($help['main'])) {
         IO::out($help['main']);
     }
     $list = array();
     foreach ($subCommands as $subCmd) {
         $i = $this->getCommandInfo($subCmd);
         $list[$subCmd] = trim($i['help']['short']);
     }
     if (isset($help['inclass']) && count($help['inclass'])) {
         foreach ($help['inclass'] as $inCmd => $v) {
             $list[$inCmd] = trim($v['short']);
         }
     }
     if (count($list)) {
         ksort($list, SORT_STRING);
         IO::out("~WHITE~Commands~~~:");
         IO::outOptions($list);
         IO::out();
     }
     // Command Options
     if (isset($help['options']) && count($help['options'])) {
         io::out('~WHITE~Options~~~:');
         io::outOptions($help['options']);
         io::out();
     }
     // Common IO Help
     IO::out(IO::help());
     return 0;
 }
开发者ID:point,项目名称:cassea,代码行数:46,代码来源:Command.php

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

示例13: undeploy

 static function undeploy($dir)
 {
     $f = $dir->getFile('queries.sql');
     // файла нет или он пустой
     if (!$f->canRead() || ($queries = file_get_contents($f)) === false) {
         return;
     }
     io::out("\t" . '[~PURPLE~Q~~~] ' . basename($f->getParent()) . '/' . basename($f) . '~~~', false);
     SqlTask::execQuery($queries);
     io::done();
 }
开发者ID:point,项目名称:cassea,代码行数:11,代码来源:SqlTask.php

示例14: process

 function process()
 {
     $root = Config::get('ROOT_DIR');
     $file_array = file_get_contents($root . '/config/config.ini');
     try {
         //Look for php-cgi in the system
         $php_path = exec("which php-cgi");
         if (empty($php_path) || !is_executable($php_path)) {
             IO::out('Look for PHP-CGI in the system.', IO::MESSAGE_FAIL);
             IO::out("You can't to check hosting because PHP-CGI not found.");
             return;
         }
         $out = exec("echo \"<?php echo 'php-cgi test' ?>\" | {$php_path} -q ");
         if ($out != "php-cgi test") {
             IO::out('Look for PHP-CGI in the system.', IO::MESSAGE_FAIL);
             IO::out("You can't to check hosting because PHP-CGI not found.");
             return;
         }
         IO::out('Look for PHP-CGI in the system.', IO::MESSAGE_OK);
         $toini = array();
         foreach ($this->for_check as $k => $v) {
             $output = array();
             $subcmd = '<?php $r=ini_get("' . $k . '");if($r) echo $r; else echo ((int)$r);';
             exec("echo '" . $subcmd . "' | {$php_path} -q", $output);
             if ($k == 'error_log') {
                 IO::out($k . ' = ' . $output[0], IO::MESSAGE_OK);
                 continue;
             }
             if ($k == 'error_log' || $k == 'max_execution_time' || $k == 'max_input_time' || $k == 'upload_max_filesize' || $k == 'memory_limit' || $k == 'post_max_size') {
                 $ch = str_replace('m', '', strtolower($output[0]));
                 if ((int) $ch >= (int) $v) {
                     IO::out($k . ' = ' . $output[0], IO::MESSAGE_OK);
                     continue;
                 } else {
                     io::out($k . ' = ' . $output[0] . ' this must be >=' . $v, IO::MESSAGE_FAIL);
                     continue;
                 }
             }
             if ($v == $output[0]) {
                 IO::out($k . ' = ' . $output[0], IO::MESSAGE_OK);
             } else {
                 $out = array();
                 $subcmd = '<?php ini_set("' . $k . '","' . $v . '");$r=ini_get("' . $k . '");if($r=="' . $v . '") echo 111; else echo print_r($r);';
                 exec("echo '" . $subcmd . "' | {$php_path} -q", $out);
                 if ($out[0] == 111) {
                     $toini[$k] = $v;
                     IO::out($k . ' = ' . $output[0] . ', but you can set "' . $v . '"', IO::MESSAGE_WARN);
                 } else {
                     io::out($k . ' = ' . $output[0], IO::MESSAGE_FAIL);
                 }
             }
         }
         $output = array();
         $subcmd = '<?php $r=ini_get("upload_max_filesize");if($r) echo $r; else echo ((int)$r);';
         exec("echo '" . $subcmd . "' | {$php_path} -q", $output);
         $umf = str_replace('m', '', strtolower($output[0]));
         $output = array();
         $subcmd = '<?php $r=ini_get("post_max_size");if($r) echo $r; else echo ((int)$r);';
         exec("echo '" . $subcmd . "' | {$php_path} -q", $output);
         $pms = str_replace('m', '', strtolower($output[0]));
         $output = array();
         $subcmd = '<?php $r=ini_get("memory_limit");if($r) echo $r; else echo ((int)$r);';
         exec("echo '" . $subcmd . "' | {$php_path} -q", $output);
         $ml = str_replace('m', '', strtolower($output[0]));
         if ((int) $pms < (int) $umf) {
             IO::out('post_max_size < upload_max_filesize', IO::MESSAGE_FAIL);
         }
         if ((int) $pms > (int) $ml) {
             IO::out('post_max_size > memory_limit', IO::MESSAGE_FAIL);
         }
         if ((int) $pms >= (int) $umf && (int) $pms < (int) $ml) {
             IO::out('upload_max_filesize(' . $umf . ')=< ini.post_max_size(' . $pms . ') < ini.memory_limit(' . $ml . ')', IO::MESSAGE_OK);
         }
         if (is_writable('/tmp')) {
             IO::out('Temp dir is writable.', IO::MESSAGE_OK);
         } else {
             IO::out('Temp dir is not writable!', IO::MESSAGE_FAIL);
         }
         IO::out();
         IO::out('Check for extensions:');
         exec("{$php_path} -m", $output);
         foreach ($this->ext as $e) {
             if ($e == 'gd') {
                 if (!in_array($e, $output)) {
                     if (!in_array('imagick', $output)) {
                         io::out('Extension ' . $e . ' or imagick are not loaded.', IO::MESSAGE_FAIL);
                     } else {
                         io::out('Extension imagick is loaded.', IO::MESSAGE_OK);
                     }
                 } else {
                     io::out('Extension ' . $e . ' is loaded.', IO::MESSAGE_OK);
                 }
                 continue;
             }
             if (!in_array($e, $output)) {
                 io::out('Extension ' . $e . ' is not loaded.', IO::MESSAGE_FAIL);
             } else {
                 if ($e == 'apc') {
                     io::out('Extension ' . $e . ' is loaded.You can set "apc.enabled=On" in php.ini.', IO::MESSAGE_OK);
                     continue;
//.........这里部分代码省略.........
开发者ID:point,项目名称:cassea,代码行数:101,代码来源:CmdCheck.php

示例15: cmdUninstall

 /**
  * Удаление указанного пакета
  */
 function cmdUninstall()
 {
     if (($nvr = ArgsHolder::get()->shiftCommand(false)) == false) {
         return IO::out('Specify package file', IO::MESSAGE_FAIL) | 1;
     }
     try {
         PackageManager::get()->startup();
         PackageManager::uninstall(trim($nvr, '\'"'));
         PackageManager::get()->shutdown();
     } catch (Exception $e) {
         PackageManager::getRollback()->stepBack();
         return io::out($e->getMessage(), IO::MESSAGE_FAIL) | (is_null($e->getCode()) ? 2 : $e->getCode());
     }
 }
开发者ID:point,项目名称:cassea,代码行数:17,代码来源:PackageManagerFacade.php


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