r92434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92433‎ | r92434 | r92435 >
Date:15:05, 18 July 2011
Author:hashar
Status:deferred (Comments)
Tags:
Comment:
MFT to REL1_18
r90084 : finish up fix for bug 28627
r90093 : avoid conflict for mFile between SpecialUndelete and SpecialPage
r90296 : move LocalFile::publish() magic to LocalFile::publishTo()
r90490 : fix a an APIEdit fatal error bug 29278
Modified paths:
  • /branches/REL1_18/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/REL1_18/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /branches/REL1_18/phase3/includes/filerepo (modified) (history)
  • /branches/REL1_18/phase3/includes/filerepo/File.php (modified) (history)
  • /branches/REL1_18/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /branches/REL1_18/phase3/includes/filerepo/OldLocalFile.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/Installer.php (modified) (history)
  • /branches/REL1_18/phase3/includes/installer/SqliteUpdater.php (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/GlobalFunctions.php
@@ -2727,6 +2727,15 @@
27282728 return false;
27292729 }
27302730
 2731+ /* Provide an empty host for eg. file:/// urls (see bug 28627) */
 2732+ if ( !isset( $bits['host'] ) ) {
 2733+ $bits['host'] = '';
 2734+
 2735+ /* parse_url loses the third / for file:///c:/ urls (but not on variants) */
 2736+ if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
 2737+ $bits['path'] = '/' . $bits['path'];
 2738+ }
 2739+ }
27312740 return $bits;
27322741 }
27332742
@@ -2750,12 +2759,8 @@
27512760 $domainpart = '';
27522761 }
27532762 $reversedHost = $domainpart . '@' . $mailparts[0];
2754 - } else if ( isset( $bits['host'] ) ) {
2755 - $reversedHost = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) );
27562763 } else {
2757 - // In file: URIs for instance it's common to have an empty host,
2758 - // which turns up as not getting a 'host' member from parse_url.
2759 - $reversedHost = '.';
 2764+ $reversedHost = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) );
27602765 }
27612766 // Add an extra dot to the end
27622767 // Why? Is it in wrong place in mailto links?
@@ -2770,13 +2775,6 @@
27712776 $index .= ':' . $bits['port'];
27722777 }
27732778 if ( isset( $bits['path'] ) ) {
2774 - // parse_url() removes the initial '/' from the path
2775 - // for file: URLs with Windows-style paths, such as
2776 - // file:///c:/windows/stuff. We need to add it back
2777 - // to keep our division between host and path properly.
2778 - if ( strlen( $bits['path'] ) > 0 && substr( $bits['path'], 0, 1 ) !== '/' ) {
2779 - $index .= '/';
2780 - }
27812779 $index .= $bits['path'];
27822780 } else {
27832781 $index .= '/';
Property changes on: branches/REL1_18/phase3/includes/GlobalFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
27842782 Merged /trunk/phase3/includes/GlobalFunctions.php:r90084
Index: branches/REL1_18/phase3/includes/filerepo/OldLocalFile.php
@@ -221,10 +221,12 @@
222222 */
223223 function uploadOld( $srcPath, $archiveName, $timestamp, $comment, $user, $flags = 0 ) {
224224 $this->lock();
225 - $status = $this->publish( $srcPath,
226 - $flags & File::DELETE_SOURCE ? FileRepo::DELETE_SOURCE : 0,
227 - $archiveName );
228225
 226+ $dstRel = 'archive/' . $this->getHashPath() . $archiveName;
 227+ $status = $this->publishTo( $srcPath, $dstRel,
 228+ $flags & File::DELETE_SOURCE ? FileRepo::DELETE_SOURCE : 0
 229+ );
 230+
229231 if ( $status->isGood() ) {
230232 if ( !$this->recordOldUpload( $srcPath, $archiveName, $timestamp, $comment, $user ) ) {
231233 $status->fatal( 'filenotfound', $srcPath );
Index: branches/REL1_18/phase3/includes/filerepo/LocalFile.php
@@ -1051,20 +1051,30 @@
10521052 * @param $srcPath String: local filesystem path to the source image
10531053 * @param $flags Integer: a bitwise combination of:
10541054 * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
1055 - * @param $dstArchiveName string File name if the file is to be published
1056 - * into the archive
10571055 * @return FileRepoStatus object. On success, the value member contains the
10581056 * archive name, or an empty string if it was a new file.
10591057 */
1060 - function publish( $srcPath, $flags = 0, $dstArchiveName = null ) {
 1058+ function publish( $srcPath, $flags = 0 ) {
 1059+ return $this->publishTo( $srcPath, $this->getRel(), $flags );
 1060+ }
 1061+
 1062+ /**
 1063+ * Move or copy a file to a specified location. Returns a FileRepoStatus
 1064+ * object with the archive name in the "value" member on success.
 1065+ *
 1066+ * The archive name should be passed through to recordUpload for database
 1067+ * registration.
 1068+ *
 1069+ * @param $srcPath String: local filesystem path to the source image
 1070+ * @param $dstRel String: target relative path
 1071+ * @param $flags Integer: a bitwise combination of:
 1072+ * File::DELETE_SOURCE Delete the source file, i.e. move rather than copy
 1073+ * @return FileRepoStatus object. On success, the value member contains the
 1074+ * archive name, or an empty string if it was a new file.
 1075+ */
 1076+ function publishTo( $srcPath, $dstRel, $flags = 0 ) {
10611077 $this->lock();
1062 -
1063 - if ( $dstArchiveName ) {
1064 - $dstRel = 'archive/' . $this->getHashPath() . $dstArchiveName;
1065 - } else {
1066 - $dstRel = $this->getRel();
1067 - }
1068 -
 1078+
10691079 $archiveName = wfTimestamp( TS_MW ) . '!'. $this->getName();
10701080 $archiveRel = 'archive/' . $this->getHashPath() . $archiveName;
10711081 $flags = $flags & File::DELETE_SOURCE ? LocalRepo::DELETE_SOURCE : 0;
Property changes on: branches/REL1_18/phase3/includes/filerepo/File.php
___________________________________________________________________
Modified: svn:mergeinfo
10721082 Merged /trunk/phase3/includes/filerepo/File.php:r90296
Property changes on: branches/REL1_18/phase3/includes/filerepo
___________________________________________________________________
Added: svn:mergeinfo
10731083 Merged /branches/sqlite/includes/filerepo:r58211-58321
10741084 Merged /trunk/phase3/includes/filerepo:r87586,87627-87628,87630,87840,87998,88085,88118,88124,88134,88231-88232,88250,88492,88498,88513,89099,89108,90296,90602,90612,90618,90626,90630-90631,90637,90655,90657,90666,90812
10751085 Merged /branches/new-installer/phase3/includes/filerepo:r43664-66004
10761086 Merged /branches/wmf-deployment/includes/filerepo:r53381
10771087 Merged /branches/REL1_15/phase3/includes/filerepo:r51646
Property changes on: branches/REL1_18/phase3/includes/installer/Installer.php
___________________________________________________________________
Modified: svn:mergeinfo
10781088 Merged /trunk/phase3/includes/installer/Installer.php:r89311
Property changes on: branches/REL1_18/phase3/includes/installer/DatabaseInstaller.php
___________________________________________________________________
Modified: svn:mergeinfo
10791089 Merged /trunk/phase3/includes/installer/DatabaseInstaller.php:r89311
Property changes on: branches/REL1_18/phase3/includes/installer/SqliteUpdater.php
___________________________________________________________________
Modified: svn:mergeinfo
10801090 Merged /trunk/phase3/includes/installer/SqliteUpdater.php:r89311
Property changes on: branches/REL1_18/phase3/includes/installer
___________________________________________________________________
Modified: svn:mergeinfo
10811091 Merged /trunk/phase3/includes/installer:r89311
Index: branches/REL1_18/phase3/includes/api/ApiEditPage.php
@@ -65,8 +65,6 @@
6666 $titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) );
6767 // array_shift( $titles );
6868
69 - $this->getResult()->addValue( null, 'foo', $titles );
70 -
7169 $redirValues = array();
7270 foreach ( $titles as $id => $newTitle ) {
7371
Property changes on: branches/REL1_18/phase3/includes/api/ApiEditPage.php
___________________________________________________________________
Added: svn:mergeinfo
7472 Merged /branches/REL1_15/phase3/includes/api/ApiEditPage.php:r51646
7573 Merged /branches/REL1_16/phase3/includes/api/ApiEditPage.php:r63621-63636,69357
7674 Merged /branches/wmf/1.16wmf4/includes/api/ApiEditPage.php:r69521
7775 Merged /branches/sqlite/includes/api/ApiEditPage.php:r58211-58321
7876 Merged /trunk/phase3/includes/api/ApiEditPage.php:r87627-87628,87630,87998,88134,88231-88232,88250,88513,89099,89108,90490,90602,90612,90618,90626,90630-90631,90637,90655,90657,90666,90812
7977 Merged /branches/wmf-deployment/includes/api/ApiEditPage.php:r53381,59952
Index: branches/REL1_18/phase3/includes/specials/SpecialUndelete.php
@@ -564,7 +564,7 @@
565565 * @ingroup SpecialPage
566566 */
567567 class SpecialUndelete extends SpecialPage {
568 - var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj, $mFile;
 568+ var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj, $mFilename;
569569 var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken, $mRequest;
570570
571571 function __construct( $request = null ) {
@@ -585,7 +585,7 @@
586586 $this->mSearchPrefix = $this->mRequest->getText( 'prefix' );
587587 $time = $this->mRequest->getVal( 'timestamp' );
588588 $this->mTimestamp = $time ? wfTimestamp( TS_MW, $time ) : '';
589 - $this->mFile = $this->mRequest->getVal( 'file' );
 589+ $this->mFilename = $this->mRequest->getVal( 'file' );
590590
591591 $posted = $this->mRequest->wasPosted() &&
592592 $wgUser->matchEditToken( $this->mRequest->getVal( 'wpEditToken' ) );
@@ -674,11 +674,11 @@
675675 if( $this->mTimestamp !== '' ) {
676676 return $this->showRevision( $this->mTimestamp );
677677 }
678 - if( $this->mFile !== null ) {
679 - $file = new ArchivedFile( $this->mTargetObj, '', $this->mFile );
 678+ if( $this->mFilename !== null ) {
 679+ $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
680680 // Check if user is allowed to see this file
681681 if ( !$file->exists() ) {
682 - $wgOut->addWikiMsg( 'filedelete-nofile', $this->mFile );
 682+ $wgOut->addWikiMsg( 'filedelete-nofile', $this->mFilename );
683683 return;
684684 } else if( !$file->userCan( File::DELETED_FILE ) ) {
685685 if( $file->isDeleted( File::DELETED_RESTRICTED ) ) {
@@ -687,11 +687,11 @@
688688 $wgOut->permissionRequired( 'deletedtext' );
689689 }
690690 return false;
691 - } elseif ( !$wgUser->matchEditToken( $this->mToken, $this->mFile ) ) {
692 - $this->showFileConfirmationForm( $this->mFile );
 691+ } elseif ( !$wgUser->matchEditToken( $this->mToken, $this->mFilename ) ) {
 692+ $this->showFileConfirmationForm( $this->mFilename );
693693 return false;
694694 } else {
695 - return $this->showFile( $this->mFile );
 695+ return $this->showFile( $this->mFilename );
696696 }
697697 }
698698 if( $this->mRestore && $this->mAction == "submit" ) {
@@ -985,7 +985,7 @@
986986 */
987987 private function showFileConfirmationForm( $key ) {
988988 global $wgOut, $wgUser, $wgLang;
989 - $file = new ArchivedFile( $this->mTargetObj, '', $this->mFile );
 989+ $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
990990 $wgOut->addWikiMsg( 'undelete-show-file-confirm',
991991 $this->mTargetObj->getText(),
992992 $wgLang->date( $file->getTimestamp() ),
Property changes on: branches/REL1_18/phase3/includes/specials/SpecialUndelete.php
___________________________________________________________________
Added: svn:mergeinfo
993993 Merged /branches/wmf-deployment/includes/specials/SpecialUndelete.php:r53381,56967
994994 Merged /branches/REL1_15/phase3/includes/specials/SpecialUndelete.php:r51646
995995 Merged /branches/sqlite/includes/specials/SpecialUndelete.php:r58211-58321
996996 Merged /trunk/phase3/includes/specials/SpecialUndelete.php:r87586,87627-87628,87630,87840,87998,88085,88118,88124,88134,88231-88232,88250,88492,88498,88513,89099,89108,90093,90602,90612,90618,90626,90630-90631,90637,90655,90657,90666,90812

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86897* (bug 28627) External link normalization now handles file: URL cases without...brion21:00, 25 April 2011
r89553Fix the non-PEAR alternative for Services_JSON_Error to be less useless. bug ...catrope09:41, 6 June 2011
r90084Revert r86897 in wfMakeUrlIndex() and solve the issue in wfParseUrl()platonides20:57, 14 June 2011
r90093Followup to r86347, r86797: change SpecialUndelete->mFile to mFilename to rem...brion21:47, 14 June 2011
r90270Related to bug 29278, and from the comments in bug 14210, mention the edit to...reedy14:55, 17 June 2011
r90296Fix r85635. Move LocalFile::publish() magic to LocalFile::publishTo() which h...btongminh17:12, 17 June 2011
r90490* (bug 29278) server error 500 when attempting to add text to a page via redi...reedy22:32, 20 June 2011
r90492* (bug 29278) server error 500 when attempting to add text to a page via redi...reedy22:39, 20 June 2011

Comments

#Comment by Platonides (talk | contribs)   20:07, 18 July 2011

Reedy, I don't think you wanted to mark this as old...

#Comment by Reedy (talk | contribs)   20:07, 18 July 2011

I do. REL1_18 is being rebranched in the next few hours

Status & tagging log