Reformat the code to use an early return
authorAlexander Ebert <ebert@woltlab.com>
Wed, 27 Sep 2023 12:00:28 +0000 (14:00 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 27 Sep 2023 12:00:28 +0000 (14:00 +0200)
wcfsetup/install/files/lib/system/cronjob/GetUpdateInfoCronjob.class.php

index ddae3ea4b27490d46e68b359350c7d6be21cb0a8..55d938e0c70a2453c3bc8c80df62e02a51b2a162 100644 (file)
@@ -23,19 +23,21 @@ class GetUpdateInfoCronjob extends AbstractCronjob
     {
         parent::execute($cronjob);
 
-        if (!ENABLE_BENCHMARK) {
-            try {
-                $currentLanguage = WCF::getLanguage();
-                // Always fetch package information using the default language.
-                if ($currentLanguage->languageID !== LanguageFactory::getInstance()->getDefaultLanguage()->languageID) {
-                    WCF::setLanguage(LanguageFactory::getInstance()->getDefaultLanguage());
-                }
+        if (ENABLE_BENCHMARK) {
+            return;
+        }
+
+        try {
+            $currentLanguage = WCF::getLanguage();
+            // Always fetch package information using the default language.
+            if ($currentLanguage->languageID !== LanguageFactory::getInstance()->getDefaultLanguage()->languageID) {
+                WCF::setLanguage(LanguageFactory::getInstance()->getDefaultLanguage());
+            }
 
-                PackageUpdateDispatcher::getInstance()->refreshPackageDatabase([], true);
-            } finally {
-                if ($currentLanguage->languageID !== LanguageFactory::getInstance()->getDefaultLanguage()->languageID) {
-                    WCF::setLanguage($currentLanguage);
-                }
+            PackageUpdateDispatcher::getInstance()->refreshPackageDatabase([], true);
+        } finally {
+            if ($currentLanguage->languageID !== LanguageFactory::getInstance()->getDefaultLanguage()->languageID) {
+                WCF::setLanguage($currentLanguage);
             }
         }
     }