Example #1
0
 private function registerConnectionProviders()
 {
     $mwCollaboratorFactory = $this->applicationFactory->newMwCollaboratorFactory();
     $connectionManager = new ConnectionManager();
     $connectionManager->registerConnectionProvider(DB_MASTER, $mwCollaboratorFactory->newLazyDBConnectionProvider(DB_MASTER));
     $connectionManager->registerConnectionProvider(DB_SLAVE, $mwCollaboratorFactory->newLazyDBConnectionProvider(DB_SLAVE));
     $connectionManager->registerConnectionProvider('mw.db', $mwCollaboratorFactory->newMediaWikiDatabaseConnectionProvider());
 }
Example #2
0
 private function performUpdate()
 {
     $this->applicationFactory = ApplicationFactory::getInstance();
     $filePage = $this->makeFilePage();
     $parserData = $this->applicationFactory->newParserData($this->file->getTitle(), $filePage->getParserOutput($this->makeCanonicalParserOptions()));
     $pageInfoProvider = $this->applicationFactory->newMwCollaboratorFactory()->newPageInfoProvider($filePage);
     $propertyAnnotator = $this->applicationFactory->newPropertyAnnotatorFactory()->newPredefinedPropertyAnnotator($parserData->getSemanticData(), $pageInfoProvider);
     $propertyAnnotator->addAnnotation();
     $parserData->pushSemanticDataToParserOutput();
     $parserData->updateStore();
     return true;
 }
Example #3
0
 private function registerConnectionProviders()
 {
     $mwCollaboratorFactory = $this->applicationFactory->newMwCollaboratorFactory();
     $connectionManager = new ConnectionManager();
     $connectionManager->registerConnectionProvider(DB_MASTER, $mwCollaboratorFactory->newLazyDBConnectionProvider(DB_MASTER));
     $connectionManager->registerConnectionProvider(DB_SLAVE, $mwCollaboratorFactory->newLazyDBConnectionProvider(DB_SLAVE));
     $connectionManager->registerConnectionProvider('mw.db', $mwCollaboratorFactory->newMediaWikiDatabaseConnectionProvider());
     // Connection can be used to redirect queries to another DB cluster
     $queryengineConnectionProvider = $mwCollaboratorFactory->newMediaWikiDatabaseConnectionProvider();
     $queryengineConnectionProvider->resetTransactionProfiler();
     $connectionManager->registerConnectionProvider('mw.db.queryengine', $queryengineConnectionProvider);
 }
Example #4
0
 private function matchWikiPageLastModifiedToRevisionLastModified($title)
 {
     if ($this->getParameter('pm') !== ($this->getParameter('pm') | SMW_UJ_PM_CLASTMDATE)) {
         return false;
     }
     $lastModified = $this->getWikiPageLastModifiedTimestamp(DIWikiPage::newFromTitle($title));
     if ($lastModified === \WikiPage::factory($title)->getTimestamp()) {
         $pageUpdater = $this->applicationFactory->newMwCollaboratorFactory()->newPageUpdater();
         $pageUpdater->addPage($title);
         $pageUpdater->doPurgeParserCache();
         return true;
     }
     return false;
 }
 /**
  * @see Job::run
  *
  * @since  2.3
  */
 public function run()
 {
     $this->pageUpdater = $this->applicationFactory->newMwCollaboratorFactory()->newPageUpdater();
     $this->store = $this->applicationFactory->getStore();
     if ($this->hasParameter('limit')) {
         $this->limit = $this->getParameter('limit');
     }
     if ($this->hasParameter('offset')) {
         $this->offset = $this->getParameter('offset');
     }
     if ($this->hasParameter('idlist')) {
         $this->findEmbeddedQueryTargetLinksBatches($this->getParameter('idlist'));
     }
     $this->pageUpdater->addPage($this->getTitle());
     $this->pageUpdater->doPurgeParserCache();
     Hooks::run('SMW::Job::AfterParserCachePurgeComplete', array($this));
     return true;
 }
 private function updateSemanticData(Title $title, WikiPage $wikiPage, $revision)
 {
     $this->processSemantics = $revision !== null && $this->isSemanticEnabledNamespace($title);
     if (!$this->processSemantics) {
         return $this->semanticData = new SemanticData($this->getSubject());
     }
     $pageInfoProvider = $this->applicationFactory->newMwCollaboratorFactory()->newPageInfoProvider($wikiPage, $revision, User::newFromId($revision->getUser()));
     $propertyAnnotator = $this->applicationFactory->newPropertyAnnotatorFactory()->newPredefinedPropertyAnnotator($this->semanticData, $pageInfoProvider);
     $propertyAnnotator->addAnnotation();
 }
 /**
  * Returns a formatted factbox table
  *
  * @since 1.9
  *
  * @param SMWSemanticData $semanticData
  *
  * @return string|null
  */
 protected function createTable(SemanticData $semanticData)
 {
     $this->htmlTableRenderer = $this->applicationFactory->newMwCollaboratorFactory()->newHtmlTableRenderer();
     $text = '';
     // Hook deprecated with SMW 1.9 and will vanish with SMW 1.11
     wfRunHooks('smwShowFactbox', array(&$text, $semanticData));
     // Hook since 1.9
     if (wfRunHooks('SMW::Factbox::BeforeContentGeneration', array(&$text, $semanticData))) {
         $this->getTableHeader($semanticData->getSubject());
         $this->getTableContent($semanticData);
         $text .= Html::rawElement('div', array('class' => 'smwfact'), $this->htmlTableRenderer->getHeaderItems() . $this->htmlTableRenderer->getHtml(array('class' => 'smwfacttable')));
     }
     return $text;
 }