r24878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24877‎ | r24878 | r24879 >
Date:15:24, 17 August 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
New registration system for special pages (on-demand loading), use new special pages for properties
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPages.php (added) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -78,12 +78,6 @@
7979
8080 //require_once($smwgIP . '/specials/OntologyImport/SMW_SpecialOntologyImport.php'); // broken, TODO: fix or delete
8181 require_once($smwgIP . '/specials/ExtendedStatistics/SMW_SpecialExtendedStatistics.php');
82 -
83 - require_once($smwgIP . '/specials/Relations/SMW_SpecialRelations.php');
84 - require_once($smwgIP . '/specials/Relations/SMW_SpecialUnusedRelations.php');
85 - require_once($smwgIP . '/specials/Relations/SMW_SpecialWantedRelations.php');
86 - require_once($smwgIP . '/specials/Relations/SMW_SpecialAttributes.php');
87 - require_once($smwgIP . '/specials/Relations/SMW_SpecialUnusedAttributes.php');
8882 require_once($smwgIP . '/specials/Relations/SMW_SpecialTypes.php');
8983
9084 ///// register hooks /////
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPages.php
@@ -0,0 +1,144 @@
 2+<?php
 3+
 4+/**
 5+ * Methods for registering special pages without pulling in their code before it is
 6+ * actually needed.
 7+ *
 8+ * @author Markus Krötzsch
 9+ */
 10+
 11+global $IP;
 12+include_once( "$IP/includes/SpecialPage.php" );
 13+
 14+// Ask special
 15+
 16+SpecialPage::addPage( new SpecialPage('Ask','',true,'doSpecialAsk',false) );
 17+
 18+function doSpecialAsk() {
 19+ wfProfileIn('doSpecialAsk (SMW)');
 20+ global $smwgIP;
 21+ include_once($smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php');
 22+ SMW_AskPage::execute();
 23+ wfProfileOut('doSpecialAsk (SMW)');
 24+}
 25+
 26+// Browse special
 27+
 28+SpecialPage::addPage( new SpecialPage('Browse','',true,'doSpecialBrowse','default',true) );
 29+
 30+function doSpecialBrowse($query = '') {
 31+ wfProfileIn('doSpecialBrowse (SMW)');
 32+ global $smwgIP;
 33+ include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php');
 34+ SMW_SpecialBrowse::execute($query);
 35+ wfProfileOut('doSpecialBrowse (SMW)');
 36+}
 37+
 38+// Property value special
 39+
 40+SpecialPage::addPage( new SpecialPage('PageProperty','',FALSE,'doSpecialPageProperty',false) );
 41+
 42+function doSpecialPageProperty($query = '') {
 43+ wfProfileIn('doSpecialPageProperty (SMW)');
 44+ global $smwgIP;
 45+ include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialPageProperty.php');
 46+ SMW_PageProperty::execute($query);
 47+ wfProfileOut('doSpecialPageProperty (SMW)');
 48+}
 49+
 50+// Property search special
 51+
 52+SpecialPage::addPage( new SpecialPage('SearchByProperty','',true,'doSpecialSearchByProperty',false) );
 53+
 54+function doSpecialSearchByProperty($query = '') {
 55+ wfProfileIn('doSpecialSearchByProperty (SMW)');
 56+ global $smwgIP;
 57+ include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByProperty.php');
 58+ SMW_SearchByProperty::execute($query);
 59+ wfProfileOut('doSpecialSearchByProperty (SMW)');
 60+}
 61+
 62+// URI resolver special
 63+
 64+SpecialPage::addPage( new SpecialPage('URIResolver','',false,'doSpecialURIResolver',false) );
 65+
 66+function doSpecialURIResolver($name = '') {
 67+ wfProfileIn('doSpecialURIResolver (SMW)');
 68+ global $smwgIP;
 69+ include_once($smwgIP . '/specials/URIResolver/SMW_SpecialURIResolver.php');
 70+ SMW_URIResolver::execute($name);
 71+ wfProfileOut('doSpecialURIResolver (SMW)');
 72+}
 73+
 74+// RDF Export special
 75+
 76+SpecialPage::addPage( new SpecialPage('ExportRDF','',true,'doSpecialExportRDF',false) );
 77+
 78+function doSpecialExportRDF($page = '') {
 79+ wfProfileIn('doSpecialExportRDF (SMW)');
 80+ global $smwgIP;
 81+ include_once($smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php');
 82+ smwfExportRDF($page);
 83+ wfProfileOut('doSpecialExportRDF (SMW)');
 84+}
 85+
 86+// Properties special
 87+
 88+SpecialPage::addPage( new SpecialPage('Properties','',true,'doSpecialProperties',false) );
 89+
 90+function doSpecialProperties($par = null) {
 91+ wfProfileIn('doSpecialProperties (SMW)');
 92+ global $smwgIP;
 93+ include_once($smwgIP . '/specials/QueryPages/SMW_SpecialProperties.php');
 94+ list( $limit, $offset ) = wfCheckLimits();
 95+ $rep = new PropertiesPage();
 96+ $result = $rep->doQuery( $offset, $limit );
 97+ wfProfileOut('doSpecialProperties (SMW)');
 98+ return $result;
 99+}
 100+
 101+// Unused Properties special
 102+
 103+SpecialPage::addPage( new SpecialPage('UnusedProperties','',true,'doSpecialUnusedProperties',false) );
 104+
 105+function doSpecialUnusedProperties($par = null) {
 106+ wfProfileIn('doSpecialUnusedProperties (SMW)');
 107+ global $smwgIP;
 108+ include_once($smwgIP . '/specials/QueryPages/SMW_SpecialUnusedProperties.php');
 109+ list( $limit, $offset ) = wfCheckLimits();
 110+ $rep = new UnusedPropertiesPage();
 111+ $result = $rep->doQuery( $offset, $limit );
 112+ wfProfileOut('doSpecialUnusedProperties (SMW)');
 113+ return $result;
 114+}
 115+
 116+// Wanted Properties special
 117+
 118+SpecialPage::addPage( new SpecialPage('WantedProperties','',true,'doSpecialWantedProperties',false) );
 119+
 120+function doSpecialWantedProperties($par = null) {
 121+ wfProfileIn('doSpecialWantedProperties (SMW)');
 122+ global $smwgIP;
 123+ include_once($smwgIP . '/specials/QueryPages/SMW_SpecialWantedProperties.php');
 124+ list( $limit, $offset ) = wfCheckLimits();
 125+ $rep = new WantedPropertiesPage();
 126+ $result = $rep->doQuery( $offset, $limit );
 127+ wfProfileOut('doSpecialWantedProperties (SMW)');
 128+ return $result;
 129+}
 130+
 131+// Admin special
 132+
 133+///TODO: should these be messages?
 134+global $wgMessageCache;
 135+$wgMessageCache->addMessages(array('smwadmin' => 'Admin functions for Semantic MediaWiki'));
 136+
 137+SpecialPage::addPage( new SpecialPage('SMWAdmin','delete',true,'doSpecialSMWAdmin',false) );
 138+
 139+function doSpecialSMWAdmin($par = null) {
 140+ wfProfileIn('doSpecialSMWAdmin (SMW)');
 141+ global $smwgIP;
 142+ include_once($smwgIP . '/specials/SMWAdmin/SMW_SpecialSMWAdmin.php');
 143+ smwfSMWAdmin($par);
 144+ wfProfileOut('doSpecialSMWAdmin (SMW)');
 145+}
Property changes on: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPages.php
___________________________________________________________________
Added: svn:eol-style
1146 + native

Status & tagging log