From bb3cc5719a7f795c4bc3cdaf754e66d523f688c5 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Fri, 4 Mar 2011 19:19:59 +0000 Subject: [PATCH] followup r83227 ... missed bits of patch --- includes/Import.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/Import.php b/includes/Import.php index bc75db1306..7228d23c52 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -192,6 +192,7 @@ class WikiImporter { * Dummy for now... */ public function importUpload( $revision ) { + $revision->importUpload(); //$dbw = wfGetDB( DB_MASTER ); //return $dbw->deadlockLoop( array( $revision, 'importUpload' ) ); return false; @@ -600,13 +601,15 @@ class WikiImporter { return $this->processUpload( $pageInfo, $uploadInfo ); } + private function processUpload( $pageInfo, $uploadInfo ) { $revision = new WikiRevision; + $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : ''; $revision->setTitle( $pageInfo['_title'] ); - $revision->setID( $uploadInfo['id'] ); + $revision->setID( $pageInfo['id'] ); $revision->setTimestamp( $uploadInfo['timestamp'] ); - $revision->setText( $uploadInfo['text'] ); + $revision->setText( $text ); $revision->setFilename( $uploadInfo['filename'] ); $revision->setSrc( $uploadInfo['src'] ); $revision->setSize( intval( $uploadInfo['size'] ) ); @@ -619,7 +622,7 @@ class WikiImporter { $revision->setUserName( $uploadInfo['contributor']['username'] ); } - return $this->uploadCallback( $revision ); + return call_user_func( $this->mUploadCallback, $revision ); } private function handleContributor() { @@ -1054,8 +1057,7 @@ class WikiRevision { $resultDetails = array( 'internal' => $status->getWikiText() ); */ - // @todo Fixme: upload() uses $wgUser, which is wrong here - // it may also create a page without our desire, also wrong potentially. + // @todo Fixme: it may create a page without our desire, also wrong potentially. // and, it will record a *current* upload, but we might want an archive version here $file = wfLocalFile( $this->getTitle() ); @@ -1070,12 +1072,15 @@ class WikiRevision { return false; } + $user = User::newFromName( $this->user_text ); + $status = $file->upload( $source, $this->getComment(), $this->getComment(), // Initial page, if none present... File::DELETE_SOURCE, false, // props... - $this->getTimestamp() ); + $this->getTimestamp(), + is_object( $user ) ? ( $user->isLoggedIn() ? $user : null ) : null ); if( $status->isGood() ) { // yay? -- 2.20.1