Commit 556e4c1e authored by mcramer's avatar mcramer

Bugfix: Backup did not work correctly on multiple databases in one web. "X...

Bugfix: Backup did not work correctly on multiple databases in one web. "X Copies" were not preserved per database so not all databases were backed up
Bugfix: Select box did behave strange in some cases
parent 2809a121
......@@ -250,12 +250,13 @@
var input,
self = this,
select = this.element,
internal = false,
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "",
wrapper = this.wrapper = $( "<span>" )
.addClass( "ui-combobox" )
.insertAfter( select );
input = $( "<input>" ).css( { "width": (select.is(':visible') ? (elwidth > 15 ? elwidth - 15 : 1) : 350), "height": (elheight > 0 ? elheight : 16) });
select.hide();
input.appendTo( wrapper )
......@@ -293,7 +294,10 @@
} else if($(select).attr('onchange')) {
eval($(select).attr('onchange'));
} else {
if(!ui.item.internal) $(select).change();
if(!ui.item.internal) {
internal = true;
$(select).change();
}
}
if (jQuery(".panel #Filter").length > 0) {
jQuery(".panel #Filter").trigger('click');
......@@ -352,6 +356,10 @@
return el;
};
select.change(function(e) {
if(internal == true) {
internal = false;
return;
}
var matcher = new RegExp( "" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "", "i" ),
matchtext = $(this).val();
valid = false,
......
......@@ -747,25 +747,28 @@ if($backup_dir != '') {
$dir_handle = dir($db_backup_dir);
$files = array();
while (false !== ($entry = $dir_handle->read())) {
if($entry != '.' && $entry != '..' && substr($entry,0,2) == 'db' && is_file($db_backup_dir.'/'.$entry)) {
$files[] = $entry;
if($entry != '.' && $entry != '..' && preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql.gz$/', $entry, $matches) && is_file($db_backup_dir.'/'.$entry)) {
if(array_key_exists($matches[1], $files) == false) $files[$matches[1]] = array();
$files[$matches[1]][] = $entry;
}
}
$dir_handle->close();
rsort($files);
for ($n = $backup_copies; $n <= 10; $n++) {
if(isset($files[$n]) && is_file($db_backup_dir.'/'.$files[$n])) {
unlink($db_backup_dir.'/'.$files[$n]);
$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($files[$n])."'";
$tmp = $app->dbmaster->queryOneRecord($sql);
//$app->dbmaster->datalogDelete('web_backup', 'backup_id', $tmp['backup_id']);
$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
$app->db->query($sql);
$app->dbmaster->query($sql);
}
}
reset($files);
foreach($files as $db_name => $filelist) {
rsort($filelist);
for ($n = $backup_copies; $n <= 10; $n++) {
if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
unlink($db_backup_dir.'/'.$filelist[$n]);
$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
$tmp = $app->dbmaster->queryOneRecord($sql);
//$app->dbmaster->datalogDelete('web_backup', 'backup_id', $tmp['backup_id']);
$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
$app->db->query($sql);
$app->dbmaster->query($sql);
}
}
}
unset($files);
unset($dir_handle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment