Index: branches/wmf/1.17wmf1/includes/filerepo/LocalFile.php |
— | — | @@ -1214,9 +1214,28 @@ |
1215 | 1215 | /** scaleHeight inherited */ |
1216 | 1216 | /** getImageSize inherited */ |
1217 | 1217 | |
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 | + } |
1220 | 1224 | |
| 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 | + |
1221 | 1240 | function getDescription() { |
1222 | 1241 | $this->load(); |
1223 | 1242 | return $this->description; |
Index: branches/wmf/1.17wmf1/includes/filerepo/ForeignDBFile.php |
— | — | @@ -44,4 +44,14 @@ |
45 | 45 | function move( $target ) { |
46 | 46 | $this->readOnlyError(); |
47 | 47 | } |
| 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 | + } |
48 | 58 | } |
Index: branches/wmf/1.17wmf1/includes/filerepo/File.php |
— | — | @@ -1099,19 +1099,8 @@ |
1100 | 1100 | |
1101 | 1101 | /** |
1102 | 1102 | * 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. |
1104 | 1103 | */ |
1105 | 1104 | 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 | | - |
1116 | 1105 | global $wgMemc, $wgLang; |
1117 | 1106 | if ( !$this->repo->fetchDescription ) { |
1118 | 1107 | return false; |
Property changes on: branches/wmf/1.17wmf1/includes/filerepo/File.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1119 | 1108 | Merged /trunk/phase3/includes/filerepo/File.php:r82836,82853,82858,83114 |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryAllpages.php |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | } |
189 | 189 | |
190 | 190 | public function getAllowedParams() { |
191 | | - global $wgRestrictionTypes, $wgRestrictionLevels; |
| 191 | + global $wgRestrictionLevels; |
192 | 192 | |
193 | 193 | return array( |
194 | 194 | 'from' => null, |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | ApiBase::PARAM_TYPE => 'integer', |
214 | 214 | ), |
215 | 215 | 'prtype' => array( |
216 | | - ApiBase::PARAM_TYPE => $wgRestrictionTypes, |
| 216 | + ApiBase::PARAM_TYPE => Title::getFilteredRestrictionTypes( true ), |
217 | 217 | ApiBase::PARAM_ISMULTI => true |
218 | 218 | ), |
219 | 219 | 'prlevel' => array( |
Index: branches/wmf/1.17wmf1/includes/Title.php |
— | — | @@ -4184,18 +4184,35 @@ |
4185 | 4185 | * @return array applicable restriction types |
4186 | 4186 | */ |
4187 | 4187 | public function getRestrictionTypes() { |
4188 | | - global $wgRestrictionTypes; |
| 4188 | + $types = self::getFilteredRestrictionTypes( $this->exists() ); |
4189 | 4189 | |
4190 | | - $types = $this->exists() ? $wgRestrictionTypes : array( 'create' ); |
4191 | | - |
4192 | 4190 | if ( $this->getNamespace() != NS_FILE ) { |
| 4191 | + # Remove the upload restriction for non-file titles |
4193 | 4192 | $types = array_diff( $types, array( 'upload' ) ); |
4194 | 4193 | } |
4195 | 4194 | |
4196 | 4195 | wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); |
4197 | | - |
4198 | 4196 | return $types; |
4199 | 4197 | } |
| 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 | + } |
4200 | 4217 | |
4201 | 4218 | /** |
4202 | 4219 | * 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 |
4203 | 4220 | Merged /trunk/phase3/includes/Title.php:r82836,82853,82858,83114 |
Index: branches/wmf/1.17wmf1/includes/DefaultSettings.php |
— | — | @@ -3340,9 +3340,9 @@ |
3341 | 3341 | * You probably shouldn't change this. |
3342 | 3342 | * Translated through restriction-* messages. |
3343 | 3343 | * 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) |
3345 | 3345 | */ |
3346 | | -$wgRestrictionTypes = array( 'edit', 'move', 'upload' ); |
| 3346 | +$wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' ); |
3347 | 3347 | |
3348 | 3348 | /** |
3349 | 3349 | * 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 |
3350 | 3350 | Merged /trunk/phase3/includes/DefaultSettings.php:r82836,82853,82858,83114 |
Index: branches/wmf/1.17wmf1/includes/specials/SpecialProtectedpages.php |
— | — | @@ -224,13 +224,11 @@ |
225 | 225 | * @return string Formatted HTML |
226 | 226 | */ |
227 | 227 | protected function getTypeMenu( $pr_type ) { |
228 | | - global $wgRestrictionTypes; |
229 | | - |
230 | 228 | $m = array(); // Temporary array |
231 | 229 | $options = array(); |
232 | 230 | |
233 | 231 | // First pass to load the log names |
234 | | - foreach( $wgRestrictionTypes as $type ) { |
| 232 | + foreach( Title::getFilteredRestrictionTypes( true ) as $type ) { |
235 | 233 | $text = wfMsg("restriction-$type"); |
236 | 234 | $m[$text] = $type; |
237 | 235 | } |
Index: branches/wmf/1.17wmf1/languages/classes/LanguageFi.php |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | if ( !is_numeric( $item ) ) { |
120 | 120 | if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) { |
121 | 121 | list( $yyyy, $mm, $dd ) = explode( '-', $item ); |
122 | | - $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000" ); |
| 122 | + $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" ); |
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | if ( isset( $weekds[$item] ) ) { |
Index: branches/wmf/1.17wmf1/RELEASE-NOTES |
— | — | @@ -492,6 +492,8 @@ |
493 | 493 | adding overflow:hidden to h1,h2,h3,h4,h5,h6 (also fixes editsection bunching). |
494 | 494 | * (bug 26708) Remove background-color:white from tables in Monobook and Vector. |
495 | 495 | * (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. |
496 | 498 | |
497 | 499 | === API changes in 1.17 === |
498 | 500 | * BREAKING CHANGE: action=patrol now requires POST |
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES |
___________________________________________________________________ |
Modified: svn:mergeinfo |
499 | 501 | Merged /trunk/phase3/RELEASE-NOTES:r82836,82853,82858,83114 |