(bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected pages...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 5 Jan 2011 19:17:36 +0000 (19:17 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 5 Jan 2011 19:17:36 +0000 (19:17 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/Skin.php
includes/Title.php

index 500e715..a1cbb4c 100644 (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
index 8b30f5e..3da6ec7 100644 (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)
index 8d12aa1..849223f 100644 (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 ) ) {
index d7fb38b..9bb7137 100644 (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;
        }