* Dummy for now...
*/
public function importUpload( $revision ) {
+ $revision->importUpload();
//$dbw = wfGetDB( DB_MASTER );
//return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
return false;
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'] ) );
$revision->setUserName( $uploadInfo['contributor']['username'] );
}
- return $this->uploadCallback( $revision );
+ return call_user_func( $this->mUploadCallback, $revision );
}
private function handleContributor() {
$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() );
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?