Index: trunk/phase3/includes/Title.php |
— | — | @@ -4116,14 +4116,15 @@ |
4117 | 4117 | */ |
4118 | 4118 | public function getRestrictionTypes() { |
4119 | 4119 | global $wgRestrictionTypes; |
| 4120 | + |
4120 | 4121 | $types = $this->exists() ? $wgRestrictionTypes : array( 'create' ); |
4121 | 4122 | |
4122 | | - if ( $this->getNamespace() == NS_FILE ) { |
4123 | | - $types[] = 'upload'; |
| 4123 | + if ( $this->getNamespace() != NS_FILE && in_array( 'upload', $types ) ) { |
| 4124 | + $types = array_diff( $types, array( 'upload' ) ); |
4124 | 4125 | } |
4125 | | - |
| 4126 | + |
4126 | 4127 | wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); |
4127 | | - |
| 4128 | + |
4128 | 4129 | return $types; |
4129 | 4130 | } |
4130 | 4131 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3344,8 +3344,10 @@ |
3345 | 3345 | * Set of available actions that can be restricted via action=protect |
3346 | 3346 | * You probably shouldn't change this. |
3347 | 3347 | * Translated through restriction-* messages. |
| 3348 | + * Title::getRestrictionTypes() will remove restrictions that are not |
| 3349 | + * applicable to a specific title (upload currently) |
3348 | 3350 | */ |
3349 | | -$wgRestrictionTypes = array( 'edit', 'move' ); |
| 3351 | +$wgRestrictionTypes = array( 'edit', 'move', 'upload' ); |
3350 | 3352 | |
3351 | 3353 | /** |
3352 | 3354 | * Rights which can be required for each protection level (via action=protect) |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -504,7 +504,7 @@ |
505 | 505 | 'wgCategories' => $wgOut->getCategories(), |
506 | 506 | 'wgBreakFrames' => $wgOut->getFrameOptions() == 'DENY', |
507 | 507 | ); |
508 | | - foreach ( $wgRestrictionTypes as $type ) { |
| 508 | + foreach ( $wgTitle->getRestrictionTypes() as $type ) { |
509 | 509 | $vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type ); |
510 | 510 | } |
511 | 511 | if ( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -56,6 +56,9 @@ |
57 | 57 | link has a % sign in it. |
58 | 58 | * (bug 26412) Search results headers no longer show a bogus edit link. |
59 | 59 | * (bug 26540) Fixed wrong call to applyPatch in MysqlUpdater |
| 60 | +* (bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected |
| 61 | + pages to be queried via the API and Special:ProtectedPages, and allowing |
| 62 | + disabling upload protection by removing it from $wgRestrictionTypes. |
60 | 63 | |
61 | 64 | === API changes in 1.18 === |
62 | 65 | * (bug 26339) Throw warning when truncating an overlarge API result |