/**
  * Cron action on contracts : alert depending of the config : on notice and expire
  *
  * @param $task for log, if NULL display (default NULL)
  **/
 static function cronPlanningRecall($task = NULL)
 {
     global $DB, $CFG_GLPI;
     if (!$CFG_GLPI["use_mailing"]) {
         return 0;
     }
     $cron_status = 0;
     $query = "SELECT `glpi_planningrecalls`.*\n                      FROM `glpi_planningrecalls`\n                      LEFT JOIN `glpi_alerts`\n                           ON (`glpi_planningrecalls`.`id` = `glpi_alerts`.`items_id`\n                               AND `glpi_alerts`.`itemtype` = 'PlanningRecall'\n                               AND `glpi_alerts`.`type`='" . Alert::ACTION . "')\n                      WHERE `glpi_planningrecalls`.`when` IS NOT NULL\n                            AND `glpi_planningrecalls`.`when` < NOW()\n                            AND `glpi_alerts`.`date` IS NULL";
     $pr = new self();
     foreach ($DB->request($query) as $data) {
         if ($pr->getFromDB($data['id']) && $pr->getItem()) {
             if (NotificationEvent::raiseEvent('planningrecall', $pr)) {
                 $cron_status = 1;
                 $task->addVolume(1);
                 $alert = new Alert();
                 $input["itemtype"] = __CLASS__;
                 $input["type"] = Alert::ACTION;
                 $input["items_id"] = $data['id'];
                 $alert->add($input);
             }
         } else {
             // Clean item
             $pr->delete($data);
         }
     }
     return $cron_status;
 }
Example #2
0
 /**
  * Retrieves a file information
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function getFile($uri)
 {
     static $items = array();
     $file = $uri;
     if (!is_object($uri)) {
         // Get the place based on the uri
         $place = self::getPlace($uri);
         $type = self::getSourceType($place->id);
         $mediaManager = new self($type);
         // Get the file information
         $file = $mediaManager->getItem($uri);
     }
     return $file;
 }
Example #3
0
 public function getHandleTtl($key)
 {
     $keyObj = new self($this->sm);
     $ttls = unserialize($keyObj->getItem('key-ttl'));
     return $ttls[$key];
 }