summaryrefslogtreecommitdiffstats
path: root/modules-available/main
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-04 16:58:45 +0200
committerSimon Rettberg2022-07-04 16:58:45 +0200
commit7d2d1c6cdc984b5c25ab6b3a40bd6614b17d0ef9 (patch)
treebd681df91c273ea44bbbc8ab059e0633ca8db346 /modules-available/main
parent[rebootcontrol/main] Add subkey column to property_list table (diff)
downloadslx-admin-7d2d1c6cdc984b5c25ab6b3a40bd6614b17d0ef9.tar.gz
slx-admin-7d2d1c6cdc984b5c25ab6b3a40bd6614b17d0ef9.tar.xz
slx-admin-7d2d1c6cdc984b5c25ab6b3a40bd6614b17d0ef9.zip
[vmstore/main] Use property list for results so they work cross-session
Diffstat (limited to 'modules-available/main')
-rw-r--r--modules-available/main/install.inc.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php
index a19a069d..ac38214e 100644
--- a/modules-available/main/install.inc.php
+++ b/modules-available/main/install.inc.php
@@ -21,7 +21,7 @@ $res[] = tableCreate('permission', "
$res[] = tableCreate('property', "
`name` varchar(50) NOT NULL,
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
- `value` text NOT NULL,
+ `value` mediumblob NOT NULL,
PRIMARY KEY (`name`),
KEY `dateline` (`dateline`)
");
@@ -30,7 +30,7 @@ $res[] = tableCreate('property_list', "
`name` varchar(50) NOT NULL,
`subkey` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
- `value` text NOT NULL,
+ `value` mediumblob NOT NULL,
KEY (`name`),
KEY `dateline` (`dateline`),
ADD KEY (`subkey`),
@@ -93,7 +93,8 @@ $res[] = tableCreate('mail_config', "
// ##### 2014-05-28
// Add dateline field to property table
if (!tableHasColumn('property', 'dateline')) {
- Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name` , ADD INDEX ( `dateline` )");
+ Database::exec("ALTER TABLE `property` ADD `dateline` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `name`,
+ ADD INDEX ( `dateline` )");
}
// #######################
@@ -119,8 +120,9 @@ if (!tableHasColumn('user', 'serverid')) {
Database::exec("ALTER TABLE `user` ADD `serverid` int(10) unsigned NULL DEFAULT NULL");
}
-//
-//
+// #######################
+// ##### 2022-07-04
+// Add subkey to property_list, make value mediumblob instead of text
if (!tableHasColumn('property_list', 'subkey')) {
$ret = Database::exec("ALTER TABLE property_list
ADD COLUMN `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT AFTER `name`,
@@ -131,6 +133,15 @@ if (!tableHasColumn('property_list', 'subkey')) {
}
$res[] = UPDATE_DONE;
}
+foreach (['property', 'property_list'] as $table) {
+ if (stripos(tableColumnType($table, 'value'), 'mediumblob') === false) {
+ $ret = Database::exec("ALTER TABLE `$table` MODIFY `value` mediumblob NOT NULL");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, "Cannot change value column of $table to mediumblob: " . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+ }
+}
// Make sure that if any users exist, one of the has UID=1, otherwise if the permission module is
// used we'd lock out everyone