Esempio n. 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->tryExclusiveLock()) {
         FileRecord::whereRaw('RIGHT(client_name, 4) NOT IN (".png", ".jpg", "jpeg", "webm", ".gif")')->chunk(100, function ($files) {
             foreach ($files as $file) {
                 if (empty($file->hash)) {
                     continue;
                 }
                 try {
                     $this->scanFile($file);
                 } catch (RateLimitException $exception) {
                     $this->error('Rate limit hit');
                     sleep(60);
                 } catch (\Exception $exception) {
                     $this->error($exception);
                 }
             }
         });
     }
 }