public function testDoRefreshOn_Stop() { $jobQueueLookup = $this->getMockBuilder('\\SMW\\MediaWiki\\JobQueueLookup')->disableOriginalConstructor()->getMock(); $this->testEnvironment->registerObject('JobQueueLookup', $jobQueueLookup); $webRequest = $this->getMockBuilder('\\WebRequest')->disableOriginalConstructor()->getMock(); $webRequest->expects($this->atLeastOnce())->method('getText')->will($this->returnValue('stop')); $this->connection->expects($this->atLeastOnce())->method('delete'); $instance = new DataRepairSection($this->connection, $this->htmlFormRenderer, $this->outputFormatter); $instance->enabledRefreshStore(true); $instance->doRefresh($webRequest); }
/** * @see SpecialPage::execute */ public function execute($query) { if (!$this->userCanExecute($this->getUser())) { // $this->mRestriction is private MW 1.23- throw new ExtendedPermissionsError('smw-admin', array('smw-smwadmin-permission-missing')); } $output = $this->getOutput(); $output->setPageTitle(Message::get('smwadmin', Message::TEXT, Message::USER_LANGUAGE)); $applicationFactory = ApplicationFactory::getInstance(); $mwCollaboratorFactory = $applicationFactory->newMwCollaboratorFactory(); $htmlFormRenderer = $mwCollaboratorFactory->newHtmlFormRenderer($this->getContext()->getTitle(), $this->getLanguage()); $store = $applicationFactory->getStore(); $connection = $store->getConnection('mw.db'); $outputFormatter = new OutputFormatter($output); $dataRepairSection = new DataRepairSection($connection, $htmlFormRenderer, $outputFormatter); $dataRepairSection->enabledRefreshStore($applicationFactory->getSettings()->get('smwgAdminRefreshStore')); $linkSection = new LinkSection($htmlFormRenderer, $outputFormatter); $tableSchemaUpdaterSection = new TableSchemaUpdaterSection($store, $htmlFormRenderer, $outputFormatter); $tableSchemaUpdaterSection->enabledSetupStore($applicationFactory->getSettings()->get('smwgAdminSetupStore')); $idHandlerSection = new IdHandlerSection($connection, $htmlFormRenderer, $outputFormatter); $idHandlerSection->enabledIdDisposal($applicationFactory->getSettings()->get('smwgAdminIdDisposal')); $supportSection = new SupportSection($htmlFormRenderer); // Actions switch ($this->getRequest()->getText('action')) { case 'settings': return $linkSection->outputConfigurationList(); case 'stats': return $linkSection->outputStatistics(); case 'updatetables': return $tableSchemaUpdaterSection->doUpdate($this->getRequest()); case 'idlookup': return $idHandlerSection->outputActionForm($this->getRequest(), $this->getUser()); case 'refreshstore': return $dataRepairSection->doRefresh($this->getRequest()); } // General intro $html = Message::get('smw_smwadmin_docu', Message::TEXT, Message::USER_LANGUAGE); $html .= $tableSchemaUpdaterSection->getForm(); $html .= $dataRepairSection->getForm(); $html .= $linkSection->getForm(); $html .= $supportSection->getForm(); $output->addHTML($html); }