コード例 #1
0
	public function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 ) {
		$oldWikiPage = SMWDIWikiPage::newFromTitle( $oldtitle );
		$newWikiPage = SMWDIWikiPage::newFromTitle( $newtitle );
		$oldExpResource = SMWExporter::getDataItemExpElement( $oldWikiPage );
		$newExpResource = SMWExporter::getDataItemExpElement( $newWikiPage );
		$namespaces = array( $oldExpResource->getNamespaceId() => $oldExpResource->getNamespace() );
		$namespaces[$newExpResource->getNamespaceId()] = $newExpResource->getNamespace();
		$oldUri = SMWTurtleSerializer::getTurtleNameForExpElement( $oldExpResource );
		$newUri = SMWTurtleSerializer::getTurtleNameForExpElement( $newExpResource );

		parent::changeTitle( $oldtitle, $newtitle, $pageid, $redirid ); // do this only here, so Imported from is not moved too early

		$sparqlDatabase = smwfGetSparqlDatabase();
		$sparqlDatabase->insertDelete( "?s ?p $newUri", "?s ?p $oldUri", "?s ?p $oldUri", $namespaces );
		if ( $oldtitle->getNamespace() == SMW_NS_PROPERTY ) {
			$sparqlDatabase->insertDelete( "?s $newUri ?o", "?s $oldUri ?o", "?s $oldUri ?o", $namespaces );
		}
		// Note that we cannot change oldUri to newUri in triple subjects,
		// since some triples change due to the move. Use SMWUpdateJob.
		$newUpdate = new SMWUpdateJob( $newtitle );
		$newUpdate->run();
		if ( $redirid != 0 ) { // update/create redirect page data
			$oldUpdate = new SMWUpdateJob( $oldtitle );
			$oldUpdate->run();
		}
	}
コード例 #2
0
ファイル: SMW_WSUpdateBot.php プロジェクト: seedbank/old-repo
 public function run($paramArray, $isAsync, $delay)
 {
     echo "bot started\n";
     if (array_key_exists("WS_WSID", $paramArray) && $paramArray["WS_WSID"] != null) {
         $log = SGAGardeningIssuesAccess::getGardeningIssuesAccess();
         $ws = WebService::newFromID($paramArray["WS_WSID"]);
         $affectedArticles = $this->updateWSResults($ws);
         $this->setNumberOfTasks(2);
     } else {
         $affectedArticles = $this->updateAllWSResults();
     }
     ksort($affectedArticles);
     $affectedArticles = array_flip($affectedArticles);
     echo "\nRefreshing articles: \n";
     foreach ($affectedArticles as $articleId => $dontCare) {
         echo "\t refreshing articleId: " . $articleId . "\n";
         $title = Title::newFromID($articleId);
         $updatejob = new SMWUpdateJob($title);
         $updatejob->run();
     }
     echo "\nbot finished";
     global $smwgDefaultStore;
     if ($smwgDefaultStore == 'SMWTripleStore' || $smwgDefaultStore == 'SMWTripleStoreQuad') {
         define('SMWH_FORCE_TS_UPDATE', 'TRUE');
         smwfGetStore()->initialize(true);
     }
     return '';
 }
コード例 #3
0
ファイル: SMW_refreshData.php プロジェクト: Tjorriemorrie/app
        smwfGetStore()->refreshData($id, 1, $filter, false);
        if ($delay !== false) {
            usleep($delay);
        }
        $num_files++;
        if ($num_files % 100 === 0) {
            // every 100 pages only
            $linkCache->clear();
            // avoid memory leaks
        }
    }
    if ($writeToStartidfile) {
        file_put_contents($options['startidfile'], "{$id}");
    }
    print "{$num_files} IDs refreshed.\n";
} else {
    print "Refreshing specified pages!\n\n";
    foreach ($pages as $page) {
        if ($verbose) {
            print "({$num_files}) Processing page " . $page . " ...\n";
        }
        $title = Title::newFromText($page);
        if (!is_null($title)) {
            // wikia note - not migrating call to new jobqueue, since this is run directly
            $updatejob = new SMWUpdateJob($title);
            $updatejob->run();
        }
        $num_files++;
    }
    print "{$num_files} pages refreshed.\n";
}