From 689568d545054eaa79ba02fa3ca0407987d1670d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Jan 2018 12:28:20 +0100 Subject: [PATCH] Only add update servers if they do not exist yet --- com.woltlab.wcf/update_3.1_3.sql | 3 +-- ...update_com.woltlab.wcf_3.1_postUpgrade.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/update_3.1_3.sql b/com.woltlab.wcf/update_3.1_3.sql index 352910d1c1..004a1dbd3b 100644 --- a/com.woltlab.wcf/update_3.1_3.sql +++ b/com.woltlab.wcf/update_3.1_3.sql @@ -121,8 +121,7 @@ ALTER TABLE wcf1_user_trophy ADD FOREIGN KEY (userID) REFERENCES wcf1_user (user ALTER TABLE wcf1_user_special_trophy ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; ALTER TABLE wcf1_user_special_trophy ADD FOREIGN KEY (trophyID) REFERENCES wcf1_trophy (trophyID) ON DELETE CASCADE; -INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://update.woltlab.com/tornado/', 'online', 0, NULL, 0, '', ''); -INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://store.woltlab.com/tornado/', 'online', 0, NULL, 0, '', ''); +-- update servers are added through a script to avoid collisions INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfContentContainerBackground', 'rgba(255, 255, 255, 1)'); INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfContentContainerBorder', 'rgba(236, 241, 247, 1)'); diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php index 13682c6ce1..7ff2c18994 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php @@ -1,5 +1,7 @@ fetchArray()) { } WCF::getDB()->commitTransaction(); +// inserts update servers, unless they exist already +$updateServers = new PackageUpdateServerList(); +$updateServers->readObjects(); +$hasServer = ['update' => false, 'store' => false]; +foreach ($updateServers as $updateServer) { + if (preg_match('~https?://(?Pupdate|store)\.woltlab\.com/tornado/~', $updateServer->serverURL, $matches)) { + $hasServer[$matches['server']] = true; + } +} + +foreach ($hasServer as $type => $serverExists) { + if (!$serverExists) { + PackageUpdateServerEditor::create(['serverURL' => "http://{$type}.woltlab.com/tornado/"]); + } +} + + // the upgrade added a bunch of new style variables StyleCacheBuilder::getInstance()->reset(); -- 2.20.1