From ff3474e2e69d1ac92eb227dfedd170cfb012ba94 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 18 Jul 2023 14:21:03 +0200 Subject: [news] Fix install: Falsely reported UPDATE_DONE every time --- modules-available/news/install.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules-available/news') diff --git a/modules-available/news/install.inc.php b/modules-available/news/install.inc.php index 89fc7069..18b60800 100644 --- a/modules-available/news/install.inc.php +++ b/modules-available/news/install.inc.php @@ -11,7 +11,7 @@ if (tableExists('news')) { finalResponse(UPDATE_FAILED, "Could not rename news to vmchooser_pages: " . Database::lastError()); } $dbret[] = UPDATE_DONE; - if (false === Database::exec("ALTER TABLE `vmchooser_pages` ADD COLUMN type VARCHAR(10)")) { + if (false === Database::exec("ALTER TABLE `vmchooser_pages` ADD COLUMN type VARCHAR(10) CHARACTER SET ascii NOT NULL")) { EventLog::warning("Could not add type column to vmchooser_pages: " . Database::lastError()); } if (false === Database::exec("UPDATE `vmchooser_pages` SET `type` = 'news' WHERE 1")) { @@ -35,20 +35,24 @@ $dbret[] = tableCreate('vmchooser_pages', " if (tableGetIndex('vmchooser_pages', ['dateline']) !== false) { Database::exec('ALTER TABLE vmchooser_pages DROP KEY `dateline`'); Database::exec('ALTER TABLE vmchooser_pages ADD KEY `type` (`type`, `dateline`)'); + $dbret[] = UPDATE_DONE; } if (tableGetIndex('vmchooser_pages', ['type', 'expires', 'dateline']) === false) { Database::exec('ALTER TABLE vmchooser_pages ADD KEY `all3` (`type`, `expires`, `dateline`)'); + $dbret[] = UPDATE_DONE; } if (!tableHasColumn('vmchooser_pages', 'expires')) { Database::exec('ALTER TABLE vmchooser_pages ADD COLUMN `expires` int(10) unsigned NOT NULL AFTER `dateline`'); Database::exec('UPDATE vmchooser_pages SET expires = dateline + 86400 * 3650 WHERE expires = 0'); // ~10 Years + $dbret[] = UPDATE_DONE; } if (!tableHasColumn('vmchooser_pages', 'locationid')) { Database::exec('ALTER TABLE vmchooser_pages ADD COLUMN `locationid` int(11) NULL AFTER `expires`'); + $dbret[] = UPDATE_DONE; } -$dbret[] = Database::exec('ALTER TABLE vmchooser_pages MODIFY `type` varchar(10) CHARACTER SET ascii NOT NULL'); +Database::exec('ALTER TABLE vmchooser_pages MODIFY `type` varchar(10) CHARACTER SET ascii NOT NULL'); $dbret[] = tableAddConstraint('remoteaccess_x_location', 'locationid', 'location', 'locationid', 'ON UPDATE CASCADE ON DELETE CASCADE'); -- cgit v1.2.3-55-g7522