/** * Process the system event * * @return bool */ public function process() { try { $project_id = (int) $this->getRequiredParameter(0); $this->actions->reIndexProjectWikiPages($project_id); $this->done(); return true; } catch (Exception $e) { $this->error($e->getMessage()); } return false; }
/** * 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 itReindexAllTheWikiPagesForAGivenProject() { $wiki_page_1 = stub('WikiPage')->getId()->returns(101); $wiki_page_2 = stub('WikiPage')->getId()->returns(102); stub($wiki_page_1)->getGid()->returns(200); stub($wiki_page_2)->getGid()->returns(200); stub($this->actions)->getAllIndexablePagesForProject(200)->returns(array($wiki_page_1, $wiki_page_2)); expect($this->client)->getIndexedtype(200)->once(); expect($this->client)->deleteType(200)->once(); expect($this->client)->index(200, 101, '*')->at(0); expect($this->client)->index(200, 102, '*')->at(1); $this->actions->reIndexProjectWikiPages(200); }