Skip to content

Commit 4e0e804

Browse files
committed
Hide database backup option and quota for PostgreSQL databases and ensure that no mysql backup routine is run for postgresql databases.
1 parent 1e52b84 commit 4e0e804

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

install/sql/ispconfig3.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ CREATE TABLE `web_database` (
19371937
`sys_perm_other` varchar(5) DEFAULT NULL,
19381938
`server_id` int(11) unsigned NOT NULL DEFAULT '0',
19391939
`parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0',
1940-
`type` varchar(16) NOT NULL DEFAULT 'y',
1940+
`type` varchar(16) NOT NULL DEFAULT 'mysql',
19411941
`database_name` varchar(64) DEFAULT NULL,
19421942
`database_name_prefix` varchar(50) NOT NULL default '',
19431943
`database_quota` int(11) DEFAULT NULL,

interface/web/sites/templates/database_edit.htm

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,36 @@
166166
resultBoxPosition: ''
167167
});
168168
</script>
169+
170+
<script type="text/javascript">
171+
jQuery(document).ready(function() {
172+
// Function to toggle backup_interval and database_quota visibility based on database type
173+
function togglePostgresqlFields() {
174+
var dbType = jQuery('#type').val();
175+
if (dbType === 'postgresql') {
176+
jQuery('#backup_interval').closest('.form-group').hide();
177+
jQuery('#quota').closest('.form-group').hide();
178+
} else {
179+
jQuery('#backup_interval').closest('.form-group').show();
180+
jQuery('#quota').closest('.form-group').show();
181+
}
182+
}
183+
184+
// Check on page load
185+
togglePostgresqlFields();
186+
187+
// Check when type changes
188+
jQuery('#type').change(function() {
189+
togglePostgresqlFields();
190+
});
191+
192+
// For the case when type is disabled and using hidden input
193+
if (jQuery('#type').length === 0 && jQuery('input[name="type"]').length > 0) {
194+
var hiddenType = jQuery('input[name="type"]').val();
195+
if (hiddenType === 'postgresql') {
196+
jQuery('#backup_interval').closest('.form-group').hide();
197+
jQuery('#quota').closest('.form-group').hide();
198+
}
199+
}
200+
});
201+
</script>

server/lib/classes/backup.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ protected static function make_database_backup($web_domain, $backup_job)
17491749
if (empty($backup_job))
17501750
$backup_job = "auto";
17511751

1752-
$records = $app->dbmaster->queryAllRecords("SELECT * FROM web_database WHERE server_id = ? AND parent_domain_id = ?", $server_id, $domain_id);
1752+
$records = $app->dbmaster->queryAllRecords("SELECT * FROM web_database WHERE type = 'mysql' AND server_id = ? AND parent_domain_id = ?", $server_id, $domain_id);
17531753
if (empty($records)){
17541754
$app->log('Skipping database backup for domain ' . $web_domain['domain_id'] . ', because no related databases found.', LOGLEVEL_DEBUG);
17551755
return true;

0 commit comments

Comments
 (0)