Example #1
0
 public function rename($job, $data)
 {
     $force = @$data['force'];
     $id = @$data['id'];
     $username = $data['username'];
     $user = User::find($id);
     if ($user) {
         $user->username_previous = $user->username;
         $user->username = $username;
         $user->username_clean = preg_replace('/[^a-z0-9]/', '_', strtolower($username));
         $user->save();
         DB::statement('call user_rename(?)', [$user->user_id]);
     } else {
         sentry_log("failed to rename a user ({$id}; job: {$job->getJobId()}; to: {$username})", 'queue', Raven_Client::FATAL);
     }
     $job->delete();
 }
Example #2
0
 public function fire($job, $data)
 {
     $subject = @$data['subject'];
     $view = $data['view'];
     $to = @$data['to'];
     $vars = @$data['data'] ?: [];
     if ($subject and $view and $to) {
         Mail::send($view, $vars, function ($message) {
             $message->subject($subject);
             $message->to($to);
         });
     } else {
         sentry_log("Job Failed: SendEmail (to: {$to}; subject: {$subject}; view: {$view})", 'queue', Raven_Client::FATAL);
     }
     // remove the job from the queue
     $job->delete();
 }
Example #3
0
 public function rename($job, $data)
 {
     $force = @$data["force"];
     $id = @$data["id"];
     $username = $data["username"];
     $user = User::find($id);
     if ($user) {
         $user->username_previous = $user->username;
         $user->username = $username;
         $user->username_clean = preg_replace("/[^a-z0-9]/", "_", strtolower($username));
         $user->save();
         DB::statement("call user_rename(?)", [$user->user_id]);
     } else {
         sentry_log("failed to rename a user ({$id}; job: {$job->getJobId()}; to: {$username})", "queue", Raven_Client::FATAL);
     }
     $job->delete();
 }
Example #4
0
 protected function set($job, $data, $ident, $callback)
 {
     $id = @$data['id'];
     $set = Beatmapset::find($id);
     if (!$set) {
         sentry_log("[{$ident}] Set not found while trying to {$ident}: {$id}", 'queue', Raven_Client::FATAL);
         $job->delete();
         return;
     }
     $callback($job, $data, $set);
 }
Example #5
0
 public function anyGitCallback()
 {
     if (Auth::check() and Auth::user()->user_id === User::GITHUB) {
         if (Input::get('ref') == 'refs/heads/master') {
             Artisan::call('git:pull', ['--silent']);
         }
     } else {
         sentry_log('user attempting to access git callback', 'fatal', Raven_Client::FATAL);
         return Response::json(['error' => 'no']);
     }
 }
Example #6
0
 public function anyGitCallback()
 {
     if (Auth::check() and Auth::user()->user_id === User::GITHUB) {
         if (Input::get("ref") == "refs/heads/master") {
             Artisan::call("git:pull", ["--silent"]);
         }
     } else {
         sentry_log("user attempting to access git callback", "fatal", Raven_Client::FATAL);
         return Response::json(["error" => "no"]);
     }
 }