summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-07-18 14:21:03 +0200
committerSimon Rettberg2023-07-18 14:21:03 +0200
commitff3474e2e69d1ac92eb227dfedd170cfb012ba94 (patch)
treea4f2a940f0c6001560bb5e245c7b4d9afe3182cc
parent[systemstatus] Show "reboot required" message on update-tab too (diff)
downloadslx-admin-ff3474e2e69d1ac92eb227dfedd170cfb012ba94.tar.gz
slx-admin-ff3474e2e69d1ac92eb227dfedd170cfb012ba94.tar.xz
slx-admin-ff3474e2e69d1ac92eb227dfedd170cfb012ba94.zip
[news] Fix install: Falsely reported UPDATE_DONE every time
-rw-r--r--install.php4
-rw-r--r--modules-available/news/install.inc.php8
2 files changed, 9 insertions, 3 deletions
diff --git a/install.php b/install.php
index 889c77cd..e403ad7e 100644
--- a/install.php
+++ b/install.php
@@ -212,8 +212,10 @@ function tableAddConstraint($table, $column, $refTable, $refColumn, $actions, $i
// Yep, nothing more to do here
return UPDATE_NOOP;
}
+ error_log("$table, $column, $refTable, $refColumn, $actions");
+ error_log("Have: {$test['UPDATE_RULE']} want: $update && Have: {$test['DELETE_RULE']} want: $delete");
// Kill the old one
- $ret = tableDeleteConstraint($table, $test['CONSTRAINT_NAME']);
+ tableDeleteConstraint($table, $test['CONSTRAINT_NAME']);
}
if ($delete === 'CASCADE') {
// Deletes are cascaded, so make sure first that all rows get purged that would
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');