*/
public $tagName = 'event';
+ /**
+ * preset event ids
+ * @var array<integer>
+ */
+ protected $presetEventIDs = array();
+
/**
* @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
);
}
+ /**
+ * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::import()
+ */
+ protected function import(array $row, array $data) {
+ $result = parent::import($row, $data);
+
+ if (empty($row)) {
+ $this->presetEventIDs[] = $result->eventID;
+ }
+
+ return $result;
+ }
+
+ /**
+ * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
+ */
+ protected function cleanup() {
+ if (empty($this->presetEventIDs)) return;
+
+ $sql = "INSERT IGNORE INTO wcf".WCF_N."_user_notification_event_to_user
+ (userID, eventID)
+ SELECT userID, ?
+ FROM wcf".WCF_N."_user";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ WCF::getDB()->beginTransaction();
+ foreach ($this->presetEventIDs as $eventID) {
+ $statement->execute(array($eventID));
+ }
+ WCF::getDB()->commitTransaction();
+ }
+
/**
* @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
*/