From 088eca6bd5fd8643fb65bfd60d8f8022323cda32 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 23 Dec 2020 18:12:16 +0100 Subject: [PATCH] Prevent the removal of the package servers for `5.3` to preserve the credentials --- ...date_com.woltlab.wcf_5.3_packageServer.php | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_packageServer.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_packageServer.php index d762d69760..9aed26891f 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_packageServer.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_packageServer.php @@ -11,46 +11,13 @@ $sql = "SELECT * $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); -// Try to extract authentication credentials from the previous package servers. -$newServers = [ - "update" => [ - "loginUsername" => "", - "loginPassword" => "", - ], - "store" => [ - "loginUsername" => "", - "loginPassword" => "", - ], -]; - $deleteServerIDs = []; while ($row = $statement->fetchArray()) { - $deleteServerIDs[] = $row["packageUpdateServerID"]; - - // Only use values from the "2019" servers to avoid dealing with outdated - // credentials that have never been updated. - $serverURL = $row["serverURL"]; - if (preg_match("~^https?://update\.woltlab\.com/2019/~", $serverURL)) { - $newServers["update"]["loginUsername"] = $row["loginUsername"]; - $newServers["update"]["loginPassword"] = $row["loginPassword"]; - } - else if (preg_match("~^https?://store\.woltlab\.com/2019/~", $serverURL)) { - $newServers["store"]["loginUsername"] = $row["loginUsername"]; - $newServers["store"]["loginPassword"] = $row["loginPassword"]; + if (!preg_match("~^https?://(?:store|update)\.woltlab\.com/5\.3/~", $row["serverURL"])) { + $deleteServerIDs[] = $row["packageUpdateServerID"]; } -} +} if (!empty($deleteServerIDs)) { PackageUpdateServerEditor::deleteAll($deleteServerIDs); } - -// Add the new package servers. -$sql = "INSERT INTO wcf" . WCF_N . "_package_update_server (serverURL, loginUsername, loginPassword) VALUES (?, ?, ?)"; -$statement = WCF::getDB()->prepareStatement($sql); -foreach ($newServers as $server => $authData) { - $statement->execute([ - "https://{$server}.woltlab.com/5.3/", - $authData["loginUsername"], - $authData["loginPassword"], - ]); -} -- 2.20.1