Move the check for expired app evaluations into a dedicated method
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 09:32:06 +0000 (11:32 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 6 Jul 2021 09:32:06 +0000 (11:32 +0200)
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 78a0f8c15f61cc68418ec74f7b5800da86cd48c3..079d50424c8b5ab2d64ed5672ae3b7fdacbd7605 100644 (file)
@@ -210,30 +210,7 @@ class RequestHandler extends SingletonFactory
                 $metaData
             );
 
-            // check if the controller matches an app that has an expired evaluation date
-            [$abbreviation] = \explode('\\', $this->getActiveRequest()->getClassName(), 2);
-            if ($abbreviation !== 'wcf') {
-                $applicationObject = ApplicationHandler::getInstance()->getApplication($abbreviation);
-                $endDate = WCF::getApplicationObject($applicationObject)->getEvaluationEndDate();
-                if ($endDate && $endDate < TIME_NOW) {
-                    $package = $applicationObject->getPackage();
-
-                    $pluginStoreFileID = WCF::getApplicationObject($applicationObject)->getEvaluationPluginStoreID();
-                    $isWoltLab = false;
-                    if ($pluginStoreFileID === 0 && \strpos($package->package, 'com.woltlab.') === 0) {
-                        $isWoltLab = true;
-                    }
-
-                    throw new NamedUserException(WCF::getLanguage()->getDynamicVariable(
-                        'wcf.acp.package.evaluation.expired',
-                        [
-                            'packageName' => $package->getName(),
-                            'pluginStoreFileID' => $pluginStoreFileID,
-                            'isWoltLab' => $isWoltLab,
-                        ]
-                    ));
-                }
-            }
+            $this->checkAppEvaluation();
 
             if (!$this->isACPRequest()) {
                 // determine if current request matches the landing page
@@ -291,6 +268,37 @@ class RequestHandler extends SingletonFactory
         }
     }
 
+    /**
+     * @since 5.5
+     */
+    protected function checkAppEvaluation()
+    {
+        // check if the controller matches an app that has an expired evaluation date
+        [$abbreviation] = \explode('\\', $this->getActiveRequest()->getClassName(), 2);
+        if ($abbreviation !== 'wcf') {
+            $applicationObject = ApplicationHandler::getInstance()->getApplication($abbreviation);
+            $endDate = WCF::getApplicationObject($applicationObject)->getEvaluationEndDate();
+            if ($endDate && $endDate < TIME_NOW) {
+                $package = $applicationObject->getPackage();
+
+                $pluginStoreFileID = WCF::getApplicationObject($applicationObject)->getEvaluationPluginStoreID();
+                $isWoltLab = false;
+                if ($pluginStoreFileID === 0 && \strpos($package->package, 'com.woltlab.') === 0) {
+                    $isWoltLab = true;
+                }
+
+                throw new NamedUserException(WCF::getLanguage()->getDynamicVariable(
+                    'wcf.acp.package.evaluation.expired',
+                    [
+                        'packageName' => $package->getName(),
+                        'pluginStoreFileID' => $pluginStoreFileID,
+                        'isWoltLab' => $isWoltLab,
+                    ]
+                ));
+            }
+        }
+    }
+
     /**
      * Redirects to the actual URL, e.g. controller has been aliased or mistyped (boardlist instead of board-list).
      *