Last modified: 2007-05-08 16:15:37 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 T4073, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 2073 - Default page restrictions for each namespace
Default page restrictions for each namespace
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
: 3126 (view as bug list)
Depends on:
Blocks: 2422
  Show dependency treegraph
 
Reported: 2005-05-05 10:33 UTC by Zhen Lin
Modified: 2007-05-08 16:15 UTC (History)
2 users (show)

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


Attachments
Proposed patch (2.57 KB, patch)
2005-05-05 10:36 UTC, Zhen Lin
Details
Patch against HEAD of phase3 module (4.06 KB, patch)
2005-05-23 03:55 UTC, Zhen Lin
Details
Brace mismatch correction (820 bytes, patch)
2005-05-23 10:56 UTC, Zhen Lin
Details
Patch against 1.5beta1 (3.38 KB, patch)
2005-06-26 11:57 UTC, Zhen Lin
Details
Patch against 1.5.6 (3.31 KB, patch)
2006-01-25 14:11 UTC, Zhen Lin
Details
Extension for MediaWiki 1.6 and later (1.47 KB, text/plain)
2006-07-05 02:21 UTC, Zhen Lin
Details

Description Zhen Lin 2005-05-05 10:33:43 UTC
This feature may be useful in some circumstances, for instance, a
late-Nupedia-like set up where the general public can edit draft pages, while
the main article namespace is protected  (by default) from
editing/creation/moving etc.
Comment 1 Zhen Lin 2005-05-05 10:36:07 UTC
Created attachment 499 [details]
Proposed patch

Explanation:

Title.php is modified so that new articles can't be created in protected
namespaces. 

Article.php is modified so that new articles will be created with the default
restrictions.

DefaultSettings.php is modified so that there are some example default
restrictions.
Comment 2 Anders Wegge Jakobsen 2005-05-22 13:25:06 UTC
* Does not apply to the current HEAD.
* What happens when requesting for restrictions missing in $wgDefaultRestrictions?
* Why not use NS_MAIN, NS_MEDIAWIKI instead of numbers in DefaultSettings.php?
* Documentation in DefaultSettings.php could be better
* The patch doesn't follow the coding conventions in all places:
(! isset($restrictions)) should be (! isset( $restrictions ) )
Comment 3 Zhen Lin 2005-05-23 03:20:03 UTC
> Does not apply to the current HEAD.
It was originally written against 1.5beta1. I'll see about rewriting it for HEAD.

> What happens when requesting for restrictions missing in $wgDefaultRestrictions?
+ // check if $restrictions is still NULL. (i.e. missing entry in
$wgDefaultRestrictions.)
PHP is quite lax about missing items in arrays - it will return NULLs instead of
errors.

> Why not use NS_MAIN, NS_MEDIAWIKI instead of numbers in DefaultSettings.php?
Defines.php may not have been included yet, I'm not sure.
Comment 4 Zhen Lin 2005-05-23 03:55:15 UTC
Created attachment 561 [details]
Patch against HEAD of phase3 module

I used this command to retrieve the source, I hope that it is the correct one:
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/wikipedia co -P
phase3
Comment 5 Anders Wegge Jakobsen 2005-05-23 09:44:50 UTC
* Cosmetic: use tabs for indentation. Your patch contained spaces instaed, so it
did not apply without ignoring whitespace. 
* Useage: Did you actually test this version of the patch? I was unable to see
any results, no matter what restrictions I put on NS_MAIN. 

In Title.php/getRestrictions, I find this:

		       if ( 0 == $id ) {
			       $res = $wgDefaultRestrictions[$this->mNamespace];
             ...

             // check if $restrictions is still NULL. (i.e. missing entry in
$wgDefaultRestrictions.)
             if (! isset( $res ) ) {
               $res = '';
             ...
           } else {
             $dbr =& wfGetDB( DB_SLAVE );
             $res = $dbr->selectField( 'page', 'page_restrictions',
'page_id='.$id );
           }

 (You see the point about indentation?)

What happens is that IF a new page is edited, and IF no default restrictions are
set, THEN it's restrictions are pulled from the database. That doesn't make a
whole lot of sense to me.
Comment 6 Zhen Lin 2005-05-23 10:56:54 UTC
Created attachment 562 [details]
Brace mismatch correction

I apologise. (Profusely.) I copied & pasted from a terminal screen, so tabs
were expanded into spaces.

The brace mismatch occured when I moved code around. I thought it was a
single-line if block (I'm used to start-brace-on-new-line, you see), so I
didn't spot the error.
Comment 7 Zhen Lin 2005-06-26 11:57:44 UTC
Created attachment 650 [details]
Patch against 1.5beta1

Updated patch for 1.5beta1.
Comment 8 Zigger 2005-07-10 06:43:11 UTC
See also bug 1924 (Restricted read access for subset of wiki), which also has
patches.
Comment 9 Zigger 2005-08-12 17:06:43 UTC
*** Bug 3126 has been marked as a duplicate of this bug. ***
Comment 10 Zhen Lin 2006-01-25 14:11:00 UTC
Created attachment 1323 [details]
Patch against 1.5.6
Comment 11 Rob Church 2006-07-05 00:28:03 UTC
It might be worth closing this in favour of an extension request...
Comment 12 Zhen Lin 2006-07-05 02:21:20 UTC
Created attachment 2049 [details]
Extension for MediaWiki 1.6 and later

I rewrote it as an extension when time came to deploy MediaWiki 1.6 on the
server. It makes use of a new hook, ArticleInsertComplete, so isn't much use
for older versions...
Comment 13 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-05-08 16:15:37 UTC
This has been added in the form of $wgNamespaceRestrictions.  See
[[mw:Manual:$wgNamespaceProtection]].

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


Navigation
Links