followup r83227 ... missed bits of patch
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 4 Mar 2011 19:19:59 +0000 (19:19 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 4 Mar 2011 19:19:59 +0000 (19:19 +0000)
includes/Import.php

index bc75db1..7228d23 100644 (file)
@@ -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?