예제 #1
0
 public function enqueue()
 {
     # Ignore duplicate URLs across users, but duplicate URLs for the same user aren't allowed.
     # If that happens, just update the tags.
     foreach ($this->params()->files as $url) {
         $tags = !empty($this->params()->post['tags']) ? $this->params()->post['tags'] : '';
         $tags = explode(' ', $tags);
         if ($this->params()->post['rating']) {
             # Add this to the beginning, so any rating: metatags in the tags will
             # override it.
             $tags = array_merge(["rating:" . $this->params()->post['rating']], $tags);
         }
         $tags[] = "hold";
         $tags = implode(' ', array_unique($tags));
         $b = BatchUpload::where(['user_id' => $this->current_user->id, 'url' => $url])->firstOrInitialize();
         $b->tags = $tags;
         $b->ip = $this->request()->remoteIp();
         $b->save();
     }
     $this->notice(sprintf("Queued %i files", count($this->params()->files)));
     $this->redirectTo("#index");
 }
예제 #2
0
파일: JobTask.php 프로젝트: JCQS04/myimouto
 public function execute_upload_batch_posts()
 {
     $upload = BatchUpload::where("status = 'pending'")->order("id ASC")->first();
     if (!$upload) {
         return;
     }
     $this->updateAttributes(['data' => ['id' => $upload->id, 'user_id' => $upload->user_id, 'url' => $upload->url]]);
     $upload->run();
 }