Last modified: 2010-05-15 15:28:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T2784, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 784 - change $wgWhitelistEdit to an array
change $wgWhitelistEdit to an array
Status: RESOLVED DUPLICATE of bug 1924
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.3.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Olivier Guerrier
: patch
Depends on:
Blocks: 2422
  Show dependency treegraph
 
Reported: 2004-10-26 10:11 UTC by Olivier Guerrier
Modified: 2010-05-15 15:28 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
parse the wgWhitelistEdit to eventually allow page editing (1.17 KB, patch)
2004-10-26 18:12 UTC, Olivier Guerrier
Details

Description Olivier Guerrier 2004-10-26 10:11:32 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.
Comment 1 Olivier Guerrier 2004-10-26 10:12:50 UTC
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();
Comment 2 Olivier Guerrier 2004-10-26 18:12:57 UTC
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...
Comment 3 Brion Vibber 2004-10-26 20:34:18 UTC
Never change the assignment of a bug without CCing wikibugs-l.
Comment 4 Hendrik Kueck 2004-11-10 04:39:51 UTC
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.
Comment 5 Brion Vibber 2005-06-25 00:21:51 UTC

*** This bug has been marked as a duplicate of 1924 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links