Example #1
0
 /**
  * Process the index queue
  *
  * @museDescription  Processes the index queue
  *
  * @return  void
  **/
 public function processQueue()
 {
     require_once PATH_CORE . DS . 'components' . DS . 'com_search' . DS . 'models' . DS . 'indexqueue.php';
     require_once PATH_CORE . DS . 'components' . DS . 'com_search' . DS . 'models' . DS . 'blacklist.php';
     // Get the type needed to be indexed;
     $items = \Components\Search\Models\QueueDB::all()->where('status', '=', 0)->limit(100)->rows();
     // Refresh indexed material if no work to do
     if ($items->count() <= 0) {
         $items = \Components\Search\Models\QueueDB::all()->where('status', '=', 1)->where('action', '=', 'index')->order('modified', 'ASC')->limit(100)->rows();
     }
     // Get the blacklist
     $sql = "SELECT doc_id FROM #__search_blacklist;";
     $db = App::get('db');
     $db->setQuery($sql);
     $blacklist = $db->query()->loadColumn();
     foreach ($items as $item) {
         $format = Event::trigger('search.onIndex', array($item->type, $item->type_id, true));
         if (isset($format[0])) {
             $this->processRows($format[0], $item->action, $blacklist);
             $timestamp = \Hubzero\Utility\Date::of()->toSql();
             $item->set('modified', $timestamp);
             $item->set('status', 1);
         } else {
             $item->set('status', '2');
         }
         $item->save();
     }
 }
Example #2
0
 /**
  * Return a formatted timestamp
  *
  * @param   string  $as  What format to return
  * @return  string
  */
 public function expires($as = '')
 {
     $as = strtolower($as);
     if ($as == 'date') {
         return Date::of($this->get('expires'))->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
     }
     if ($as == 'time') {
         return Date::of($this->get('expires'))->toLocal(Lang::txt('TIME_FORMAT_HZ1'));
     }
     if ($as) {
         return Date::of($this->get('expires'))->toLocal($as);
     }
     return $this->get('expires');
 }
Example #3
0
 /**
  * Month 
  * 
  * @param string $date 
  * @param mixed $row 
  * @access private
  * @return void
  */
 private function Month($date = '', $row)
 {
     $date = $row->{$date};
     $month = Date::of(strtotime($date))->toLocal('m');
     return $month;
 }