예제 #1
0
 /**
  * Print basic information about this site.
  */
 public function printWikiInfo()
 {
     global $wgSitename, $wgLanguageCode;
     $this->prepareSerialization();
     $this->delay_flush = 35;
     // don't do intermediate flushes with default parameters
     // assemble export data:
     $expData = new SMWExpData(new SMWExpResource('&wiki;#wiki'));
     $ed = new SMWExpData(SMWExporter::getSpecialNsResource('swivt', 'Wikisite'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdf', 'type'), $ed);
     // basic wiki information
     $ed = new SMWExpData(new SMWExpLiteral($wgSitename));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdfs', 'label'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral($wgSitename, null, 'http://www.w3.org/2001/XMLSchema#string'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'siteName'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SMWExporter::expandURI('&wikiurl;'), null, 'http://www.w3.org/2001/XMLSchema#string'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'pagePrefix'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SMW_VERSION, null, 'http://www.w3.org/2001/XMLSchema#string'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'smwVersion'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral($wgLanguageCode, null, 'http://www.w3.org/2001/XMLSchema#string'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'langCode'), $ed);
     $mainpage = Title::newMainPage();
     if (!is_null($mainpage)) {
         $ed = new SMWExpData(new SMWExpResource($mainpage->getFullURL()));
         $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'mainPage'), $ed);
     }
     // statistical information
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::pages(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'pageCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::articles(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'contentPageCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::images(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'mediaCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::edits(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'editCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::views(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'viewCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::users(), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'userCount'), $ed);
     $ed = new SMWExpData(new SMWExpLiteral(SiteStats::numberingroup('sysop'), null, 'http://www.w3.org/2001/XMLSchema#int'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('swivt', 'adminCount'), $ed);
     $this->serializer->startSerialization();
     $this->serializer->serializeExpData(SMWExporter::getOntologyExpData(''));
     $this->serializer->serializeExpData($expData);
     // link to list of existing pages:
     if (strpos(SMWExporter::expandURI('&wikiurl;'), '?') === false) {
         // check whether we have title as a first parameter or in URL
         $nexturl = SMWExporter::expandURI('&export;?offset=0');
     } else {
         $nexturl = SMWExporter::expandURI('&export;&offset=0');
     }
     $expData = new SMWExpData(new SMWExpResource($nexturl));
     $ed = new SMWExpData(SMWExporter::getSpecialNsResource('owl', 'Thing'));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdf', 'type'), $ed);
     $ed = new SMWExpData(new SMWExpResource($nexturl));
     $expData->addPropertyObjectValue(SMWExporter::getSpecialNsResource('rdfs', 'isDefinedBy'), $ed);
     $this->serializer->serializeExpData($expData);
     $this->serializer->finishSerialization();
     $this->flush(true);
 }
 public function flushContent()
 {
     $result = parent::flushContent();
     $this->namespaces_are_global = false;
     // must not be done before calling the parent method (which may declare namespaces)
     $this->namespace_block_started = false;
     return $result;
 }
 public function clear()
 {
     parent::clear();
     $this->sparql_namespaces = array();
 }