r82853 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82852‎ | r82853 | r82854 >
Date:13:51, 26 February 2011
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
(bug 27700) The upload protection can now also be set for files that do not exist.
Sort of follow-up to r79655, adds create to $wgRestrictionTypes in DefaultSettings.php as well and removes it when not applicable.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -4118,13 +4118,21 @@
41194119 public function getRestrictionTypes() {
41204120 global $wgRestrictionTypes;
41214121
4122 - $types = $this->exists() ? $wgRestrictionTypes : array( 'create' );
 4122+ $types = $wgRestrictionTypes;
41234123
 4124+ if ( !$this->exists() ) {
 4125+ # Only the create and upload types are applicable for non-existing titles
 4126+ $types = array_intersect( $types, array( 'create', 'upload' ) );
 4127+ }
41244128 if ( $this->getNamespace() != NS_FILE ) {
 4129+ # Remove the upload restriction for non-file titles
41254130 $types = array_diff( $types, array( 'upload' ) );
41264131 }
41274132
41284133 wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
 4134+
 4135+ wfDebug( __METHOD__ . ': applicable restriction types for ' .
 4136+ $this->getPrefixedText() . ' are ' . implode( ',', $types ) );
41294137
41304138 return $types;
41314139 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3371,9 +3371,9 @@
33723372 * You probably shouldn't change this.
33733373 * Translated through restriction-* messages.
33743374 * Title::getRestrictionTypes() will remove restrictions that are not
3375 - * applicable to a specific title (upload currently)
 3375+ * applicable to a specific title (create and upload)
33763376 */
3377 -$wgRestrictionTypes = array( 'edit', 'move', 'upload' );
 3377+$wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' );
33783378
33793379 /**
33803380 * Rights which can be required for each protection level (via action=protect)
Index: trunk/phase3/RELEASE-NOTES
@@ -144,6 +144,8 @@
145145 * (bug 27560) Search queries no longer fail in walloon language
146146 * (bug 27679) Broken embedded files with special characters longer double HTML
147147 escaped
 148+* (bug 27700) The upload protection can now also be set for files that do not
 149+ exist.
148150
149151
150152 === API changes in 1.18 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r82858Follow-up r82853: Filter out create restriction from SpecialProtectedPages an...btongminh16:29, 26 February 2011
r831541.17wmf1: MFT r82836, r82853, r82858, r83114catrope18:19, 3 March 2011
r85354MFT r82518, r82530, r82538, r82547, r82550, r82565, r82572, r82608, r82696, r...demon18:25, 4 April 2011
r96601Partial revert of r65898 (bug 27700). Callers should check 'create' and Title...aaron19:28, 8 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79655(bug 26574) Added 'upload' to $wgRestrictionTypes, allowing upload protected ...btongminh19:17, 5 January 2011

Comments

#Comment by Duplicatebug (talk | contribs)   14:43, 26 February 2011

Changes to $wgRestrictionTypes also makes it queryable by list=allpages and Special:ProtectedPages. But that is wrong, because the api and the special page cannot list create protection pages. list=protectedtitles and Special:ProtectedTitles do that job.

Status & tagging log