diff options
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/main/install.inc.php | 18 | ||||
-rw-r--r-- | modules-available/rebootcontrol/inc/rebootcontrol.inc.php | 6 |
2 files changed, 20 insertions, 4 deletions
diff --git a/modules-available/main/install.inc.php b/modules-available/main/install.inc.php index b7dd2c4d..a19a069d 100644 --- a/modules-available/main/install.inc.php +++ b/modules-available/main/install.inc.php @@ -28,10 +28,13 @@ $res[] = tableCreate('property', " $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, KEY (`name`), - KEY `dateline` (`dateline`) + KEY `dateline` (`dateline`), + ADD KEY (`subkey`), + UNIQUE KEY `compound` (`name`, `subkey`) "); $res[] = tableCreate('user', " @@ -116,6 +119,19 @@ if (!tableHasColumn('user', 'serverid')) { Database::exec("ALTER TABLE `user` ADD `serverid` int(10) unsigned NULL DEFAULT NULL"); } +// +// +if (!tableHasColumn('property_list', 'subkey')) { + $ret = Database::exec("ALTER TABLE property_list + ADD COLUMN `subkey` int(10) unsigned NOT NULL AUTO_INCREMENT AFTER `name`, + ADD KEY (`subkey`), + ADD UNIQUE KEY `compound` (`name`, `subkey`)"); + if ($ret === false) { + finalResponse(UPDATE_FAILED, 'Cannot add subkey to property_list: ' . 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 $someUser = Database::queryFirst('SELECT userid FROM user ORDER BY userid ASC LIMIT 1'); diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php index 36b2b14f..83513081 100644 --- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php +++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php @@ -105,10 +105,10 @@ class RebootControl } $list = Property::getList(RebootControl::KEY_TASKLIST); $return = []; - foreach ($list as $entry) { + foreach ($list as $subkey => $entry) { $p = json_decode($entry, true); if (!is_array($p) || !isset($p['id'])) { - Property::removeFromList(RebootControl::KEY_TASKLIST, $entry); + Property::removeFromListByKey(RebootControl::KEY_TASKLIST, $subkey); continue; } if (is_array($locations) && is_array($p['locations']) && array_diff($p['locations'], $locations) !== []) @@ -131,7 +131,7 @@ class RebootControl } } if (!$valid) { - Property::removeFromList(RebootControl::KEY_TASKLIST, $entry); + Property::removeFromListByKey(RebootControl::KEY_TASKLIST, $subkey); continue; } $return[] = $p; |