(bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected pages to be queried via the API and Special:ProtectedPages, and allowing disabling upload protection by removing it from $wgRestrictionTypes.

This commit is contained in:
Bryan Tong Minh 2011-01-05 19:17:36 +00:00
parent bfce19b61b
commit 718ff89310
4 changed files with 12 additions and 6 deletions

View file

@ -56,6 +56,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
link has a % sign in it.
* (bug 26412) Search results headers no longer show a bogus edit link.
* (bug 26540) Fixed wrong call to applyPatch in MysqlUpdater
* (bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected
pages to be queried via the API and Special:ProtectedPages, and allowing
disabling upload protection by removing it from $wgRestrictionTypes.
=== API changes in 1.18 ===
* (bug 26339) Throw warning when truncating an overlarge API result

View file

@ -3344,8 +3344,10 @@ $wgGroupsRemoveFromSelf = array();
* Set of available actions that can be restricted via action=protect
* You probably shouldn't change this.
* Translated through restriction-* messages.
* Title::getRestrictionTypes() will remove restrictions that are not
* applicable to a specific title (upload currently)
*/
$wgRestrictionTypes = array( 'edit', 'move' );
$wgRestrictionTypes = array( 'edit', 'move', 'upload' );
/**
* Rights which can be required for each protection level (via action=protect)

View file

@ -504,7 +504,7 @@ class Skin extends Linker {
'wgCategories' => $wgOut->getCategories(),
'wgBreakFrames' => $wgOut->getFrameOptions() == 'DENY',
);
foreach ( $wgRestrictionTypes as $type ) {
foreach ( $wgTitle->getRestrictionTypes() as $type ) {
$vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type );
}
if ( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {

View file

@ -4116,14 +4116,15 @@ class Title {
*/
public function getRestrictionTypes() {
global $wgRestrictionTypes;
$types = $this->exists() ? $wgRestrictionTypes : array( 'create' );
if ( $this->getNamespace() == NS_FILE ) {
$types[] = 'upload';
if ( $this->getNamespace() != NS_FILE && in_array( 'upload', $types ) ) {
$types = array_diff( $types, array( 'upload' ) );
}
wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
return $types;
}