From: Thiemo Kreuz Date: Tue, 8 Jan 2019 16:05:05 +0000 (+0100) Subject: logging: Start using LinkTarget & UserIdentity in ManualLogEntry X-Git-Tag: 1.34.0-rc.0~2556^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=fda5c6405353f065b4774be13d19e60596524bb2;p=lhc%2Fweb%2Fwiklou.git logging: Start using LinkTarget & UserIdentity in ManualLogEntry This is a first, very small migration step. This is entirely non-breaking, as all objects passed to these two functions already matched the interfaces that are now required. For the setTarget() method it's most obvious it really just needs a LinkTarget value object, but not the entirety of the Title class with all it's helper methods. Same for the performer. A ManualLogEntry does not need to interact with the performer, just needs to know him. This small change allows to slowly migrate away from code depending on the User and Title classes. Note this code currently does not have any test coverage, and I do not plan to change this within this patch. I just don't have the time. https://doc.wikimedia.org/cover/mediawiki-core/includes/logging/LogEntry.php.html Change-Id: Id551f066ab02d5ca14346a39a55af4e7b6e4e042 --- diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 5706f2d080..7807e4c821 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -28,6 +28,8 @@ * @since 1.19 */ +use MediaWiki\Linker\LinkTarget; +use MediaWiki\User\UserIdentity; use Wikimedia\Rdbms\IDatabase; /** @@ -527,20 +529,20 @@ class ManualLogEntry extends LogEntryBase { * 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 ); } /**