From: Tim Düsterhus Date: Thu, 20 Aug 2020 13:18:46 +0000 (+0200) Subject: Ensure that the official package servers exist X-Git-Tag: 5.3.0_Alpha_1~22^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=79c48c3ad9254ce34fbe2e59cc2993aca6ac1775;p=GitHub%2FWoltLab%2FWCF.git Ensure that the official package servers exist --- diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php index 96686c23cb..929269be51 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php @@ -73,16 +73,37 @@ class PackageUpdateServer extends DatabaseObject { } $list = new PackageUpdateServerList(); - $list->getConditionBuilder()->add("isDisabled = ?", [0]); $list->readObjects(); + $woltlabUpdateServer = null; + $woltlabStoreServer = null; + $results = []; + foreach ($list as $packageServer) { + if ($packageServer->isWoltLabUpdateServer()) $woltlabUpdateServer = $packageServer; + if ($packageServer->isWoltLabStoreServer()) $woltlabStoreServer = $packageServer; + if ($packageServer->isDisabled) continue; + + $results[] = $packageServer; + } + + if (!$woltlabUpdateServer) { + $results[] = PackageUpdateServerEditor::create([ + 'serverURL' => 'http://update.woltlab.com/'.\wcf\getMinorVersion().'/', + ]); + } + if (!$woltlabStoreServer) { + $results[] = PackageUpdateServerEditor::create([ + 'serverURL' => 'http://store.woltlab.com/'.\wcf\getMinorVersion().'/', + ]); + } + if (ENABLE_ENTERPRISE_MODE) { - return array_filter($list->getObjects(), function (PackageUpdateServer $server) { + return array_filter($results, function (PackageUpdateServer $server) { return $server->isWoltLabStoreServer() || $server->isTrustedServer(); }); } - return $list->getObjects(); + return $results; } /**