コード例 #1
0
 /**
  * @since 2.5
  *
  * @param WebRequest $webRequest
  * @param User|null $user
  */
 public function outputActionForm(WebRequest $webRequest, User $user = null)
 {
     $this->outputFormatter->setPageTitle($this->getMessage('smw-smwadmin-idlookup-title'));
     $this->outputFormatter->addParentLink();
     $id = (int) $webRequest->getText('id');
     if ($this->enabledIdDisposal && $id > 0 && $webRequest->getText('dispose') === 'yes') {
         $this->doDispose($id, $user);
     }
     $this->outputFormatter->addHtml($this->getForm($webRequest, $id));
 }
コード例 #2
0
 /**
  * @since 2.5
  */
 public function outputStatistics()
 {
     $this->outputFormatter->setPageTitle($this->getMessage('smw-smwadmin-operational-statistics-title'));
     $this->outputFormatter->addParentLink();
     $semanticStatistics = ApplicationFactory::getInstance()->getStore()->getStatistics();
     $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-operational-statistics'), Message::PARSE)));
     $this->outputFormatter->addHTML(Html::element('h2', array(), $this->getMessage('semanticstatistics')));
     $this->outputFormatter->addHTML('<pre>' . $this->outputFormatter->encodeAsJson(array('propertyValues' => $semanticStatistics['PROPUSES'], 'errorCount' => $semanticStatistics['ERRORUSES'], 'propertyTotal' => $semanticStatistics['USEDPROPS'], 'ownPage' => $semanticStatistics['OWNPAGE'], 'declaredType' => $semanticStatistics['DECLPROPS'], 'oudatedEntities' => $semanticStatistics['DELETECOUNT'], 'subobjects' => $semanticStatistics['SUBOBJECTS'], 'queries' => $semanticStatistics['QUERY'], 'concepts' => $semanticStatistics['CONCEPTS'])) . '</pre>');
     $this->outputFormatter->addHTML(Html::element('h2', array(), $this->getMessage('smw-smwadmin-statistics-querycache-title')));
     $cachedQueryResultPrefetcher = ApplicationFactory::getInstance()->singleton('CachedQueryResultPrefetcher');
     if (!$cachedQueryResultPrefetcher->isEnabled()) {
         return $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-statistics-querycache-disabled'), Message::PARSE)));
     }
     $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-statistics-querycache-explain'), Message::PARSE)));
     $this->outputFormatter->addHTML('<pre>' . $this->outputFormatter->encodeAsJson($cachedQueryResultPrefetcher->getStats()) . '</pre>');
 }
コード例 #3
0
 /**
  * @since 2.5
  *
  * @param WebRequest $webRequest
  */
 public function doRefresh(WebRequest $webRequest)
 {
     $this->outputFormatter->setPageTitle($this->getMessage('smw_smwadmin_datarefresh'));
     $this->outputFormatter->addParentLink();
     if (!$this->enabledRefreshStore) {
         return $this->outputMessage('smw_smwadmin_return');
     }
     $refreshjob = $this->getRefreshJob();
     $sure = $webRequest->getText('rfsure');
     if ($sure == 'yes') {
         if ($refreshjob === null) {
             // careful, there might be race conditions here
             $newjob = ApplicationFactory::getInstance()->newJobFactory()->newByType('SMW\\RefreshJob', \SpecialPage::getTitleFor('SMWAdmin'), array('spos' => 1, 'prog' => 0, 'rc' => 2));
             $newjob->insert();
             $this->outputMessage('smw_smwadmin_updatestarted');
         } else {
             $this->outputMessage('smw_smwadmin_updatenotstarted');
         }
     } elseif ($sure == 'stop') {
         // delete (all) existing iteration jobs
         $this->connection->delete('job', array('job_cmd' => 'SMW\\RefreshJob'), __METHOD__);
         $this->outputMessage('smw_smwadmin_updatestopped');
     } else {
         $this->outputMessage('smw_smwadmin_updatenotstopped');
     }
 }
コード例 #4
0
 /**
  * @since 2.5
  *
  * @param WebRequest $webRequest
  *
  * @return callable
  */
 public function doUpdate(WebRequest $webRequest)
 {
     if (!$this->enabledSetupStore) {
         return;
     }
     $messageReporter = MessageReporterFactory::getInstance()->newObservableMessageReporter();
     $messageReporter->registerReporterCallback(array($this, 'reportMessage'));
     $this->outputFormatter->setPageTitle($this->getMessage('smw_smwadmin_db'));
     $this->outputFormatter->addParentLink();
     $this->store->getOptions()->set(Installer::OPT_MESSAGEREPORTER, $messageReporter);
     $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage('smw_smwadmin_permissionswarn')));
     $this->outputFormatter->addHTML('<pre>');
     // Output is generated by the injected 'installer.messagereporter'
     $result = $this->store->setup();
     $this->outputFormatter->addHTML('</pre>');
     if ($result === true && $webRequest->getText('udsure') == 'yes') {
         $this->outputFormatter->addWikiText('<p><b>' . $this->getMessage('smw_smwadmin_setupsuccess') . "</b></p>");
     }
 }
コード例 #5
0
 public function testSetPageTitle()
 {
     $this->outputPage->expects($this->once())->method('setPageTitle');
     $instance = new OutputFormatter($this->outputPage);
     $instance->setPageTitle('Foo');
 }