r83154 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83153‎ | r83154 | r83155 >
Date:18:19, 3 March 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: MFT r82836, r82853, r82858, r83114
Modified paths:
  • /branches/wmf/1.17wmf1/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.17wmf1/includes/DefaultSettings.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/Title.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/api/ApiQueryAllpages.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/filerepo/File.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/filerepo/ForeignDBFile.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/filerepo/LocalFile.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialProtectedpages.php (modified) (history)
  • /branches/wmf/1.17wmf1/languages/classes/LanguageFi.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/filerepo/LocalFile.php
@@ -1214,9 +1214,28 @@
12151215 /** scaleHeight inherited */
12161216 /** getImageSize inherited */
12171217
1218 - /** getDescriptionUrl inherited */
1219 - /** getDescriptionText inherited */
 1218+ /**
 1219+ * Get the URL of the file description page.
 1220+ */
 1221+ function getDescriptionUrl() {
 1222+ return $this->title->getLocalUrl();
 1223+ }
12201224
 1225+ /**
 1226+ * Get the HTML text of the description page
 1227+ * This is not used by ImagePage for local files, since (among other things)
 1228+ * it skips the parser cache.
 1229+ */
 1230+ function getDescriptionText() {
 1231+ global $wgParser;
 1232+ $revision = Revision::newFromTitle( $this->title );
 1233+ if ( !$revision ) return false;
 1234+ $text = $revision->getText();
 1235+ if ( !$text ) return false;
 1236+ $pout = $wgParser->parse( $text, $this->title, new ParserOptions() );
 1237+ return $pout->getText();
 1238+ }
 1239+
