Add `VoidExtendedModificationLogHandler`
authorMatthias Schmidt <gravatronics@live.com>
Tue, 23 Oct 2018 17:16:19 +0000 (19:16 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 23 Oct 2018 17:16:19 +0000 (19:16 +0200)
… for modification log handlers not supporting showing modification logs in the global ACP log list.

See #2597

wcfsetup/install/files/lib/acp/page/ModificationLogListPage.class.php
wcfsetup/install/files/lib/system/log/modification/AbstractExtendedModificationLogHandler.class.php
wcfsetup/install/files/lib/system/log/modification/IExtendedModificationLogHandler.class.php
wcfsetup/install/files/lib/system/log/modification/VoidExtendedModificationLogHandler.class.php [new file with mode: 0644]

index ae099cab17ca59ba67261b99ef22a43f3ceefb47..e33acfc0d690729279d71a587971255110e11dd2 100644 (file)
@@ -152,11 +152,6 @@ class ModificationLogListPage extends SortablePage {
        
        protected function initObjectTypes() {
                foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.modifiableContent') as $objectType) {
-                       /** @noinspection PhpUndefinedFieldInspection */
-                       if ($objectType->excludeFromLogList) {
-                               continue;
-                       }
-                       
                        $this->objectTypes[$objectType->objectTypeID] = $objectType;
                        
                        /** @var IExtendedModificationLogHandler $processor */
@@ -164,7 +159,7 @@ class ModificationLogListPage extends SortablePage {
                        if ($processor === null) {
                                $this->unsupportedObjectTypes[] = $objectType;
                        }
-                       else {
+                       else if ($processor->includeInLogList()) {
                                $this->availableObjectTypeIDs[] = $objectType->objectTypeID;
                                if (!isset($this->packages[$objectType->packageID])) {
                                        $this->actions[$objectType->packageID] = [];
index 3badadbb982e684116bd52c31fabd01d58207e92..ac0eb630617f39ff7dd728c2397809b6f70bb1a7 100644 (file)
@@ -12,4 +12,10 @@ namespace wcf\system\log\modification;
  * @since       3.2
  */
 abstract class AbstractExtendedModificationLogHandler extends AbstractModificationLogHandler implements IExtendedModificationLogHandler {
+       /**
+        * @inheritDoc
+        */
+       public function includeInLogList() {
+               return true;
+       }
 }
index eebbefcadb688c95e1d2eaeb71568ce27d3da6a8..af7a2ba4347f72cec5ec075fc1382f31f12f9385 100644 (file)
@@ -21,12 +21,20 @@ interface IExtendedModificationLogHandler {
         */
        public function getAvailableActions();
        
+       /**
+        * Returns `true` if logs handled by this handler may be included in the
+        * global ACP log list and returns `false` otherwise.
+        * 
+        * @return      bool
+        */
+       public function includeInLogList();
+       
        /**
         * Processes a list of items by converting them into IViewableModificationLog
         * instances and pre-loading their data.
         *
-        * @param ModificationLog[] $items
-        * @return IViewableModificationLog[]
+        * @param       ModificationLog[]       $items
+        * @return      IViewableModificationLog[]
         */
        public function processItems(array $items);
 }
diff --git a/wcfsetup/install/files/lib/system/log/modification/VoidExtendedModificationLogHandler.class.php b/wcfsetup/install/files/lib/system/log/modification/VoidExtendedModificationLogHandler.class.php
new file mode 100644 (file)
index 0000000..407b787
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+namespace wcf\system\log\modification;
+
+/**
+ * Extended modification log handler implementation for modification log handlers
+ * that do not support their logs being shown in the global ACP modification log.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Log\Modification
+ * @since      3.2
+ */
+class VoidExtendedModificationLogHandler extends AbstractExtendedModificationLogHandler {
+       /**
+        * @inheritDoc
+        */
+       public function getAvailableActions() {
+               return [];
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function includeInLogList() {
+               return false;
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function processItems(array $items) {
+               throw new \BadMethodCallException("Cannot process items.");
+       }
+}