Example #1
0
 public function mainAction()
 {
     Output::stdout('Init search Indexer');
     $search = new Indexer();
     $search->indexAll();
     Output::stdout('Phanbook search successfully');
 }
 /**
  * Convert
  *
  * @param array $params
  */
 public function mainAction($params = array())
 {
     Output::stdout('Main Action');
     TagsSeeder::run();
     UsersSeeder::run();
     PostsSeeder::run();
     PostsTagsSeeder::run();
     Output::stdout('Completed');
 }
Example #3
0
 /**
  * The task updated core Phanbook
  *
  * @return mixed
  */
 public function mainAction()
 {
     Output::stdout('======================================================');
     Output::stdout('Loading phanbook repositories with package information');
     Output::stdout('Call function ZFunction::gitUpdate()');
     ZFunction::gitUpdate();
     Output::stdout('Phanbook upgraded successfully');
     Output::stdout('======================================================');
 }
Example #4
0
 public function mainAction()
 {
     Output::stdout('Send email for post reply');
     $spool = new SendSpool();
     try {
         var_dump($spool->sendRemaining());
     } catch (Exception $e) {
         echo $e->getMessage(), PHP_EOL;
         echo $e->getTraceAsString();
     }
 }
 public function mainAction()
 {
     Output::stdout('Send digest email');
     $spool = new Digest();
     try {
         var_dump($spool->send());
     } catch (Exception $e) {
         Output::stdout($e->getMessage());
         Output::stdout($e->getTraceAsString());
     }
 }
Example #6
0
 /**
  * The task exports database Phanbook
  *
  * {cmd}
  *    php cli Exports
  * {/cmd}
  *
  * @return mixed
  */
 public function mainAction()
 {
     Output::stdout('======================================================');
     Output::stdout('Starting exports your database');
     $mysql = $this->config->database->mysql;
     $host = $mysql->host;
     $database = $mysql->dbname;
     $username = $mysql->username;
     $password = $mysql->password;
     $name = $database . date('Y-m-d-H:i:s');
     $cmd = "mysqldump -u {$username} --password={$password} --host={$host} {$database} > {$name}.sql";
     shell_exec($cmd);
     Output::stdout('Phanbook exports your database successfully');
     Output::stdout('======================================================');
 }
Example #7
0
 /**
  * handle script ending exception.
  *
  * @param Exception that caused the failure
  * @param id of the task you started
  * @param exit code status of the process
  */
 protected function handleException(\Exception $e, $taskId, $exit)
 {
     $sub = '%s[ERROR]%s %s file: %s line: %d';
     // Remove Process Instance
     if ($e->getCode() != self::ERROR_SINGLE) {
         $this->removeProcessInstance();
     }
     // Update Failure
     if ($this->_isRecording && $taskId > 0) {
         $stdout = Output::getStdout();
         $stderr = Output::getStderr();
         //  Update Task w/ error messages
         $task = new \Models\Task();
         $task->updateFailed($taskId, $stdout, $stderr, $exit);
     }
     $msg = sprintf($sub, Output::COLOR_RED, Output::COLOR_NONE, $e->getMessage(), $e->getFile(), $e->getLine());
     // Let user that ran this know it failed
     Output::stderr($msg);
 }
Example #8
0
 public function test2Action($paramArray)
 {
     Output::stdout("First param: {$paramArray['0']}");
     Output::stdout("Second param: {$paramArray['1']}");
 }