* @since 1.19
*/
+use MediaWiki\Linker\LinkTarget;
+use MediaWiki\User\UserIdentity;
use Wikimedia\Rdbms\IDatabase;
/**
* Set the user that performed the action being logged.
*
* @since 1.19
- * @param User $performer
+ * @param UserIdentity $performer
*/
- public function setPerformer( User $performer ) {
- $this->performer = $performer;
+ public function setPerformer( UserIdentity $performer ) {
+ $this->performer = User::newFromIdentity( $performer );
}
/**
* Set the title of the object changed.
*
* @since 1.19
- * @param Title $target
+ * @param LinkTarget $target
*/
- public function setTarget( Title $target ) {
- $this->target = $target;
+ public function setTarget( LinkTarget $target ) {
+ $this->target = Title::newFromLinkTarget( $target );
}
/**
/**
* Insert the entry into the `logging` table.
*
- * @param IDatabase $dbw
+ * @param IDatabase|null $dbw
* @return int ID of the log entry
* @throws MWException
*/
$relations = $this->relations;
// Ensure actor relations are set
- if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH &&
+ if ( ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) &&
empty( $relations['target_author_actor'] )
) {
$actorIds = [];
$params['authorActors'] = $actorIds;
}
}
- if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_NEW ) {
+ if ( !( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) {
unset( $relations['target_author_id'], $relations['target_author_ip'] );
unset( $params['authorIds'], $params['authorIPs'] );
}
}
public function getTimestamp() {
- $ts = $this->timestamp !== null ? $this->timestamp : wfTimestampNow();
+ $ts = $this->timestamp ?? wfTimestampNow();
return wfTimestamp( TS_MW, $ts );
}