r83233 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83232‎ | r83233 | r83234 >
Date:19:19, 4 March 2011
Author:mah
Status:ok
Tags:
Comment:
followup r83227 ... missed bits of patch
Modified paths:
  • /trunk/phase3/includes/Import.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Import.php
@@ -192,6 +192,7 @@
193193 * Dummy for now...
194194 */
195195 public function importUpload( $revision ) {
 196+ $revision->importUpload();
196197 //$dbw = wfGetDB( DB_MASTER );
197198 //return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
198199 return false;
@@ -600,13 +601,15 @@
601602 return $this->processUpload( $pageInfo, $uploadInfo );
602603 }
603604
 605+
604606 private function processUpload( $pageInfo, $uploadInfo ) {
605607 $revision = new WikiRevision;
 608+ $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
606609
607610 $revision->setTitle( $pageInfo['_title'] );
608 - $revision->setID( $uploadInfo['id'] );
 611+ $revision->setID( $pageInfo['id'] );
609612 $revision->setTimestamp( $uploadInfo['timestamp'] );
610 - $revision->setText( $uploadInfo['text'] );
 613+ $revision->setText( $text );
611614 $revision->setFilename( $uploadInfo['filename'] );
612615 $revision->setSrc( $uploadInfo['src'] );
613616 $revision->setSize( intval( $uploadInfo['size'] ) );
@@ -619,7 +622,7 @@
620623 $revision->setUserName( $uploadInfo['contributor']['username'] );
621624 }
622625
623 - return $this->uploadCallback( $revision );
 626+ return call_user_func( $this->mUploadCallback, $revision );
624627 }
625628
626629 private function handleContributor() {
@@ -1054,8 +1057,7 @@
10551058 $resultDetails = array( 'internal' => $status->getWikiText() );
10561059 */
10571060
1058 - // @todo Fixme: upload() uses $wgUser, which is wrong here
1059 - // it may also create a page without our desire, also wrong potentially.
 1061+ // @todo Fixme: it may create a page without our desire, also wrong potentially.
10601062 // and, it will record a *current* upload, but we might want an archive version here
10611063
10621064 $file = wfLocalFile( $this->getTitle() );
@@ -1070,12 +1072,15 @@
10711073 return false;
10721074 }
10731075
 1076+ $user = User::newFromName( $this->user_text );
 1077+
10741078 $status = $file->upload( $source,
10751079 $this->getComment(),
10761080 $this->getComment(), // Initial page, if none present...
10771081 File::DELETE_SOURCE,
10781082 false, // props...
1079 - $this->getTimestamp() );
 1083+ $this->getTimestamp(),
 1084+ is_object( $user ) ? ( $user->isLoggedIn() ? $user : null ) : null );
10801085
10811086 if( $status->isGood() ) {
10821087 // yay?

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83227* Bug 27823 - Re-enable functionality of --uploads option of importDump.php; ...mah18:25, 4 March 2011

Status & tagging log