Rename \wcf\system\event\listener\IEventListener to IParameterizedEventListener
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 24 Aug 2014 15:52:20 +0000 (17:52 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 24 Aug 2014 15:52:20 +0000 (17:52 +0200)
This is for BC reasons, as PHP does not allow using a class of another
namespace when a class with the same name already exists within the same
namespace. IParameterizedEventListener will be aliased to IEventListener
when \wcf\system\event\IEventListener is removed.

see bd8f17f01975dacba19199ac4b7f4bba567f3e98

wcfsetup/install/files/lib/system/event/EventHandler.class.php
wcfsetup/install/files/lib/system/event/IEventListener.class.php
wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php [deleted file]
wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php
wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php

index d22fed086e62fc482a9e4a51cf920cd0d51934ff..6e5da6ee2df177176f0efa382573a4d21481d9b3 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\event;
 use wcf\system\cache\builder\EventListenerCacheBuilder;
-use wcf\system\event\listener\IEventListener;
+use wcf\system\event\listener\IParameterizedEventListener;
 use wcf\system\event\IEventListener as ILegacyEventListener;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
@@ -110,10 +110,10 @@ class EventHandler extends SingletonFactory {
                                                                if (!class_exists($action['listenerClassName'])) {
                                                                        throw new SystemException("Unable to find class '".$action['listenerClassName']."'");
                                                                }
-                                                               if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IEventListener')) {
+                                                               if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IParameterizedEventListener')) {
                                                                        // legacy event listeners
                                                                        if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\IEventListener')) {
-                                                                               throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IEventListener'");
+                                                                               throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IParameterizedEventListener'");
                                                                        }
                                                                }
                                                                
@@ -130,7 +130,7 @@ class EventHandler extends SingletonFactory {
                
                // execute actions
                foreach ($this->inheritedActionsObjects[$name] as $actionObj) {
-                       if ($actionObj instanceof IEventListener) {
+                       if ($actionObj instanceof IParameterizedEventListener) {
                                $actionObj->execute($eventObj, $className, $eventName, $parameters);
                                
                                if (!is_array($parameters)) {
@@ -193,10 +193,10 @@ class EventHandler extends SingletonFactory {
                                        if (!class_exists($action['listenerClassName'])) {
                                                throw new SystemException("Unable to find class '".$action['listenerClassName']."'");
                                        }
-                                       if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IEventListener')) {
+                                       if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IParameterizedEventListener')) {
                                                // legacy event listeners
                                                if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\IEventListener')) {
-                                                       throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IEventListener'");
+                                                       throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IParameterizedEventListener'");
                                                }
                                        }
                                        
@@ -210,7 +210,7 @@ class EventHandler extends SingletonFactory {
                
                // execute actions
                foreach ($this->actionsObjects[$name] as $actionObj) {
-                       if ($actionObj instanceof IEventListener) {
+                       if ($actionObj instanceof IParameterizedEventListener) {
                                $actionObj->execute($eventObj, $className, $eventName, $parameters);
                                
                                if (!is_array($parameters)) {
index 575abbea98339334056e609e5e76a68f3035d6e4..941d914d83cb96b82c793b21cbc5c76bc8591596 100644 (file)
@@ -5,7 +5,7 @@ namespace wcf\system\event;
  * *DEPRECATED*
  * EventListeners can be registered for a specific event in many controller objects.
  * 
- * @deprecated since 2.1, use \wcf\system\event\listener\IEventListener
+ * @deprecated since 2.1, use \wcf\system\event\listener\IParameterizedEventListener
  * @author     Marcel Werk
  * @copyright  2001-2014 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
diff --git a/wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php b/wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php
deleted file mode 100644 (file)
index 208ba82..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-namespace wcf\system\event\listener;
-
-/**
- * EventListeners can be registered for a specific event in many controller objects.
- * 
- * @author     Tim Duesterhus, Marcel Werk
- * @copyright  2001-2014 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.event.listener
- * @category   Community Framework
- */
-interface IEventListener {
-       /**
-        * Executes this action.
-        * 
-        * @param       object          $eventObj       Object firing the event
-        * @param       string          $className      class name of $eventObj
-        * @param       string          $eventName      name of the event fired
-        * @param       array           &$parameters    given parameters
-        */
-       public function execute($eventObj, $className, $eventName, array &$parameters);
-}
diff --git a/wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php b/wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php
new file mode 100644 (file)
index 0000000..1b2366b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+namespace wcf\system\event\listener;
+
+/**
+ * EventListeners can be registered for a specific event in many controller objects.
+ * NOTE: This class will be aliased to \wcf\system\event\listener\IEventListener in
+ *       a future version. It is named IParameterizedEventListener for backwards
+ *       compatibility reasons only.
+ * 
+ * @author     Tim Duesterhus, Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.event.listener
+ * @category   Community Framework
+ */
+interface IParameterizedEventListener {
+       /**
+        * Executes this action.
+        * 
+        * @param       object          $eventObj       Object firing the event
+        * @param       string          $className      class name of $eventObj
+        * @param       string          $eventName      name of the event fired
+        * @param       array           &$parameters    given parameters
+        */
+       public function execute($eventObj, $className, $eventName, array &$parameters);
+}
index 3c92a13bb481925e9fed614aae22101dbee2af6f..bb0f72bb3674015bd51fdd3e4f588cd15b4cee44 100644 (file)
@@ -17,9 +17,9 @@ use wcf\util\StringStack;
  * @subpackage system.event.listener
  * @category   Community Framework
  */
-class PreParserAtUserListener implements IEventListener {
+class PreParserAtUserListener implements IParameterizedEventListener {
        /**
-        * @see \wcf\system\event\listener\IEventListener::execute()
+        * @see \wcf\system\event\listener\IParameterizedEventListener::execute()
         */
        public function execute($eventObj, $className, $eventName, array &$parameters) {
                if (!$eventObj->text) return;
index 9f6d488de69e57704ce5a3c3a1aa03b2f80c61d9..0a362b27805f67374b067e64a63dcf04ff1caf0f 100644 (file)
@@ -16,9 +16,9 @@ use wcf\util\UserUtil;
  * @subpackage system.event.listener
  * @category   Community Framework
  */
-class SessionAccessLogListener implements IEventListener {
+class SessionAccessLogListener implements IParameterizedEventListener {
        /**
-        * @see \wcf\system\event\listener\IEventListener::execute()
+        * @see \wcf\system\event\listener\IParameterizedEventListener::execute()
         */
        public function execute($eventObj, $className, $eventName, array &$parameters) {
                if (WCF::getUser()->userID && WCF::getSession()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj).'::DO_NOT_LOG')) {