Skip to content

Commit

Permalink
fmDNS - #438 - upgrade.php and install.php fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WillyXJ committed Mar 29, 2019
1 parent baa450c commit 7ebe57b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/fm-modules/fmDNS/install.php
Expand Up @@ -46,6 +46,7 @@ function installfmDNSSchema($database, $module, $noisy = 'noisy') {
`account_id` int(11) NOT NULL DEFAULT '1',
`server_serial_no` varchar(255) NOT NULL DEFAULT '0',
`cfg_type` varchar(255) NOT NULL DEFAULT 'global',
`server_id` int(11) NOT NULL DEFAULT '0'
`view_id` int(11) NOT NULL DEFAULT '0',
`domain_id` int(11) NOT NULL DEFAULT '0',
`cfg_isparent` enum('yes','no') NOT NULL DEFAULT 'no',
Expand Down
24 changes: 23 additions & 1 deletion server/fm-modules/fmDNS/upgrade.php
Expand Up @@ -32,7 +32,7 @@ function upgradefmDNSSchema($running_version) {
}

/** Checks to support older versions (ie n-3 upgrade scenarios */
$success = version_compare($running_version, '3.3', '<') ? upgradefmDNS_330($__FM_CONFIG, $running_version) : true;
$success = version_compare($running_version, '3.3.3', '<') ? upgradefmDNS_333($__FM_CONFIG, $running_version) : true;
if (!$success) return $fmdb->last_error;

setOption('client_version', $__FM_CONFIG['fmDNS']['client_version'], 'auto', false, 0, 'fmDNS');
Expand Down Expand Up @@ -2163,4 +2163,26 @@ function upgradefmDNS_330($__FM_CONFIG, $running_version) {
return true;
}

/** 3.3.3 */
function upgradefmDNS_333($__FM_CONFIG, $running_version) {
global $fmdb;

$success = version_compare($running_version, '3.3', '<') ? upgradefmDNS_330($__FM_CONFIG, $running_version) : true;
if (!$success) return false;

$table[] = "ALTER TABLE `fm_{$__FM_CONFIG['fmDNS']['prefix']}servers` DROP `server_key`";
$table[] = "ALTER TABLE `fm_{$__FM_CONFIG['fmDNS']['prefix']}config` ADD `server_id` INT(11) NOT NULL DEFAULT '0' AFTER `cfg_type`";

/** Run queries */
if (count($table) && $table[0]) {
foreach ($table as $schema) {
$fmdb->query($schema);
}
}

setOption('version', '3.3.3', 'auto', false, 0, 'fmDNS');

return true;
}

?>

0 comments on commit 7ebe57b

Please sign in to comment.