Page MenuHomePhabricator

change $wgWhitelistEdit to an array
Closed, ResolvedPublic

Description

Author: olivier+bugzilla.wikipedia

Description:
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.


Version: 1.3.x
Severity: enhancement

Details

Reference
bz784

Revisions and Commits

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:01 PM
bzimport set Reference to bz784.

olivier+bugzilla.wikipedia wrote:

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();

olivier+bugzilla.wikipedia wrote:

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...

Attached:

Never change the assignment of a bug without CCing wikibugs-l.

9fu7bn102 wrote:

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 ***
Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:15 AM
Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:21 AM
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
epriestley added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:21 AM
epriestley added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:21 AM
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).
Diffusion added a commit: Unknown Object (Diffusion Commit).