Last modified: 2014-09-23 23:06:18 UTC
Created attachment 3657 [details]
First pass at a patch to complete this change.
Currently, Title::UserCan() checks the $wgNamespaceProtection to test whether the namespace is protected. Creating a separate Namespace::UserCan() would provide several benefits:
1) It helps to keep all of the namespace related code in one place.
2) Permissions on a namespace can now be tested without requiring the caller to access $wgNamespaceProtection directly.
3) It introduces a 'userCanNamespace' hook, to enable extensions to more easily customize permissions on a namespace level. The standard disclaimers about access restriction not being reliable apply, of course.
Created attachment 3658 [details]
Fix for typo in first patch
Created attachment 3685 [details]
Thank you for your patch, and my apologies it's taken so very, very long for us to respond to you.
I tried applying the patch, and -- since the trunk has changed so much since you submitted it -- it doesn't apply cleanly anymore.
$ patch < ~/test/wikimedia-dev/9977.txt
patching file hooks.txt
Hunk #1 FAILED at 561.
1 out of 1 hunk FAILED -- saving rejects to file hooks.txt.rej
patching file Title.php
Hunk #1 FAILED at 998.
Hunk #2 FAILED at 1007.
2 out of 2 hunks FAILED -- saving rejects to file Title.php.rej
patching file Namespace.php
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file Namespace.php.rej
patching file RELEASE-NOTES
Hunk #1 FAILED at 22.
1 out of 1 hunk FAILED -- saving rejects to file RELEASE-NOTES.rej
Could you install the new MediaWiki 1.18 beta per http://lists.wikimedia.org/pipermail/mediawiki-announce/2011-November/000102.html and then see whether and how you'd like to make this change? Thanks!
Probably not soon, I'm afraid. Mediawiki took so long to review my patches that I ended up making a private fork of the code after 1.10, and I'm not sure when/if I'll try to re-sync.
(In reply to comment #3)
> Could you install the new MediaWiki 1.18 beta per
> and then see whether and how you'd like to make this change? Thanks!
PLEASE PLEASE PLEASE do not base your patches off 1.18beta or any other release version. Patches submitted to Bugzilla should be against trunk and against trunk only. Sumana, please don't give people the wrong ideas ;)
Roan, I shall be clearer in the future. I figure it's fine to suggest that people install the latest release or beta just to see whether the bug they are fixing is reproducible. Of course, once someone wants to write a patch, they have to base it on trunk, and I'll be extra-clear about that. Is that reasonable?
(In reply to comment #6)
> Roan, I shall be clearer in the future. I figure it's fine to suggest that
> people install the latest release or beta just to see whether the bug they are
> fixing is reproducible. Of course, once someone wants to write a patch, they
> have to base it on trunk, and I'll be extra-clear about that. Is that
Yes, that's entirely reasonable. The wording in comment #3 was unclear and didn't give me the impression you knew patches should be against trunk. I'm glad to see you do :)