r88567 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88566‎ | r88567 | r88568 >
Date:10:29, 22 May 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
Removed Type namespace, and moved its main functionality to Special:Types;
the old namespace can be re-enabled for accessing old content, but is disabled by default
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php (deleted) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php
@@ -11,9 +11,9 @@
1212 * @ingroup SMWSpecialPage
1313 * @ingroup SpecialPage
1414 *
15 - * @author S Page
 15+ * @todo The messages 'smw_isnotype' and 'smw_typeunits', maybe 'smw_isaliastype', could be obsolete now.
 16+ *
1617 * @author Markus Krötzsch
17 - * @author Jeroen De Dauw
1818 */
1919 class SMWSpecialTypes extends SpecialPage {
2020
@@ -22,142 +22,79 @@
2323 smwfLoadExtensionMessages( 'SemanticMediaWiki' );
2424 }
2525
26 - public function execute( $param ) {
27 - wfProfileIn( 'smwfDoSpecialTypes (SMW)' );
28 -
 26+ public function execute( $param ) {
2927 global $wgOut;
30 -
31 - $wgOut->setPageTitle( wfMsg( 'types' ) );
32 -
33 - $rep = new TypesPage();
34 -
35 - // execute() method added in MW 1.18
36 - if ( method_exists( $rep, 'execute' ) ) {
37 - $rep->execute( $param );
 28+ wfProfileIn( 'smwfDoSpecialTypes (SMW)' );
 29+
 30+ $params = SMWInfolink::decodeParameters( $param, false );
 31+ $typeLabel = reset( $params );
 32+
 33+ if ( $typeLabel == false ) {
 34+ $wgOut->setPageTitle( wfMsg( 'types' ) );
 35+ $html = $this->getTypesList();
 36+ } else {
 37+ $typeName = str_replace( '_', ' ', $typeLabel );
 38+ $wgOut->setPageTitle( $typeName ); // Maybe add a better message for this
 39+ $html = $this->getTypeProperties( $typeLabel );
3840 }
39 - else {
40 - list( $limit, $offset ) = wfCheckLimits();
41 - $rep->doQuery( $offset, $limit );
42 - }
43 -
44 - // Ensure locally collected output data is pushed to the output!
 41+
 42+ $wgOut->addHTML( $html );
4543 SMWOutputs::commitToOutputPage( $wgOut );
46 -
 44+
4745 wfProfileOut( 'smwfDoSpecialTypes (SMW)' );
4846 }
49 -
50 -}
5147
52 -class TypesPage extends QueryPage {
 48+ protected function getTypesList() {
 49+ $html = '<p>' . htmlspecialchars( wfMsg( 'smw_types_docu' ) ) . "</p><br />\n";
5350
54 - public function __construct( $name = 'Types' ) {
55 - global $wgVersion;
56 - if ( version_compare( $wgVersion, '1.17', '>=' ) ) {
57 - parent::__construct( $name );
 51+ $typeLabels = SMWDataValueFactory::getKnownTypeLabels();
 52+ asort( $typeLabels, SORT_STRING );
 53+
 54+ $html .= "<ul>\n";
 55+ foreach ( $typeLabels as $typeId => $label ) {
 56+ $typeValue = SMWTypesValue::newFromTypeId( $typeId );
 57+ $html .= '<li>' . $typeValue->getLongHTMLText( $this->getSkin() ) . "</li>\n";
5858 }
59 - }
60 -
61 - function getName() {
62 - return 'Types';
63 - }
 59+ $html .= "</ul>\n";
6460
65 - function isExpensive() {
66 - return false;
 61+ return $html;
6762 }
6863
69 - function isSyndicated() {
70 - return false;
71 - }
 64+ protected function getTypeProperties( $typeLabel ) {
 65+ global $wgRequest, $smwgTypePagingLimit;
7266
73 - function getPageHeader() {
74 - return '<p>' . htmlspecialchars( wfMsg( 'smw_types_docu' ) ) . "</p><br />\n";
75 - }
 67+ if ( $smwgTypePagingLimit <= 0 ) return ''; // not too useful, but we comply to this request
7668
77 - /* Failed attempt to fix https://bugzilla.wikimedia.org/show_bug.cgi?id=27440
78 - function getQueryInfo() {
79 - $joinConds = array();
80 -
81 - foreach ( SMWDataValueFactory::getKnownTypeLabels() as $label ) {
82 - $label = str_replace( ' ', '_', $label ); // DBkey form so that SQL can elminate duplicates
83 - $joinConds['page'] = array( 'UNION', "(SELECT 'Types' as type, " .
84 - SMW_NS_TYPE .
85 - " as namespace, '$label' as title, " .
86 - "'$label' as value, 1 as count)" );
 69+ $from = $wgRequest->getVal( 'from' );
 70+ $until = $wgRequest->getVal( 'until' );
 71+ $typeValue = SMWDataValueFactory::newTypeIDValue( '__typ', $typeLabel );
 72+
 73+ $store = smwfGetStore();
 74+ $options = SMWPageLister::getRequestOptions( $smwgTypePagingLimit, $from, $until );
 75+ $diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typeValue->getDataItem(), $options );
 76+ if ( !$options->ascending ) {
 77+ $diWikiPages = array_reverse( $diWikiPages );
8778 }
88 -
89 - return array(
90 - 'tables' => array( 'page' ),
91 - 'fields' => array(
92 - SMW_NS_TYPE . ' AS namespace',
93 - 'page_title AS value',
94 - 'page_title AS title',
95 - '1 AS count'
96 - ),
97 - 'conds' => array(
98 - 'page_namespace' => SMW_NS_TYPE,
99 - 'page_is_redirect' => '0'
100 - ),
101 - 'join_conds' => $joinConds
102 - );
103 - }
104 - */
105 -
106 - function getSQL() {
107 - $dbr = wfGetDB( DB_SLAVE );
108 - $page = $dbr->tableName( 'page' );
109 - $NStype = SMW_NS_TYPE;
110 - // TODO: Perhaps use the dbr syntax from SpecialAllpages.
111 - // NOTE: type, namespace, title and value must all be defined for QueryPage to work (incl. caching)
112 - $sql = "(SELECT 'Types' as type, {$NStype} as namespace, page_title as title, " .
113 - "page_title as value, 1 as count FROM $page WHERE page_namespace = $NStype AND page_is_redirect = '0')";
114 - // make SQL for built-in datatypes
115 - foreach ( SMWDataValueFactory::getKnownTypeLabels() as $label ) {
116 - $label = str_replace( ' ', '_', $label ); // DBkey form so that SQL can elminate duplicates
117 - $sql .= " UNION (SELECT 'Types' as type, {$NStype} as namespace, '$label' as title, " .
118 - "'$label' as value, 1 as count)";
119 - }
120 - return $sql;
121 - }
12279
123 - function sortDescending() {
124 - return false;
125 - }
 80+ $result = '';
12681
127 - function formatResult( $skin, $result ) {
128 - return $this->getTypeInfo( $skin, $result->value );
129 - }
 82+ if ( count( $diWikiPages ) > 0 ) {
 83+ $pageLister = new SMWPageLister( $diWikiPages, null, $this->getSkin(), $smwgTypePagingLimit, $from, $until );
13084
131 - /**
132 - * Returns the info about a type as HTML.
133 - */
134 - function getTypeInfo( $skin, $titletext ) {
135 - $tv = SMWDataValueFactory::newTypeIDValue( '__typ', $titletext );
136 - $info = array();
137 - $error = array();
138 - if ( $tv->isAlias() ) { // print the type title as found, long text would (again) print the alias
139 - $ttitle = Title::makeTitle( SMW_NS_TYPE, $titletext );
140 - $link = $skin->makeKnownLinkObj( $ttitle, $ttitle->getText() ); // aliases are only found if the page exists
141 - $info[] = wfMsg( 'smw_isaliastype', $tv->getLongHTMLText() );
142 - } else {
143 - $link = $tv->getLongHTMLText( $skin );
144 - if ( !$tv->isBuiltIn() ) { // find out whether and how this was user-defined
145 - $dv = SMWDataValueFactory::newTypeObjectValue( $tv );
146 - $units = $dv->getUnitList();
147 - if ( count( $units ) == 0 ) {
148 - $error[] = wfMsg( 'smw_isnotype', $tv->getLongHTMLText() );
149 - } else {
150 - $info[] = wfMsg( 'smw_typeunits', $tv->getLongHTMLText(), implode( ', ', $units ) );
151 - }
152 - }
 85+ $title = $this->getTitleFor( 'Types', $typeLabel );
 86+ $title->setFragment( '#SMWResults' ); // Make navigation point to the result list.
 87+ $navigation = $pageLister->getNavigationLinks( $title );
 88+
 89+ $resultNumber = min( $smwgTypePagingLimit, count( $diWikiPages ) );
 90+ $typeName = $typeValue->getLongWikiText();
 91+
 92+ $result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" .
 93+ '<h2>' . wfMsg( 'smw_type_header', $typeName ) . "</h2>\n<p>" .
 94+ wfMsgExt( 'smw_typearticlecount', array( 'parsemag' ), $resultNumber ) . "</p>\n" .
 95+ $navigation . $pageLister->formatList() . $navigation . "\n</div>";
15396 }
154 -
155 - if ( count( $error ) > 0 ) {
156 - $link .= smwfEncodeMessages( $error );
157 - }
158 - if ( count( $info ) > 0 ) {
159 - $link .= smwfEncodeMessages( $info, 'info' );
160 - }
161 - return $link;
 97+
 98+ return $result;
16299 }
163100
164101 }
Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
@@ -2,13 +2,37 @@
33
44 == SMW 1.6.0 ==
55
 6+* Full support for synchronizing RDF stores with SMW, and for answering #ask
 7+ queries based on this data. The communication happens via SPARQL (1.1), and
 8+ all SPARQL-capable stores should be supported. The following settings are
 9+ needed in LocalSettings.php:
 10+ $smwgDefaultStore = 'SMWSparqlStore';
 11+ $smwgSparqlDatabase = 'SMWSparqlDatabase';
 12+ // The following should be set to the URLs to reach the store:
 13+ $smwgSparqlQueryEndpoint = 'http://localhost:8080/sparql/';
 14+ $smwgSparqlUpdateEndpoint = 'http://localhost:8080/update/';
 15+ $smwgSparqlDataEndpoint = 'http://localhost:8080/data/'; // can be empty
 16+* The Type namespace has been abolished. Builtin types now are displayed by the
 17+ special page Special:Types, and there are no "custom types" any longer.
 18+ By default, the Type namespace is gone and existing pages in this namespace
 19+ can no longer be accessed. This can be changed by setting
 20+ $smwgHistoricTypeNamespace = true in LocalSettings.php before including SMW.
621 * Changed the way in which units of measurement work. Type:Number now does not
7 - accept any units, but units can be used with custom types as before. However
8 - only units with a conversion factor on the custom type page are accepted.
 22+ accept any units, and a new type "Quantity" is used for numbers with units.
 23+ Units must be declared on the property page (not on the Type page as before),
 24+ and only units that have a declared conversion factor are accepted.
 25+* The declaration of Type:Record properties has changed. Instead of a list of
 26+ datatypes, the declaration now requires a list of properties that are to be
 27+ used for the fields of the record. The declaration is still done with the
 28+ property "has fields" as before.
929 * Changed the way parameters in query printers are specified and handled
1030 using the Validator extension. This includes improvements to the parameter
1131 options in the Special:Ask GUI and better error reporting for ask queries.
1232 * Added UNIX-style DSV (Delimiter-separated values) result format.
 33+* Reworked internal data model, cleaning up and re-implementing SMWDataValue and
 34+ all of its subclasses, and introducing new data item classes to handle data.
 35+ The class SMWCompatibilityHelpers provides temporal help for extensions that
 36+ still depend on the old format and APIs.
1337 * Fixed PostGres SQL issues with the installation and upgrade code.
1438
1539 == SMW 1.5.6 ==
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Types.php
@@ -96,34 +96,43 @@
9797 }
9898
9999 public function getShortWikiText( $linked = null ) {
 100+ global $wgContLang;
100101 if ( ( $linked === null ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) {
101102 return $this->m_caption;
102 - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here
103 - return $this->m_caption;
 103+ } else {
 104+ $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel );
 105+ $namespace = $wgContLang->getNsText( NS_SPECIAL );
 106+ return "[[$namespace:$titleText|{$this->m_caption}]]";
104107 }
105108 }
106109
107110 public function getShortHTMLText( $linker = null ) {
108111 if ( ( $linked === null ) || ( $linked === false ) || ( $this->m_outformat == '-' ) || ( $this->m_caption == '' ) ) {
109112 return htmlspecialchars( $this->m_caption );
110 - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here
111 - return htmlspecialchars( $this->m_caption );
 113+ } else {
 114+ $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel );
 115+ $title = Title::makeTitle( NS_SPECIAL, $titleText );
 116+ return $linker->makeLinkObj( $title, htmlspecialchars( $this->m_caption ) );
112117 }
113118 }
114119
115120 public function getLongWikiText( $linked = null ) {
116121 if ( ( $linked === null ) || ( $linked === false ) ) {
117122 return $this->m_realLabel;
118 - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here
119 - return $this->m_realLabel;
 123+ } else {
 124+ $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel );
 125+ $namespace = $wgContLang->getNsText( NS_SPECIAL );
 126+ return "[[$namespace:$titleText|{$this->m_realLabel}]]";
120127 }
121128 }
122129
123130 public function getLongHTMLText( $linker = null ) {
124131 if ( ( $linker === null ) || ( $linker === false ) ) {
125132 return htmlspecialchars( $this->m_realLabel );
126 - } else { // TODO provide a Special page with the functionality of former Type pages, and link to it here
127 - return htmlspecialchars( $this->m_realLabel );
 133+ } else {
 134+ $titleText = SpecialPageFactory::getLocalNameFor( 'Types', $this->m_realLabel );
 135+ $title = Title::makeTitle( NS_SPECIAL, $titleText );
 136+ return $linker->makeLinkObj( $title, htmlspecialchars( $this->m_realLabel ) );
128137 }
129138 }
130139
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php
@@ -1,119 +0,0 @@
2 -<?php
3 -/**
4 - * Special handling for type description pages.
5 - * Some code based on CategoryPage.php
6 - *
7 - * @author: Markus Krötzsch
8 - * @file
9 - * @ingroup SMW
10 - */
11 -
12 -/**
13 - * Implementation of MediaWiki's Article that shows additional information on
14 - * Type: pages. Very simliar to CategoryPage.
15 - * @ingroup SMW
16 - */
17 -class SMWTypePage extends SMWOrderedListPage {
18 -
19 - protected $m_typevalue;
20 -
21 - /**
22 - * Use higher limit. This operation is very similar to showing members of cateogies.
23 - */
24 - protected function initParameters() {
25 - global $smwgTypePagingLimit;
26 - $this->limit = $smwgTypePagingLimit;
27 - return true;
28 - }
29 -
30 - /**
31 - * Fill the internal arrays with the set of data items to be displayed
32 - * (possibly plus one additional item to indicate further results).
33 - */
34 - protected function doQuery() {
35 - if ( $this->limit > 0 ) {
36 - $store = smwfGetStore();
37 - $options = new SMWRequestOptions();
38 - $options->limit = $this->limit + 1;
39 - $options->sort = true;
40 - $typevalue = SMWDataValueFactory::newTypeIDValue( '__typ', $this->mTitle->getText() );
41 - $this->m_typevalue = $typevalue;
42 - if ( $this->from != '' ) {
43 - $options->boundary = $this->from;
44 - $options->ascending = true;
45 - $options->include_boundary = true;
46 - $this->diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options );
47 - } elseif ( $this->until != '' ) {
48 - $options->boundary = $this->until;
49 - $options->ascending = false;
50 - $options->include_boundary = false;
51 - $this->diWikiPages = array_reverse( $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options ) );
52 - } else {
53 - $this->diWikiPages = $store->getPropertySubjects( new SMWDIProperty( '_TYPE' ), $typevalue->getDataItem(), $options );
54 - }
55 - } else {
56 - $this->diWikiPages = array();
57 - }
58 - }
59 -
60 - /**
61 - * Generates the headline for the page list and the HTML encoded list of pages which
62 - * shall be shown.
63 - */
64 - protected function getPages() {
65 - wfProfileIn( __METHOD__ . ' (SMW)' );
66 - smwfLoadExtensionMessages( 'SemanticMediaWiki' );
67 - $r = '';
68 - $typevalue = $this->m_typevalue;
69 - if ( $typevalue->isBuiltIn() ) {
70 - $r .= '<p style="font-style: italic; ">' . wfMsg( 'smw_isknowntype' ) . "</p>\n";
71 - }
72 - /*
73 - * TODO: also detect isAlias()?
74 - * But smw_isaliastype message requires determining alias target;
75 - * code is in SMW_SpecialTypes, not SMW_DV_Types.
76 - */
77 - $ti = htmlspecialchars( $this->mTitle->getText() );
78 - $nav = $this->getNavigationLinks();
79 - $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n";
80 -
81 - $r .= '<h2>' . wfMsg( 'smw_type_header', $ti ) . "</h2>\n";
82 - $r .= wfMsgExt( 'smw_typearticlecount', array( 'parsemag' ), min( $this->limit, count( $this->diWikiPages ) ) ) . "\n";
83 -
84 - $r .= $this->formatList();
85 - $r .= "\n</div>" . $nav;
86 - wfProfileOut( __METHOD__ . ' (SMW)' );
87 - return $r;
88 - }
89 -
90 - /**
91 - * Format a list of data items chunked by letter, either as a
92 - * bullet list or a columnar format, depending on the length.
93 - *
94 - * @param $cutoff integer, use columns for more results than that
95 - * @return string
96 - */
97 - private function formatList( $cutoff = 6 ) {
98 - $end = count( $this->diWikiPages );
99 - if ( $end > $this->limit ) {
100 - if ( $this->until != '' ) {
101 - $start = 1;
102 - } else {
103 - $start = 0;
104 - $end --;
105 - }
106 - } else {
107 - $start = 0;
108 - }
109 -
110 - if ( count ( $this->diWikiPages ) > $cutoff ) {
111 - return $this->columnList( $start, $end, $this->diWikiPages );
112 - } elseif ( count( $this->diWikiPages ) > 0 ) {
113 - // for short lists of diWikiPages
114 - return $this->shortList( $start, $end, $this->diWikiPages );
115 - }
116 - return '';
117 - }
118 -
119 -}
120 -
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
@@ -33,7 +33,7 @@
3434 protected function getHtml() {
3535 wfProfileIn( __METHOD__ . ' (SMW)' );
3636
37 - if ( $this->limit > 0 ) {
 37+ if ( $this->limit > 0 ) { // limit==0: configuration setting to disable this completely
3838 $store = smwfGetStore();
3939 $description = new SMWConceptDescription( $this->getDataItem() );
4040 $query = SMWPageLister::getQuery( $description, $this->limit, $this->from, $this->until );
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
@@ -83,7 +83,7 @@
8484 * @return string
8585 */
8686 protected function getPropertyValueList() {
87 - if ( $this->limit > 0 ) { // for limit==0 there is no paging, and no query
 87+ if ( $this->limit > 0 ) { // limit==0: configuration setting to disable this completely
8888 $store = smwfGetStore();
8989 $options = SMWPageLister::getRequestOptions( $this->limit, $this->from, $this->until );
9090 $diWikiPages = $store->getAllPropertySubjects( $this->mProperty, $options );
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php
@@ -96,7 +96,6 @@
9797 $wgAutoloadClasses['SMWOutputs'] = $smwgIP . 'includes/SMW_Outputs.php';
9898 $wgAutoloadClasses['SMWSemanticData'] = $smwgIP . 'includes/SMW_SemanticData.php';
9999 $wgAutoloadClasses['SMWOrderedListPage'] = $smwgIP . 'includes/articlepages/SMW_OrderedListPage.php';
100 -// $wgAutoloadClasses['SMWTypePage'] = $smwgIP . 'includes/articlepages/SMW_TypePage.php';
101100 $wgAutoloadClasses['SMWPropertyPage'] = $smwgIP . 'includes/articlepages/SMW_PropertyPage.php';
102101 // $wgAutoloadClasses['SMWConceptPage'] = $smwgIP . 'includes/articlepages/SMW_ConceptPage.php';
103102 $wgAutoloadClasses['SMWQueryLanguage'] = $smwgIP . 'includes/SMW_QueryLanguage.php';
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -114,7 +114,6 @@
115115 // Article pages
116116 $apDir = $smwgIP . 'includes/articlepages/';
117117 $wgAutoloadClasses['SMWOrderedListPage'] = $apDir . 'SMW_OrderedListPage.php';
118 - $wgAutoloadClasses['SMWTypePage'] = $apDir . 'SMW_TypePage.php';
119118 $wgAutoloadClasses['SMWPropertyPage'] = $apDir . 'SMW_PropertyPage.php';
120119 $wgAutoloadClasses['SMWConceptPage'] = $apDir . 'SMW_ConceptPage.php';
121120
@@ -429,9 +428,7 @@
430429 * @return true
431430 */
432431 function smwfOnArticleFromTitle( Title &$title, /* Article */ &$article ) {
433 - if ( $title->getNamespace() == SMW_NS_TYPE ) {
434 - $article = new SMWTypePage( $title );
435 - } elseif ( $title->getNamespace() == SMW_NS_PROPERTY ) {
 432+ if ( $title->getNamespace() == SMW_NS_PROPERTY ) {
436433 $article = new SMWPropertyPage( $title );
437434 } elseif ( $title->getNamespace() == SMW_NS_CONCEPT ) {
438435 $article = new SMWConceptPage( $title );
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php
@@ -86,16 +86,35 @@
8787 * Function that returns an array of namespace identifiers.
8888 */
8989 function getNamespaces() {
90 - return $this->m_Namespaces;
 90+ global $smwgHistoricTypeNamespace;
 91+ $namespaces = $this->m_Namespaces;
 92+ if ( !$smwgHistoricTypeNamespace ) {
 93+ unset( $namespaces[SMW_NS_TYPE] );
 94+ unset( $namespaces[SMW_NS_TYPE_TALK] );
 95+ }
 96+ return $namespaces;
9197 }
9298
9399 /**
94100 * Function that returns an array of namespace aliases, if any.
95101 */
96102 function getNamespaceAliases() {
97 - return $this->m_useEnDefaultAliases ?
98 - $this->m_NamespaceAliases + SMWLanguage::$enNamespaceAliases:
99 - $this->m_NamespaceAliases;
 103+ global $smwgHistoricTypeNamespace;
 104+
 105+ $namespaceAliases = $this->m_NamespaceAliases;
 106+ if ( $this->m_useEnDefaultAliases ) {
 107+ $namespaceAliases = $namespaceAliases + SMWLanguage::$enNamespaceAliases;
 108+ }
 109+
 110+ if ( !$smwgHistoricTypeNamespace ) {
 111+ foreach ($namespaceAliases as $alias => $namespace) {
 112+ if ( $namespace == SMW_NS_TYPE || $namespace == SMW_NS_TYPE_TALK ) {
 113+ unset( $namespaceAliases[$alias] );
 114+ }
 115+ }
 116+ }
 117+
 118+ return $namespaceAliases;
100119 }
101120
102121 /**
Index: trunk/extensions/SemanticMediaWiki/SMW_Settings.php
@@ -69,6 +69,18 @@
7070 require_once( 'includes/SMW_Setup.php' );
7171
7272 ###
 73+# Setting this option to true before including this file to enable the old
 74+# Type: namespace that SMW used up to version 1.5.*. This should only be
 75+# done to make the pages of this namespace temporarily accessible in order to
 76+# move their content to other pages. If the namespace is not registered, then
 77+# existing pages in this namespace cannot be found in the wiki.
 78+##
 79+if ( !isset( $smwgHistoricTypeNamespace ) ) {
 80+ $smwgHistoricTypeNamespace = false;
 81+}
 82+##
 83+
 84+###
7385 # If you already have custom namespaces on your site, insert
7486 # $smwgNamespaceIndex = ???;
7587 # into your LocalSettings.php *before* including this file. The number ??? must
@@ -173,6 +185,7 @@
174186 # performance problems.
175187 ##
176188 $smwgSearchByPropertyFuzzy = true;
 189+##
177190
178191 ###
179192 # Number results shown in the listings on pages in the namespaces Property,

Follow-up revisions

RevisionCommit summaryAuthorDate
r89313follow up to r88567, fix bug 29240jeroendedauw01:38, 2 June 2011

Status & tagging log