Added check in updater if there is more than one entry for backup_enabled, refs #992

Signed-off-by: Andreas Burchert (scarya) <scarya@froxlor.org>
This commit is contained in:
Andreas Burchert (scarya)
2011-12-12 19:39:53 +01:00
parent a76cbbcb55
commit 8dfd27a0dc

View File

@@ -1733,6 +1733,27 @@ if(isFroxlorVersion('0.9.25'))
// enable bind by default
$db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'bind_enable', '1')");
// check for multiple backup_enabled entries
$handle = $db->query("SELECT `value` FROM `panel_settings` WHERE `varname` = 'backup_enabled';");
// if there are more than one entry try to fix it
if ($db->num_rows($handle) > 1) {
$rows = $db->fetch_array($handle);
$state = false;
// iterate through all found entries
// and try to guess what value it should be
foreach ($rows as $row) {
$state = $state | $row['value'];
}
// now delete all entries
$db->query("DELETE FROM `panel_settings` WHERE `varname` = 'backup_enabled';");
// and re-add it
$db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'backup_enabled', '". $state ."');");
}
updateToVersion('0.9.26-rc1');
}