/**
  * Send to slack the results of a scheduled command.
  *
  * @todo: add success tag to adjust the color
  * @param  Event $event
  * @return $this|void
  */
 public function scheduledCommand(Event $event)
 {
     $eventCommand = explode("'artisan' ", $event->command)[1];
     $event->sendOutputTo(base_path() . '/storage/logs/' . $eventCommand . '.txt');
     if (is_null($event->output)) {
         //if no output, don't send anything
         return;
     }
     return $event->then(function () use($event, $eventCommand) {
         $message = file_get_contents($event->output);
         Artisan::call('slack:post', ['to' => $this->channel_scheduled_command, 'attach' => ['color' => 'grey', 'title' => $eventCommand, 'text' => $message]]);
     });
 }
 /**
  * Send to slack the results of a scheduled command.
  *
  * @todo: add success tag to adjust the color
  *
  * @param  Event $event
  * @param        $channel
  *
  * @return void
  */
 public static function output(Event $event, $channel)
 {
     preg_match("/(artisan |'artisan' )(.*)/us", $event->command, $matches);
     $eventCommand = $matches[2];
     $event->sendOutputTo(base_path() . '/storage/logs/' . $eventCommand . '.txt');
     if (is_null($event->output)) {
         //if no output, don't send anything
         return;
     }
     $event->then(function () use($event, $eventCommand, $channel) {
         $message = file_get_contents($event->output);
         Artisan::call('slack:post', ['to' => $channel, 'attach' => ['color' => 'grey', 'title' => $eventCommand, 'text' => $message]]);
     });
 }
Beispiel #3
0
 /**
  * Run the given event.
  *
  * @param  \Illuminate\Contracts\Container\Container  $container
  * @return mixed
  */
 public function run(Container $container)
 {
     if ($this->description) {
         touch($this->mutexPath());
     }
     $response = $container->call($this->callback, $this->parameters);
     @unlink($this->mutexPath());
     parent::callAfterCallbacks($container);
     return $response;
 }
Beispiel #4
0
 /**
  * Run the given event.
  *
  * @param \Illuminate\Contracts\Container\Container $container        	
  * @return mixed
  *
  * @throws \Exception
  */
 public function run(Container $container)
 {
     if ($this->description) {
         touch($this->mutexPath());
     }
     try {
         $response = $container->call($this->callback, $this->parameters);
     } finally {
         $this->removeMutex();
     }
     parent::callAfterCallbacks($container);
     return $response;
 }
 /**
  * Run the given event.
  *
  * @param  \Illuminate\Contracts\Container\Container  $container
  * @return mixed
  *
  * @throws \Exception
  */
 public function run(Container $container)
 {
     if ($this->description) {
         $this->cache->put($this->mutexName(), true, 1440);
     }
     try {
         $response = $container->call($this->callback, $this->parameters);
     } finally {
         $this->removeMutex();
     }
     parent::callAfterCallbacks($container);
     return $response;
 }
Beispiel #6
0
 /**
  * Run the given event.
  *
  * @param  \Illuminate\Contracts\Container\Container  $container
  * @return mixed
  */
 public function run(Container $container)
 {
     $response = $container->call($this->callback, $this->parameters);
     parent::callAfterCallbacks($container);
     return $response;
 }
Beispiel #7
0
 /**
  * Run the given event, then clear our lock.
  *
  * @param  \Illuminate\Contracts\Container\Container  $container
  * @return void
  */
 public function run(Container $container)
 {
     parent::run($container);
     $this->clearMultiserver();
 }