return $returnValues['returnValues'];
}
+ /**
+ * Fires multiple new activity events for the same activity event type.
+ *
+ * This method is intended for bulk processing.
+ *
+ * @param string $objectType
+ * @param array $eventData
+ * @throws SystemException
+ */
+ public function fireEvents($objectType, array $eventData) {
+ $objectTypeID = $this->getObjectTypeID($objectType);
+ if ($objectTypeID === null) {
+ throw new SystemException("Unknown recent activity event '".$objectType."'");
+ }
+
+ $itemsPerLoop = 1000;
+ $batchCount = ceil(count($eventData) / $itemsPerLoop);
+
+ WCF::getDB()->beginTransaction();
+ for ($i = 0; $i < $batchCount; $i++) {
+ $batchEventData = array_slice($eventData, $i * $itemsPerLoop, $itemsPerLoop);
+
+ $parameters = [];
+ foreach ($batchEventData as $data) {
+ $parameters = array_merge($parameters, [
+ $objectTypeID,
+ $data['objectID'],
+ $data['languageID'] ?? null,
+ $data['userID'] ?? WCF::getUser()->userID,
+ $data['time'] ?? TIME_NOW,
+ serialize($data['additionalData'] ?? [])
+ ]);
+ }
+
+ $sql = "INSERT INTO wcf" . WCF_N . "_user_activity_event
+ (objectTypeID, objectID, languageID, userID, time, additionalData)
+ VALUES (?, ?, ?, ?, ?, ?)" . str_repeat(', (?, ?, ?, ?, ?, ?)', count($batchEventData) - 1);
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($parameters);
+ }
+ WCF::getDB()->commitTransaction();
+ }
+
/**
* Removes an activity event.
*