Always fetch package information using the default language
authorMarcel Werk <burntime@woltlab.com>
Tue, 30 Mar 2021 13:24:21 +0000 (15:24 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 30 Mar 2021 13:24:21 +0000 (15:24 +0200)
wcfsetup/install/files/lib/system/cronjob/GetUpdateInfoCronjob.class.php

index 589d9db38004a054d5525454c888a4cb34dd3a10..379052d6a2290bcfa53aa49157e80247320a203d 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 namespace wcf\system\cronjob;
 use wcf\data\cronjob\Cronjob;
+use wcf\system\language\LanguageFactory;
 use wcf\system\package\PackageUpdateDispatcher;
+use wcf\system\WCF;
 
 /**
  * Fetches update package information.
@@ -19,7 +21,20 @@ class GetUpdateInfoCronjob extends AbstractCronjob {
                parent::execute($cronjob);
                
                if (!ENABLE_BENCHMARK) {
-                       PackageUpdateDispatcher::getInstance()->refreshPackageDatabase([], true);
+                       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);
+                               }
+                       }
                }
        }
 }