/** * @test */ public function doBenchmark() { $dataset = $this->benchmarkRunner->getDefaultDataset(); $datasetFixture = Title::newFromText('Lorem ipsum'); $this->benchmarkRunner->addMessage("\n" . '=========================================================================================='); $this->benchmarkRunner->addMessage('JobQueue benchmarks'); $this->benchmarkRunner->addMessage('------------------------------------------------------------------------------------------'); $this->benchmarkRunner->addMessage("- Dataset: " . $dataset); $this->benchmarkRunner->addMessage("- MediaWiki: " . $this->benchmarkRunner->getMediaWikiVersion()); $this->benchmarkRunner->addMessage("- Store: " . $this->benchmarkRunner->getQueryEngine()); $this->benchmarkRunner->addMessage("- ShowMemoryUsage: " . var_export($this->showMemoryUsage, true)); $this->benchmarkRunner->addMessage("- ReuseDatasets: " . var_export($this->reuseDatasets, true)); $this->benchmarkRunner->addMessage("- PageCopyThreshold: " . $this->pageCopyThreshold); $this->benchmarkRunner->addMessage("- RepetitionExecutionThreshold: " . $this->repetitionExecutionThreshold); $this->benchmarkRunner->addMessage('------------------------------------------------------------------------------------------'); if (!$this->reuseDatasets) { $this->benchmarkRunner->addMessage("\n" . 'Data preparation benchmarks'); $this->benchmarkRunner->doImportDataset($dataset); $this->benchmarkRunner->copyPageContent($datasetFixture, $this->pageCopyThreshold); } $this->assertTrue($datasetFixture->exists()); $refreshJob = new RefreshJob(Title::newFromText(__METHOD__)); $refreshJob->insert(); $this->createJobQueueBenchmarks('SMW\\RefreshJob'); $this->createJobQueueBenchmarks('SMW\\UpdateJob'); $this->benchmarkRunner->addMessage('=========================================================================================='); $this->benchmarkRunner->printMessages(); }
protected function doRefreshStore($refreshjob) { if ($GLOBALS['smwgAdminRefreshStore']) { $sure = $GLOBALS['wgRequest']->getText('rfsure'); $title = SpecialPage::getTitleFor('SMWAdmin'); if ($sure == 'yes') { if (is_null($refreshjob)) { // careful, there might be race conditions here $newjob = new RefreshJob($title, array('spos' => 1, 'prog' => 0, 'rc' => 2)); $newjob->insert(); // @codingStandardsIgnoreStart phpcs, ignore --sniffs=Generic.Files.LineLength.MaxExceeded $this->getOutput()->addHTML('<p>' . wfMessage('smw_smwadmin_updatestarted', '<a href="' . htmlspecialchars($title->getFullURL()) . '">Special:SMWAdmin</a>')->text() . '</p>'); // @codingStandardsIgnoreEnd } else { // @codingStandardsIgnoreStart phpcs, ignore --sniffs=Generic.Files.LineLength.MaxExceeded $this->getOutput()->addHTML('<p>' . wfMessage('smw_smwadmin_updatenotstarted', '<a href="' . htmlspecialchars($title->getFullURL()) . '">Special:SMWAdmin</a>')->text() . '</p>'); // @codingStandardsIgnoreEnd } } elseif ($sure == 'stop') { // FIXME See above comments !! $dbw = wfGetDB(DB_MASTER); // delete (all) existing iteration jobs $dbw->delete('job', array('job_cmd' => 'SMW\\RefreshJob'), __METHOD__); // @codingStandardsIgnoreStart phpcs, ignore --sniffs=Generic.Files.LineLength.MaxExceeded $this->getOutput()->addHTML('<p>' . wfMessage('smw_smwadmin_updatestopped', '<a href="' . htmlspecialchars($title->getFullURL()) . '">Special:SMWAdmin</a>')->text() . '</p>'); // @codingStandardsIgnoreEnd } else { // @codingStandardsIgnoreStart phpcs, ignore --sniffs=Generic.Files.LineLength.MaxExceeded $this->getOutput()->addHTML('<p>' . wfMessage('smw_smwadmin_updatenotstopped', '<a href="' . htmlspecialchars($title->getFullURL()) . '">Special:SMWAdmin</a>')->text() . '</p>'); // @codingStandardsIgnoreEnd } } }