Last modified: 2010-05-15 15:28:16 UTC
Actually $wgWhitelistEdit is a boolean, set it to false and all unlogged users may edit pages (unless protected of course), set it to true and users must be logged to edit pages. I need more details here, so I have modified $wgWhitelistEdit to an array. It now works like this: set $wgWhitelistEdit to false or true, it is backward compatible. Or set it to an array of strings, each row describing a page or set of pages freely editable. If not matche is found, the user is asked to log himself.
Here is the patch doing what I want: --- mediawiki-1.3.7.orig/includes/EditPage.php Wed Sep 8 03:42:28 2004 +++ mediawiki-1.3.7/includes/EditPage.php Tue Oct 26 11:29:16 2004 @@ -41,8 +41,18 @@ return; } if ( !$wgUser->getID() && $wgWhitelistEdit ) { - $this->userNotLoggedInPage(); - return; + $editlocked=true; + if ( is_array($wgWhitelistEdit) ) { + for ($i=0; $i<count($wgWhitelistEdit); $i++) { + if (preg_match($wgWhitelistEdit[$i],$this->mTitle->getPrefixedText())) { + $editlocked=false; + } + } + } + if ( $editlocked ) { + $this->userNotLoggedInPage(); + return; + } } if ( wfReadOnly() ) { if( $this->save || $this->preview ) { @@ -143,8 +153,18 @@ return; } if ( !$wgUser->getID() && $wgWhitelistEdit ) { - $this->userNotLoggedInPage(); - return; + $editlocked=true; + if ( is_array($wgWhitelistEdit) ) { + for ($i=0; $i<count($wgWhitelistEdit); $i++) { + if (preg_match($wgWhitelistEdit[$i],$this->mTitle->getPrefixedText())) { + $editlocked=false; + } + } + } + if ( $editlocked ) { + $this->userNotLoggedInPage(); + return; + } } if ( wfReadOnly() ) { $wgOut->readOnlyPage();
Created attachment 114 [details] parse the wgWhitelistEdit to eventually allow page editing Sorry, I'am not familiar with bugzilla, I've already posted the patch as a plain text comment...
Never change the assignment of a bug without CCing wikibugs-l.
I agree that wgWhitelistEdit should take an array of web pages on which anonymous edits are allowed. However, I think that it should be consistent with wgWhitelistRead and contain the names of pages, not regular expressions. That is, in the patch there should be a simple in_array( $this->mTitle->getPrefixedText(), $wgWhitelistEdit ) test instead of using preg_match which requires the array elements to be regular expressions, which is inconsistent with wgWhitelistRead.
*** This bug has been marked as a duplicate of 1924 ***