* instruction file name for most PIPs has default value provided by `wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()`.
* `options` support for cronjobs.
* `name` attribute for cronjob PIP (`cronjobName` for cronjob objects).
+* `eventName` of event listener PIP supports multiple events.
* `permissions` and `options` support for event listeners.
* `name` attribute for event listener PIP (`listenerName` for event listener objects).
* `permissions` and `options` support for template listeners.
* @deprecated will be removed once listener names are mandatory
*/
const AUTOMATIC_NAME_PREFIX = 'com.woltlab.wcf.eventListener';
+
+ /**
+ * Returns the names of all events listened to.
+ *
+ * @return array<string>
+ */
+ public function getEventNames() {
+ return explode(',', $this->eventName);
+ }
}
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
while ($eventListener = $statement->fetchObject('wcf\data\event\listener\EventListener')) {
+ $eventNames = $eventListener->getEventNames();
+
if (!$eventListener->inherit) {
if (!isset($actions[$eventListener->environment])) {
$actions[$eventListener->environment] = array();
}
- $key = EventHandler::generateKey($eventListener->eventClassName, $eventListener->eventName);
- if (!isset($actions[$eventListener->environment][$key])) {
- $actions[$eventListener->environment][$key] = array();
+ foreach ($eventNames as $eventName) {
+ $key = EventHandler::generateKey($eventListener->eventClassName, $eventName);
+ if (!isset($actions[$eventListener->environment][$key])) {
+ $actions[$eventListener->environment][$key] = array();
+ }
+
+ $actions[$eventListener->environment][$key][] = $eventListener;
}
-
- $actions[$eventListener->environment][$key][] = $eventListener;
}
else {
if (!isset($inheritedActions[$eventListener->environment])) {
$inheritedActions[$eventListener->environment] = array();
}
- if (!isset($inheritedActions[$eventListener->environment][$eventListener->eventClassName])) {
- $inheritedActions[$eventListener->environment][$eventListener->eventClassName] = array();
+ foreach ($eventNames as $eventName) {
+ if (!isset($inheritedActions[$eventListener->environment][$eventListener->eventClassName])) {
+ $inheritedActions[$eventListener->environment][$eventListener->eventClassName] = array();
+ }
+
+ $inheritedActions[$eventListener->environment][$eventListener->eventClassName][$eventName][] = $eventListener;
}
-
- $inheritedActions[$eventListener->environment][$eventListener->eventClassName][$eventListener->eventName][] = $eventListener;
}
}
environment ENUM('user', 'admin') NOT NULL DEFAULT 'user',
listenerName VARCHAR(255) NOT NULL,
eventClassName VARCHAR(80) NOT NULL DEFAULT '',
- eventName VARCHAR(50) NOT NULL DEFAULT '',
+ eventName TEXT,
listenerClassName VARCHAR(200) NOT NULL DEFAULT '',
inherit TINYINT(1) NOT NULL DEFAULT 0,
niceValue TINYINT(3) NOT NULL DEFAULT 0,
permissions TEXT,
options TEXT,
- UNIQUE KEY listenerName (listenerName, packageID),
- UNIQUE KEY packageID (packageID, environment, eventClassName, eventName, listenerClassName)
+ UNIQUE KEY listenerName (listenerName, packageID)
);
DROP TABLE IF EXISTS wcf1_import_mapping;