/** @var string */
public $user_text = "";
+ /** @var User */
+ public $userObj = null;
+
/** @var string */
public $model = null;
$this->user_text = $user;
}
+ /**
+ * @param User $user
+ */
+ function setUserObj( $user ) {
+ $this->userObj = $user;
+ }
+
/**
* @param string $ip
*/
return $this->user_text;
}
+ /**
+ * @return User
+ */
+ function getUserObj() {
+ return $this->userObj;
+ }
+
/**
* @return string
*
$dbw = wfGetDB( DB_MASTER );
# Sneak a single revision into place
- $user = User::newFromName( $this->getUser() );
+ $user = $this->getUserObj() ?: User::newFromName( $this->getUser() );
if ( $user ) {
$userId = intval( $user->getId() );
$userText = $user->getName();
- $userObj = $user;
} else {
$userId = 0;
$userText = $this->getUser();
- $userObj = new User;
+ $user = new User;
}
// avoid memory leak...?
// countable/oldcountable stuff is handled in WikiImporter::finishImportPage
$page->doEditUpdates(
$revision,
- $userObj,
+ $user,
array( 'created' => $created, 'oldcountable' => 'no-change' )
);
}
function importLogItem() {
$dbw = wfGetDB( DB_MASTER );
- $user = User::newFromName( $this->getUser() );
+ $user = $this->getUserObj() ?: User::newFromName( $this->getUser() );
if ( $user ) {
$userId = intval( $user->getId() );
$userText = $user->getName();
return false;
}
- $user = User::newFromName( $this->user_text );
+ $user = $this->getUserObj() ?: User::newFromName( $this->getUser() );
# Do the actual upload
if ( $archiveName ) {