Beispiel #1
0
 /**
  * Process Notifications. Store the notifications object locally.
  *
  * @return bool
  */
 protected function taskProcessNotifications()
 {
     $cache = $this->grav['cache'];
     $data = $this->post;
     $notifications = json_decode($data['notifications']);
     try {
         $notifications = $this->admin->processNotifications($notifications);
     } catch (\Exception $e) {
         $this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
         return;
     }
     $show_immediately = false;
     if (!$cache->fetch('notifications_last_checked')) {
         $show_immediately = true;
     }
     $cache->save('notifications', $notifications);
     $cache->save('notifications_last_checked', time());
     $this->admin->json_response = ['status' => 'success', 'notifications' => $notifications, 'show_immediately' => $show_immediately];
     return true;
 }