diff --git a/module/backup/control.php b/module/backup/control.php index 26713a2d5e..9d4576c6c2 100644 --- a/module/backup/control.php +++ b/module/backup/control.php @@ -93,12 +93,12 @@ class backup extends control $backFileName = "{$this->backupPath}{$fileName}.sql"; if(!$nosafe) $backFileName .= '.php'; $result = $this->backup->backSQL($backFileName); + if(!$result->result) { if($reload == 'yes') { - echo js::alert(sprintf($this->lang->backup->error->noWritable, $this->backupPath)); - return print(js::reload('parent')); + return print(sprintf($this->lang->backup->error->noWritable, $this->backupPath)); } else { @@ -112,12 +112,12 @@ class backup extends control $backFileName = "{$this->backupPath}{$fileName}.file"; $result = $this->backup->backFile($backFileName); + if(!$result->result) { if($reload == 'yes') { - echo js::alert(sprintf($this->lang->backup->error->backupFile, $result->error)); - return print(js::reload('parent')); + return print(sprintf($this->lang->backup->error->backupFile, $result->error)); } else { @@ -132,8 +132,7 @@ class backup extends control { if($reload == 'yes') { - echo js::alert(sprintf($this->lang->backup->error->backupCode, $result->error)); - return print(js::reload('parent')); + return print(sprintf($this->lang->backup->error->backupCode, $result->error)); } else { @@ -164,7 +163,7 @@ class backup extends control } } - if($reload == 'yes') return print(js::reload('parent')); + if($reload == 'yes') return print($this->lang->backup->success->backup); echo $this->lang->backup->success->backup . "\n"; } diff --git a/module/backup/js/index.js b/module/backup/js/index.js index 4fc094c196..6a46f3dd21 100644 --- a/module/backup/js/index.js +++ b/module/backup/js/index.js @@ -2,9 +2,32 @@ $(function() { $('.backup').click(function() { + var timeID = null; + + $.ajax({ + url: $(this).attr('data-link'), + success: function(data) + { + clearInterval(timeID); + + $('#waitting .modal-body #message').append(data); + + setTimeout(function(){return location.reload();}, 2000); + }, + error: function(request, textstatus, error) + { + clearInterval(timeID); + + if(textstatus == 'timeout') $('#waitting .modal-body #message').append("
" + backupTimeout + '
'); + + setTimeout(function(){return location.reload();}, 2000); + } + }); + $('#waitting .modal-body #backupType').html(backup); $('#waitting').modal('show'); - setInterval(function() + + timeID = setInterval(function() { $.get(createLink('backup', 'ajaxGetProgress'), function(data) { @@ -12,6 +35,7 @@ $(function() }); }, 1000); }) + $('.rmPHPHeader').click(function() { $('#waitting .modal-body #backupType').html(rmPHPHeader); diff --git a/module/backup/lang/de.php b/module/backup/lang/de.php index d4078fad1c..4b57e619bb 100644 --- a/module/backup/lang/de.php +++ b/module/backup/lang/de.php @@ -48,3 +48,4 @@ $lang->backup->error->restoreSQL = "Datenbankwiederherstellung fehlgeschlagen. $lang->backup->error->restoreFile = "Dateiwiederherstellung fehlgeschlagen. Error: %s."; $lang->backup->error->backupFile = "Dateibackup fehlgeschlagen. Error: %s."; $lang->backup->error->backupCode = "Codebackup fehlgeschlagen. Error: %s."; +$lang->backup->error->timeout = "Backup timeout."; diff --git a/module/backup/lang/en.php b/module/backup/lang/en.php index 2b5109c58b..5a07230909 100644 --- a/module/backup/lang/en.php +++ b/module/backup/lang/en.php @@ -48,3 +48,4 @@ $lang->backup->error->restoreSQL = "Failed to restore the database library. Err $lang->backup->error->restoreFile = "Failed to restore the file. Error %s."; $lang->backup->error->backupFile = "Failed to back up the file. Error %s."; $lang->backup->error->backupCode = "Failed to back up the code. Error %s."; +$lang->backup->error->timeout = "Backup timeout."; diff --git a/module/backup/lang/fr.php b/module/backup/lang/fr.php index 2bcc5e5581..9c46497f40 100644 --- a/module/backup/lang/fr.php +++ b/module/backup/lang/fr.php @@ -48,3 +48,4 @@ $lang->backup->error->restoreSQL = "Echec pour restaurer la database library. E $lang->backup->error->restoreFile = "Echec pour restaurer le fichier. Erreur %s."; $lang->backup->error->backupFile = "Echec pour sauvegarder le fichier. Erreur %s."; $lang->backup->error->backupCode = "Echec pour sauvegarder le code. Erreur %s."; +$lang->backup->error->timeout = "Backup timeout."; diff --git a/module/backup/lang/zh-cn.php b/module/backup/lang/zh-cn.php index f47c2a1137..d75db5bfca 100644 --- a/module/backup/lang/zh-cn.php +++ b/module/backup/lang/zh-cn.php @@ -48,3 +48,4 @@ $lang->backup->error->restoreSQL = "数据库还原失败,错误:%s"; $lang->backup->error->restoreFile = "附件还原失败,错误:%s"; $lang->backup->error->backupFile = "附件备份失败,错误:%s"; $lang->backup->error->backupCode = "代码备份失败,错误:%s"; +$lang->backup->error->timeout = "备份超时"; diff --git a/module/backup/view/index.html.php b/module/backup/view/index.html.php index 4a642163ff..43bc042b3a 100644 --- a/module/backup/view/index.html.php +++ b/module/backup/view/index.html.php @@ -27,7 +27,13 @@