1 Dec 2005 01:32
phase3/includes Namespace.php, 1.35.2.3, 1.35.2.4 SpecialNamespaces.php, 1.1.2.3, 1.1.2.4
Erik Moeller <eloquence <at> users.sourceforge.net>
2005-12-01 00:32:20 GMT
2005-12-01 00:32:20 GMT
Update of /cvsroot/wikipedia/phase3/includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21602/includes
Modified Files:
Tag: wikidata
Namespace.php SpecialNamespaces.php
Log Message:
don't try to create blank namespaces
debugging change code
Index: Namespace.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Namespace.php,v
retrieving revision 1.35.2.3
retrieving revision 1.35.2.4
diff -u -d -r1.35.2.3 -r1.35.2.4
--- Namespace.php 29 Nov 2005 16:46:09 -0000 1.35.2.3
+++ Namespace.php 1 Dec 2005 00:32:17 -0000 1.35.2.4
<at> <at> -284,18 +284,14 <at> <at>
/* static */
function isValidName($name) {
- if(preg_match("/[\-:]/",$name)) {
- return false;
- } else {
+ # Consist only of (at least one) valid char(s)
+ if(preg_match("/^".NS_CHAR."+$/",$name)) {
return true;
+ } else {
+ return false;
}
}
- /* static */
- function getInvalidChars() {
- return ': -';
- }
-
function getFormattedDefaultName() {
$ns=$this->getDefaultName();
return strtr($ns, '_',' ');
<at> <at> -540,7 +536,7 <at> <at>
$existsNew=array_key_exists($i, $this->names);
if($existsOld && $existsNew) {
if(strcasecmp($wgNamespaces[$index]->names[$i],
- $this->names[i])!=0) {
+ $this->names[$i])!=0) {
$nameOperations[$this->names[$i]]=NS_NAME_MODIFY;
}
} elseif($existsOld && !$existsNew) {
Index: SpecialNamespaces.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Attic/SpecialNamespaces.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- SpecialNamespaces.php 29 Nov 2005 16:46:09 -0000 1.1.2.3
+++ SpecialNamespaces.php 1 Dec 2005 00:32:18 -0000 1.1.2.4
<at> <at> -364,12 +364,16 <at> <at>
$nsname=$wgRequest->getText('nsName');
$nstalkname=$wgRequest->getText('nsTalkName');
$nscreatetalk=$wgRequest->getBool('nsCreateTalk');
+
+ if(empty($nsname)) {
+ $this->showForm(wfMsg('namespace_name_missing'));
+ }
$dbr=&wfGetDB(DB_SLAVE);
$ns=new Namespace();
$newnameindex=$ns->addName($nsname);
if(is_null($newnameindex)) {
$this->showForm(wfMsg('namespace_error',$nsname),
- wfMsg('namespace_name_illegal_characters', Namespace::getInvalidChars()));
+ wfMsg('namespace_name_illegal_characters', NS_CHAR));
return false;
}
$ns->setDefaultNameIndex($newnameindex);
<at> <at> -383,7 +387,7 <at> <at>
return false;
}
$newnamespaceindex=$nrv[NS_SAVE_ID];
- if($nscreatetalk) {
+ if($nscreatetalk && !empty($nstalkname)) {
$talkns=new Namespace();
$talkns->setParentIndex($newnamespaceindex);
$talkns->setSubpages();
<at> <at> -416,10 +420,7 <at> <at>
$newns[$nsindex]=new Namespace();
$newns[$nsindex]->setIndex($nsindex);
- # Canonical names cannot be changed through the UI
- $newns[$nsindex]->setCanonicalNameIndex(
- $ns->getCanonicalNameIndex()
- );
+ # Which default name?
$dvar="ns{$nsindex}Default";
$dreq=$wgRequest->getIntOrNull($dvar);
if(!is_null($dvar)) {
<at> <at> -450,17 +451,26 <at> <at>
}
}
+ # TODO: Newnames
foreach($ns->names as $nameindex=>$name) {
$var="ns{$nsindex}Name{$nameindex}";
if($req=$wgRequest->getText($var)) {
+ wfDebug("Name var $var contains $req\n");
$newns[$nsindex]->names[$nameindex]=$req;
}
$delvar="ns{$nsindex}Delete{$nameindex}";
if($wgRequest->getInt($delvar)) {
+ wfDebug("$delvar should be deleted.\n");
$newns[$nsindex]->removeNameByIndex($nameindex);
}
}
+ # Canonical names cannot be changed through the UI
+ if(!is_null($ns->getCanonicalNameIndex())) {
+ $cindex=$newns[$nsindex]->addName($ns->getCanonicalName());
+ $newns[$nsindex]->setCanonicalNameIndex($cindex);
+ }
+
}
foreach($newns as $nns) {
RSS Feed