From 8ce0cc171d39359cff2d0f5065b3b220ad9976e6 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 2 Mar 2019 21:25:33 +0100 Subject: [PATCH] Fix UserMerge integration for use with table prefix This fixes tests, because EchoHooks has "echo_event.*" which is invalid with table prefixes, like done in unit tests Added EchoEvent::selectFields() for future use and to replace more SELECT * Bug: T217487 Change-Id: I51cb46812431635d11780633dc7d807cd04f813d --- includes/EchoHooks.php | 2 +- includes/model/Event.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/includes/EchoHooks.php b/includes/EchoHooks.php index 67cfa5f00..a0b2e0c83 100644 --- a/includes/EchoHooks.php +++ b/includes/EchoHooks.php @@ -1405,7 +1405,7 @@ class EchoHooks { $thankYouIds = []; $thankYouRows = $dbw->select( [ 'echo_notification', 'echo_event' ], - 'echo_event.*', + EchoEvent::selectFields(), [ 'notification_user' => $newUser->getId(), 'notification_event = event_id', diff --git a/includes/model/Event.php b/includes/model/Event.php index 9049cb4a2..bec10f91f 100644 --- a/includes/model/Event.php +++ b/includes/model/Event.php @@ -723,4 +723,25 @@ class EchoEvent extends EchoAbstractEntity implements Bundleable { public function getSortingKey() { return $this->getTimestamp(); } + + /** + * Return the list of fields that should be selected to create + * a new event with EchoEvent::newFromRow + * @return string[] + */ + public static function selectFields() { + return [ + 'event_id', + 'event_type', + 'event_variant', + 'event_agent_id', + 'event_agent_ip', + 'event_page_namespace', + 'event_page_title', + 'event_extra', + 'event_page_id', + 'event_deleted', + ]; + } + }