public function indexAction() { if (!$this->model->getFeatureDisabled()) { $state = $this->model->getProcessingState(); $this->view->state = array('consistencycheck' => $state); if ($state == 'scheduled' || $state == 'completed') { $data = $this->model->readLogFile(); if (!is_null($data)) { $this->view->content = array('consistencycheck' => $data->getContent()); $this->view->contentLastModTime = array('consistencycheck' => $data->getModifiedDate()); } } if (is_null($state)) { $this->view->error = array('consistencycheck' => true); } } }
public function testReadLogfileWithNonEmptyFile() { $this->enableAsyncMode(); $finder = new Opus_DocumentFinder(); $finder->setServerState('published'); $numOfPublishedDocs = $finder->count(); $model = new Admin_Model_IndexMaintenance(); $model->createJob(); $this->runJobImmediately(); $logdata = $model->readLogFile(); $this->assertNotNull($logdata); $this->assertNotNull($logdata->getContent()); $this->assertNotNull($logdata->getModifiedDate()); $this->assertContains("checking {$numOfPublishedDocs} published documents for consistency.", $logdata->getContent(), "content of logfile:\n" . $logdata->getContent()); $this->assertContains('No inconsistency was detected.', $logdata->getContent()); $this->assertContains('Completed operation after ', $logdata->getContent()); }