r23432 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23431‎ | r23432 | r23433 >
Date:20:18, 26 June 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 10372) namespaceDupes.php no longer ignores namespace aliases
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/namespaceDupes.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/namespaceDupes.php
@@ -1,5 +1,5 @@
22 <?php
3 -# Copyright (C) 2005 Brion Vibber <brion@pobox.com>
 3+# Copyright (C) 2005-2007 Brion Vibber <brion@pobox.com>
44 # http://www.mediawiki.org/
55 #
66 # This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,6 @@
2222
2323 /** */
2424 require_once( 'commandLine.inc' );
25 -#require_once( 'maintenance/userDupes.inc' );
2625
2726 if(isset( $options['help'] ) ) {
2827 print <<<END
@@ -30,21 +29,38 @@
3130 --fix : attempt to automatically fix errors
3231 --suffix=<text> : dupes will be renamed with correct namespace with <text>
3332 appended after the article name.
 33+ --prefix=<text> : Do an explicit check for the given title prefix
 34+ in place of the standard namespace list.
3435
3536 END;
3637 die;
3738 }
3839
3940 class NamespaceConflictChecker {
40 - function NamespaceConflictChecker( &$db ) {
41 - $this->db =& $db;
 41+ function NamespaceConflictChecker( $db ) {
 42+ $this->db = $db;
4243 }
4344
4445 function checkAll( $fix, $suffix = '' ) {
45 - global $wgContLang;
46 - $spaces = $wgContLang->getNamespaces();
 46+ global $wgContLang, $wgNamespaceAliases, $wgCanonicalNamespaceNames;
 47+
 48+ $spaces = array();
 49+ foreach( $wgContLang->getNamespaces() as $ns => $name ) {
 50+ $spaces[$name] = $ns;
 51+ }
 52+ foreach( $wgCanonicalNamespaceNames as $ns => $name ) {
 53+ $spaces[$name] = $ns;
 54+ }
 55+ foreach( $wgNamespaceAliases as $name => $ns ) {
 56+ $spaces[$name] = $ns;
 57+ }
 58+ foreach( $wgContLang->namespaceAliases as $name => $ns ) {
 59+ $spaces[$name] = $ns;
 60+ }
 61+ asort( $spaces );
 62+
4763 $ok = true;
48 - foreach( $spaces as $ns => $name ) {
 64+ foreach( $spaces as $name => $ns ) {
4965 $ok = $this->checkNamespace( $ns, $name, $fix, $suffix ) && $ok;
5066 }
5167 return $ok;
@@ -85,7 +101,7 @@
86102 }
87103
88104 function getConflicts( $ns, $name ) {
89 - $page = $this->newSchema() ? 'page' : 'cur';
 105+ $page = 'page';
90106 $table = $this->db->tableName( $page );
91107
92108 $prefix = $this->db->strencode( $name );
@@ -134,9 +150,7 @@
135151 $title = Title::makeTitleSafe( $row->namespace, $row->title );
136152 echo "... *** using suffixed form [[" . $title->getPrefixedText() . "]] ***\n";
137153 }
138 - $tables = $this->newSchema()
139 - ? array( 'page' )
140 - : array( 'cur', 'old' );
 154+ $tables = array( 'page' );
141155 foreach( $tables as $table ) {
142156 $this->resolveConflictOn( $row, $table );
143157 }
@@ -160,10 +174,6 @@
161175 echo "ok.\n";
162176 return true;
163177 }
164 -
165 - function newSchema() {
166 - return class_exists( 'Revision' );
167 - }
168178 }
169179
170180
Index: trunk/phase3/RELEASE-NOTES
@@ -212,7 +212,9 @@
213213 Special:Prefixindex; making forms prettier for RTL wikis.
214214 * (bug 10334) Replace normal spaces before percent (%) signs with non-breaking
215215 spaces
 216+* (bug 10372) namespaceDupes.php no longer ignores namespace aliases
216217
 218+
217219 == API changes since 1.10 ==
218220
219221 (For ongoing development discussion, see http://www.mediawiki.org/wiki/API)

Follow-up revisions

RevisionCommit summaryAuthorDate
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007

Status & tagging log