/** * Process the system event * * @return bool */ public function process() { try { $project_id = (int) $this->getRequiredParameter(0); if ($this->system_event_manager->isProjectReindexationAlreadyQueued($project_id)) { $this->done('Skipped duplicate event'); $this->logger->debug("Skipped duplicate event for project {$project_id} : " . self::NAME); return true; } $item_factory = Docman_ItemFactory::instance($project_id); $items = new Docman_ProjectItemsBatchIterator($item_factory, $project_id); $notindexed_collector = new FullTextSearch_NotIndexedCollector(); $this->actions->reIndexProjectDocuments($items, $project_id, $notindexed_collector); if (!$notindexed_collector->isAtLeastOneIndexed()) { $this->error('Nothing has been indexed. See syslog for details.'); return false; } else { if ($notindexed_collector->isAtLeastOneNotIndexed()) { $this->warning('Some items were not indexed: [' . implode(', ', $notindexed_collector->getIds()) . ']. See syslog for details.'); } else { $this->done(); } } return true; } catch (Exception $e) { $this->error($e->getMessage()); } return false; }
/** * * @param WikiPage $wiki_page */ public function updatePermissions(WikiPage $wiki_page) { $this->logger->debug('[Wiki] ElasticSearch: update permissions of wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId()); $update_data = array(); $this->request_data_factory->setUpdatedData($update_data, 'permissions', $this->request_data_factory->getCurrentPermissions($wiki_page)); $this->indexOrUpdate($wiki_page->getGid(), $wiki_page->getId(), $update_data); }
/** * Process the system event * * @return bool */ public function process() { try { $project_id = (int) $this->getRequiredParameter(0); if ($this->system_event_manager->isProjectReindexationAlreadyQueued($project_id)) { $this->done('Skipped duplicate event'); $this->logger->debug("Skipped duplicate event for project {$project_id} : " . self::NAME); return true; } $this->actions->reIndexProjectWikiPages($project_id); $this->done(); return true; } catch (Exception $e) { $this->error($e->getMessage()); } return false; }
public function itSkipsDebugInfoAndWarnWhenLevelIsWarn() { $truncate_logger = new TruncateLevelLogger($this->logger, Logger::ERROR); expect($this->logger)->debug()->never(); expect($this->logger)->info()->never(); expect($this->logger)->warn()->never(); expect($this->logger)->error("error message", '*')->once(); $truncate_logger->debug("debug message"); $truncate_logger->info("info message"); $truncate_logger->warn("warn message"); $truncate_logger->error("error message"); }