12211240 function getDescription() {
12221241 $this->load();
12231242 return $this->description;
Index: branches/wmf/1.17wmf1/includes/filerepo/ForeignDBFile.php
@@ -44,4 +44,14 @@
4545 function move( $target ) {
4646 $this->readOnlyError();
4747 }
 48+
 49+ function getDescriptionUrl() {
 50+ // Restore remote behaviour
 51+ return File::getDescriptionUrl();
 52+ }
 53+
 54+ function getDescriptionText() {
 55+ // Restore remote behaviour
 56+ return File::getDescriptionText();
 57+ }
4858 }
Index: branches/wmf/1.17wmf1/includes/filerepo/File.php
@@ -1099,19 +1099,8 @@
11001100
11011101 /**
11021102 * Get the HTML text of the description page, if available
1103 - * For local files ImagePage does not use it, because it skips the parser cache.
11041103 */
11051104 function getDescriptionText() {
1106 - if( $this->isLocal() ) {
1107 - global $wgParser;
1108 - $revision = Revision::newFromTitle( $this->title );
1109 - if ( !$revision ) return false;
1110 - $text = $revision->getText();
1111 - if ( !$text ) return false;
1112 - $pout = $wgParser->parse( $text, $this->title, new ParserOptions() );
1113 - return $pout->getText();
1114 - }
1115 -
11161105 global $wgMemc, $wgLang;
11171106 if ( !$this->repo->fetchDescription ) {
11181107 return false;
Property changes on: branches/wmf/1.17wmf1/includes/filerepo/File.php
___________________________________________________________________
Modified: svn:mergeinfo
11191108 Merged /trunk/phase3/includes/filerepo/File.php:r82836,82853,82858,83114
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryAllpages.php
@@ -187,7 +187,7 @@
188188 }
189189
190190 public function getAllowedParams() {
191 - global $wgRestrictionTypes, $wgRestrictionLevels;
 191+ global $wgRestrictionLevels;
192192
193193 return array(
194194 'from' => null,
@@ -212,7 +212,7 @@
213213 ApiBase::PARAM_TYPE => 'integer',
214214 ),
215215 'prtype' => array(
216 - ApiBase::PARAM_TYPE => $wgRestrictionTypes,
 216+ ApiBase::PARAM_TYPE => Title::getFilteredRestrictionTypes( true ),
217217 ApiBase::PARAM_ISMULTI => true
218218 ),
219219 'prlevel' => array(
Index: branches/wmf/1.17wmf1/includes/Title.php
@@ -4184,18 +4184,35 @@
41854185 * @return array applicable restriction types
41864186 */
41874187 public function getRestrictionTypes() {
4188 - global $wgRestrictionTypes;
 4188+ $types = self::getFilteredRestrictionTypes( $this->exists() );
41894189
4190 - $types = $this->exists() ? $wgRestrictionTypes : array( 'create' );
4191 -
41924190 if ( $this->getNamespace() != NS_FILE ) {
 4191+ # Remove the upload restriction for non-file titles
41934192 $types = array_diff( $types, array( 'upload' ) );
41944193 }
41954194
41964195 wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) );
4197 -
41984196 return $types;
41994197 }
 4198+ /**
 4199+ * Get a filtered list of all restriction types supported by this wiki.
 4200+ * @param bool $exists True to get all restriction types that apply to
 4201+ * titles that do exist, False for all restriction types that apply to
 4202+ * titles that do not exist
 4203+ * @return array
 4204+ */
 4205+ public static function getFilteredRestrictionTypes( $exists = true ) {
 4206+ global $wgRestrictionTypes;
 4207+ $types = $wgRestrictionTypes;
 4208+ if ( $exists ) {
 4209+ # Remove the create restriction for existing titles
 4210+ $types = array_diff( $types, array( 'create' ) );
 4211+ } else {
 4212+ # Only the create and upload restrictions apply to non-existing titles
 4213+ $types = array_intersect( $types, array( 'create', 'upload' ) );
 4214+ }
 4215+ return $types;
 4216+ }
42004217
42014218 /**
42024219 * Returns the raw sort key to be used for categories, with the specified
Property changes on: branches/wmf/1.17wmf1/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
42034220 Merged /trunk/phase3/includes/Title.php:r82836,82853,82858,83114
Index: branches/wmf/1.17wmf1/includes/DefaultSettings.php
@@ -3340,9 +3340,9 @@
33413341 * You probably shouldn't change this.
33423342 * Translated through restriction-* messages.
33433343 * Title::getRestrictionTypes() will remove restrictions that are not
3344 - * applicable to a specific title (upload currently)
 3344+ * applicable to a specific title (create and upload)
33453345 */
3346 -$wgRestrictionTypes = array( 'edit', 'move', 'upload' );
 3346+$wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' );
33473347
33483348 /**
33493349 * Rights which can be required for each protection level (via action=protect)
Property changes on: branches/wmf/1.17wmf1/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
33503350 Merged /trunk/phase3/includes/DefaultSettings.php:r82836,82853,82858,83114
Index: branches/wmf/1.17wmf1/includes/specials/SpecialProtectedpages.php
@@ -224,13 +224,11 @@
225225 * @return string Formatted HTML
226226 */
227227 protected function getTypeMenu( $pr_type ) {
228 - global $wgRestrictionTypes;
229 -
230228 $m = array(); // Temporary array
231229 $options = array();
232230
233231 // First pass to load the log names
234 - foreach( $wgRestrictionTypes as $type ) {
 232+ foreach( Title::getFilteredRestrictionTypes( true ) as $type ) {
235233 $text = wfMsg("restriction-$type");
236234 $m[$text] = $type;
237235 }
Index: branches/wmf/1.17wmf1/languages/classes/LanguageFi.php
@@ -118,7 +118,7 @@
119119 if ( !is_numeric( $item ) ) {
120120 if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
121121 list( $yyyy, $mm, $dd ) = explode( '-', $item );
122 - $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000" );
 122+ $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
123123 continue;
124124 }
125125 if ( isset( $weekds[$item] ) ) {
Index: branches/wmf/1.17wmf1/RELEASE-NOTES
@@ -492,6 +492,8 @@
493493 adding overflow:hidden to h1,h2,h3,h4,h5,h6 (also fixes editsection bunching).
494494 * (bug 26708) Remove background-color:white from tables in Monobook and Vector.
495495 * (bug 27560) Search queries no longer fail in walloon language
 496+* (bug 27700) The upload protection can now also be set for files that do not
 497+ exist.
496498
497499 === API changes in 1.17 ===
498500 * BREAKING CHANGE: action=patrol now requires POST
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
499501 Merged /trunk/phase3/RELEASE-NOTES:r82836,82853,82858,83114

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82836Fix bug that caused "Non-string key given" exception....nikerabbit08:19, 26 February 2011
r82853(bug 27700) The upload protection can now also be set for files that do not e...btongminh13:51, 26 February 2011
r82858Follow-up r82853: Filter out create restriction from SpecialProtectedPages an...btongminh16:29, 26 February 2011
r83114Revert r69907, r69908, r70264, r70296: introduces bug 27477....btongminh21:06, 2 March 2011

Status & tagging log