r12029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12028‎ | r12029 | r12030 >
Date:08:13, 9 December 2005
Author:eloquence
Status:old
Tags:
Comment:
- less braindead dupe checking
- hack for rendering namespaces that have disappeared from the DB instead of
choking
- no background for add namespace box
Modified paths:
  • /branches/wikidata/phase3/includes/Namespace.php (modified) (history)
  • /branches/wikidata/phase3/includes/SpecialNamespaces.php (modified) (history)
  • /branches/wikidata/phase3/includes/Title.php (modified) (history)
  • /branches/wikidata/phase3/languages/Language.php (modified) (history)
  • /branches/wikidata/phase3/maintenance/nsBootstrap.php (modified) (history)
  • /branches/wikidata/phase3/skins/monobook/main.css (modified) (history)

Diff [purge]

Index: branches/wikidata/phase3/maintenance/nsBootstrap.php
@@ -1,4 +1,8 @@
22 <?php
 3+// Purpose: Create entries in the namespace and namespace_names tables,
 4+// based on the configured language. Take into account existing (deprecated)
 5+// namespace settings in an update.
 6+//
37 // We can't depend on commandLine.inc because this has to be runnable from the installer
48 global $wgLanguageCode;
59 $wgContLanguageCode = $wgLanguageCode;
Index: branches/wikidata/phase3/skins/monobook/main.css
@@ -1347,7 +1347,6 @@
13481348 margin-bottom: 1em;
13491349 border: 1px solid #aaa;
13501350 padding: 1.5em 2em;
1351 - background-color: #f9f9f9;
13521351 }
13531352
13541353 /* noarticletext */
Index: branches/wikidata/phase3/includes/Title.php
@@ -1191,7 +1191,11 @@
11921192 $p = $this->mInterwiki . ':';
11931193 }
11941194 if ( 0 != $this->mNamespace && ! defined( 'MEDIAWIKI_INSTALL' ) ) {
1195 - $p .= $wgNamespaces[$this->mNamespace]->getDefaultName() . ':';
 1195+ if(array_key_exists($this->mNamespace,$wgNamespaces)) {
 1196+ $p .= $wgNamespaces[$this->mNamespace]->getDefaultName() . ':';
 1197+ } else {
 1198+ $p = wfMsg('namespace_missing_prefix').'_'.$this->mNamespace.':';
 1199+ }
11961200 }
11971201 return $p . $name;
11981202 }
Index: branches/wikidata/phase3/includes/Namespace.php
@@ -555,9 +555,8 @@
556556 $existsOld=array_key_exists($i, $wgNamespaces[$index]->names);
557557 $existsNew=array_key_exists($i, $this->names);
558558 if($existsOld && $existsNew) {
559 - if(strcasecmp($wgNamespaces[$index]->names[$i],
560 - $this->names[$i])!=0) {
561 - $nameOperations[$this->names[$i]]=NS_NAME_MODIFY;
 559+ if(strcasecmp($wgNamespaces[$index]->names[$i], $this->names[$i])!=0) {
 560+ $nameOperations[$this->names[$i]]=NS_NAME_MODIFY;
562561 }
563562 } elseif($existsOld && !$existsNew) {
564563 $nameOperations[$wgNamespaces[$index]->names[$i]]=NS_NAME_DELETE;
@@ -583,13 +582,10 @@
584583
585584 # Duplicate names
586585 foreach($wgNamespaces as $exns) {
587 - if($exns->getIndex()!=$index) {
588 - foreach($exns->names as $exname) {
589 - if($exname == $name) {
590 - $rv[NS_RESULT] = NS_NAME_ISSUES;
591 - $rv[NS_DUPLICATE_NAMES][]=$name;
592 - }
593 - }
 586+ $dupes=array_keys($exns->names,$name);
 587+ if(count($dupes)) {
 588+ $rv[NS_RESULT] = NS_NAME_ISSUES;
 589+ $rv[NS_DUPLICATE_NAMES][]=$name;
594590 }
595591 }
596592
Index: branches/wikidata/phase3/includes/SpecialNamespaces.php
@@ -387,13 +387,12 @@
388388 }
389389
390390 // We now have validated stuff, lets save for real.
391 -
392 - // TODO error handling ?
 391+ // No logic errors should occur beyond this point.
393392 $ns->save();
394393 $complete = wfMsg( 'namespace_created', $nsname );
395394
396395 if( $nscreatetalk ) {
397 - // TODO error handling ?
 396+
398397 $talkns->save();
399398 $complete .= ' '.wfMsg('talk_namespace_created');
400399 }
@@ -498,7 +497,6 @@
499498 ) {
500499 # Use this default name.
501500 $newns[$nsindex]->setDefaultNameIndex($dindex);
502 - #wfDebug("Setting index for $nsindex to $dindex!\n");
503501 } else {
504502 # We have lost our default name, perhaps it was deleted.
505503 # Get a new one if possible.
Index: branches/wikidata/phase3/languages/Language.php
@@ -2231,6 +2231,8 @@
22322232 'namespace_not_deletable_missing'=>'A namespace with the number $1 was not found.',
22332233 'namespace_not_deletable_system'=>'The namespace with the number $1 is a system namespace which is required for the operation of MediaWiki.',
22342234
 2235+# Other namespace stuff
 2236+'namespace_missing_prefix'=>'Invalid namespace',
22352237
22362238 # Inputbox extension, may be useful in other contexts as well
22372239 'tryexact' => 'Try exact match',

Status & tagging log