Index: branches/REL1_18/phase3/skins/Vector.php |
— | — | @@ -315,7 +315,7 @@ |
316 | 316 | <?php |
317 | 317 | endforeach; |
318 | 318 | if ( isset( $hook ) ) { |
319 | | - wfRunHooks( $hook, array( &$this ) ); |
| 319 | + wfRunHooks( $hook, array( &$this, true ) ); |
320 | 320 | } |
321 | 321 | ?> |
322 | 322 | </ul> |
Index: branches/REL1_18/phase3/skins/MonoBook.php |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | <?php |
264 | 264 | } |
265 | 265 | wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); |
266 | | - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); |
| 266 | + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); |
267 | 267 | ?> |
268 | 268 | </ul> |
269 | 269 | </div> |
Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18 |
— | — | @@ -86,6 +86,8 @@ |
87 | 87 | category collations. |
88 | 88 | * (bug 31233) New OutputPage::addJsConfigVars() method to make the output page specific |
89 | 89 | mw.config map extendable. |
| 90 | +* $wgEnableAutoRotation enables or disables auto-rotation. Leaving it set to |
| 91 | + null will cause MediaWiki to determine if auto-rotation is available. |
90 | 92 | |
91 | 93 | === New features in 1.18 === |
92 | 94 | * BREAKING CHANGE: action=watch / action=unwatch now requires a token. |
— | — | @@ -462,6 +464,8 @@ |
463 | 465 | to let styles easily hide or show things based on general JS availability |
464 | 466 | * (bug 18424) Special:Prefixindex and Special:Allpages paging links are |
465 | 467 | really small, and somewhat inconsistent with each other. |
| 468 | +* (bug 31213) Exception thrown when trying to move file cross-namespace |
| 469 | +* (bug 31674) Can't edit watchlist if it contains special pages |
466 | 470 | |
467 | 471 | === API changes in 1.18 === |
468 | 472 | * BREAKING CHANGE: action=watch now requires POST and token. |
Property changes on: branches/REL1_18/phase3/RELEASE-NOTES-1.18 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
469 | 473 | Merged /trunk/phase3/RELEASE-NOTES-1.18:r98426,99371,99632,99897,99910,99914,99952 |
Index: branches/REL1_18/phase3/tests/phpunit/includes/TitleTest.php |
— | — | @@ -37,4 +37,43 @@ |
38 | 38 | array( 'Special:Version/param', 'param' ), |
39 | 39 | ); |
40 | 40 | } |
| 41 | + |
| 42 | + /** |
| 43 | + * Auth-less test of Title::isValidMoveOperation |
| 44 | + * |
| 45 | + * @param string $source |
| 46 | + * @param string $target |
| 47 | + * @param array|string|true $requiredErrors |
| 48 | + * @dataProvider dataTestIsValidMoveOperation |
| 49 | + */ |
| 50 | + function testIsValidMoveOperation( $source, $target, $expected ) { |
| 51 | + $title = Title::newFromText( $source ); |
| 52 | + $nt = Title::newFromText( $target ); |
| 53 | + $errors = $title->isValidMoveOperation( $nt, false ); |
| 54 | + if ( $expected === true ) { |
| 55 | + $this->assertTrue( $errors ); |
| 56 | + } else { |
| 57 | + $errors = $this->flattenErrorsArray( $errors ); |
| 58 | + foreach ( (array)$expected as $error ) { |
| 59 | + $this->assertContains( $error, $errors ); |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + function flattenErrorsArray( $errors ) { |
| 65 | + $result = array(); |
| 66 | + foreach ( $errors as $error ) { |
| 67 | + $result[] = $error[0]; |
| 68 | + } |
| 69 | + return $result; |
| 70 | + } |
| 71 | + |
| 72 | + function dataTestIsValidMoveOperation() { |
| 73 | + return array( |
| 74 | + array( 'Test', 'Test', 'selfmove' ), |
| 75 | + array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ) |
| 76 | + ); |
| 77 | + } |
| 78 | + |
| 79 | + |
41 | 80 | } |
Index: branches/REL1_18/phase3/includes/User.php |
— | — | @@ -2571,6 +2571,14 @@ |
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | /** |
| 2575 | + * Cleans up watchlist by removing invalid entries from it |
| 2576 | + */ |
| 2577 | + public function cleanupWatchlist() { |
| 2578 | + $dbw = wfGetDB( DB_MASTER ); |
| 2579 | + $dbw->delete( 'watchlist', array( 'wl_namespace < 0', 'wl_user' => $this->getId() ), __METHOD__ ); |
| 2580 | + } |
| 2581 | + |
| 2582 | + /** |
2575 | 2583 | * Clear the user's notification timestamp for the given title. |
2576 | 2584 | * If e-notif e-mails are on, they will receive notification mails on |
2577 | 2585 | * the next change of the page if it's watched etc. |
Index: branches/REL1_18/phase3/includes/db/Database.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | * Fields can be retrieved with $row->fieldname, with fields acting like |
49 | 49 | * member variables. |
50 | 50 | * |
51 | | - * @param $res SQL result object as returned from DatabaseBase::query(), etc. |
| 51 | + * @param $res ResultWrapper|object as returned from DatabaseBase::query(), etc. |
52 | 52 | * @return Row object |
53 | 53 | * @throws DBUnexpectedError Thrown if the database returns an error |
54 | 54 | */ |
Property changes on: branches/REL1_18/phase3/includes/db/Database.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
55 | 55 | Merged /trunk/phase3/includes/db/Database.php:r99897,99910,99914,99952 |
Index: branches/REL1_18/phase3/includes/Setup.php |
— | — | @@ -187,6 +187,11 @@ |
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
| 191 | +if ( is_null( $wgEnableAutoRotation ) ) { |
| 192 | + // Only enable auto-rotation when the bitmap handler can rotate |
| 193 | + $wgEnableAutoRotation = BitmapHandler::canRotate(); |
| 194 | +} |
| 195 | + |
191 | 196 | if ( $wgRCFilterByAge ) { |
192 | 197 | # # Trim down $wgRCLinkDays so that it only lists links which are valid |
193 | 198 | # # as determined by $wgRCMaxAge. |
Index: branches/REL1_18/phase3/includes/api/ApiWatch.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $params = $this->extractRequestParams(); |
51 | 51 | $title = Title::newFromText( $params['title'] ); |
52 | 52 | |
53 | | - if ( !$title ) { |
| 53 | + if ( !$title || $title->getNamespace() < 0 ) { |
54 | 54 | $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); |
55 | 55 | } |
56 | 56 | |
Property changes on: branches/REL1_18/phase3/includes/api |
___________________________________________________________________ |
Modified: svn:mergeinfo |
57 | 57 | Merged /trunk/phase3/includes/api:r99914,99952 |
Index: branches/REL1_18/phase3/includes/media/XMPInfo.php |
— | — | @@ -557,13 +557,16 @@ |
558 | 558 | 'map_group' => 'exif', |
559 | 559 | 'mode' => XMPReader::MODE_SIMPLE, |
560 | 560 | ), |
561 | | - 'Orientation' => array( |
562 | | - 'map_group' => 'exif', |
563 | | - 'mode' => XMPReader::MODE_SIMPLE, |
564 | | - 'validate' => 'validateClosed', |
565 | | - 'choices' => array( '1' => true, '2' => true, '3' => true, '4' => true, 5 => true, |
566 | | - '6' => true, '7' => true, '8' => true ), |
567 | | - ), |
| 561 | + /**** Do not extract this property |
| 562 | + * It interferes with auto exif rotation. |
| 563 | + * 'Orientation' => array( |
| 564 | + * 'map_group' => 'exif', |
| 565 | + * 'mode' => XMPReader::MODE_SIMPLE, |
| 566 | + * 'validate' => 'validateClosed', |
| 567 | + * 'choices' => array( '1' => true, '2' => true, '3' => true, '4' => true, 5 => true, |
| 568 | + * '6' => true, '7' => true, '8' => true ), |
| 569 | + *), |
| 570 | + ******/ |
568 | 571 | 'PhotometricInterpretation' => array( |
569 | 572 | 'map_group' => 'exif', |
570 | 573 | 'mode' => XMPReader::MODE_SIMPLE, |
Index: branches/REL1_18/phase3/includes/media/ExifBitmap.php |
— | — | @@ -162,6 +162,11 @@ |
163 | 163 | * @return int 0, 90, 180 or 270 |
164 | 164 | */ |
165 | 165 | public function getRotation( $file ) { |
| 166 | + global $wgEnableAutoRotation; |
| 167 | + if ( !$wgEnableAutoRotation ) { |
| 168 | + return 0; |
| 169 | + } |
| 170 | + |
166 | 171 | $data = $file->getMetadata(); |
167 | 172 | return $this->getRotationForExif( $data ); |
168 | 173 | } |
Property changes on: branches/REL1_18/phase3/includes/media/ExifBitmap.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
169 | 174 | Merged /trunk/phase3/includes/media/ExifBitmap.php:r99910,99914,99952 |
Index: branches/REL1_18/phase3/includes/Title.php |
— | — | @@ -3105,10 +3105,8 @@ |
3106 | 3106 | |
3107 | 3107 | $errors = array(); |
3108 | 3108 | |
3109 | | - if ( $nt->getNamespace() != NS_FILE ) { |
3110 | | - $errors[] = array( 'imagenocrossnamespace' ); |
3111 | | - } |
3112 | | - |
| 3109 | + // wfFindFile( $nt ) / wfLocalFile( $nt ) is not allowed until below |
| 3110 | + |
3113 | 3111 | $file = wfLocalFile( $this ); |
3114 | 3112 | if ( $file->exists() ) { |
3115 | 3113 | if ( $nt->getText() != wfStripIllegalFilenameChars( $nt->getText() ) ) { |
— | — | @@ -3118,6 +3116,15 @@ |
3119 | 3117 | $errors[] = array( 'imagetypemismatch' ); |
3120 | 3118 | } |
3121 | 3119 | } |
| 3120 | + |
| 3121 | + if ( $nt->getNamespace() != NS_FILE ) { |
| 3122 | + $errors[] = array( 'imagenocrossnamespace' ); |
| 3123 | + // From here we want to do checks on a file object, so if we can't |
| 3124 | + // create one, we must return. |
| 3125 | + return $errors; |
| 3126 | + } |
| 3127 | + |
| 3128 | + // wfFindFile( $nt ) / wfLocalFile( $nt ) is allowed below here |
3122 | 3129 | |
3123 | 3130 | $destFile = wfLocalFile( $nt ); |
3124 | 3131 | if ( !$wgUser->isAllowed( 'reupload-shared' ) && !$destFile->exists() && wfFindFile( $nt ) ) { |
Property changes on: branches/REL1_18/phase3/includes/Title.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3125 | 3132 | Merged /trunk/phase3/includes/Title.php:r98426,99371,99632,99897,99910,99914,99952 |
Index: branches/REL1_18/phase3/includes/DefaultSettings.php |
— | — | @@ -739,6 +739,12 @@ |
740 | 740 | /** Obsolete, always true, kept for compatibility with extensions */ |
741 | 741 | $wgUseImageResize = true; |
742 | 742 | |
| 743 | +/** |
| 744 | + * If set to true, images that contain certain the exif orientation tag will |
| 745 | + * be rotated accordingly. If set to null, try to auto-detect whether a scaler |
| 746 | + * is available that can rotate. |
| 747 | + */ |
| 748 | +$wgEnableAutoRotation = null; |
743 | 749 | |
744 | 750 | /** |
745 | 751 | * Internal name of virus scanner. This servers as a key to the |
Index: branches/REL1_18/phase3/includes/specials/SpecialEditWatchlist.php |
— | — | @@ -392,8 +392,13 @@ |
393 | 393 | |
394 | 394 | $fields = array(); |
395 | 395 | |
| 396 | + $haveInvalidNamespaces = false; |
396 | 397 | foreach( $this->getWatchlistInfo() as $namespace => $pages ){ |
397 | | - |
| 398 | + if ( $namespace < 0 ) { |
| 399 | + $haveInvalidNamespaces = true; |
| 400 | + continue; |
| 401 | + } |
| 402 | + |
398 | 403 | $namespace == NS_MAIN |
399 | 404 | ? wfMsgHtml( 'blanknamespace' ) |
400 | 405 | : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) ); |
— | — | @@ -410,6 +415,10 @@ |
411 | 416 | $fields['TitlesNs'.$namespace]['options'][$text] = $title->getEscapedText(); |
412 | 417 | } |
413 | 418 | } |
| 419 | + if ( $haveInvalidNamespaces ) { |
| 420 | + wfDebug( "User {$this->getContext()->getUser()->getId()} has invalid watchlist entries, clening up...\n" ); |
| 421 | + $this->getContext()->getUser()->cleanupWatchlist(); |
| 422 | + } |
414 | 423 | |
415 | 424 | $form = new EditWatchlistNormalHTMLForm( $fields ); |
416 | 425 | $form->setTitle( $this->getTitle() ); |
Property changes on: branches/REL1_18/phase3/includes/specials |
___________________________________________________________________ |
Modified: svn:mergeinfo |
417 | 426 | Merged /trunk/phase3/includes/specials:r99914,99952 |
Property changes on: branches/REL1_18/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
418 | 427 | Merged /trunk/phase3/includes:r98426,99371,99632,99897,99910,99914,99952 |
Property changes on: branches/REL1_18/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
419 | 428 | Merged /trunk/phase3:r98426,99371,99632,99897,99910,99914,99952 |