diff --git a/module/backup/control.php b/module/backup/control.php index 529dbb5ab2..1cd940d32c 100644 --- a/module/backup/control.php +++ b/module/backup/control.php @@ -22,15 +22,19 @@ class backup extends control parent::__construct($moduleName, $methodName); $this->backupPath = $this->backup->getBackupPath(); - if(!is_dir($this->backupPath)) + + if($this->app->methodName != 'setting') { - if(!mkdir($this->backupPath, 0777, true)) $this->view->error = sprintf($this->lang->backup->error->noWritable, dirname($this->backupPath)); + if(!is_dir($this->backupPath)) + { + if(!mkdir($this->backupPath, 0777, true)) $this->view->error = sprintf($this->lang->backup->error->noWritable, dirname($this->backupPath)); + } + else + { + if(!is_writable($this->backupPath)) $this->view->error = sprintf($this->lang->backup->error->noWritable, $this->backupPath); + } + if(!is_writable($this->app->getTmpRoot())) $this->view->error = sprintf($this->lang->backup->error->noWritable, $this->app->getTmpRoot()); } - else - { - if(!is_writable($this->backupPath)) $this->view->error = sprintf($this->lang->backup->error->noWritable, $this->backupPath); - } - if(!is_writable($this->app->getTmpRoot())) $this->view->error = sprintf($this->lang->backup->error->noWritable, $this->app->getTmpRoot()); } /** @@ -72,6 +76,8 @@ class backup extends control $this->view->title = $this->lang->backup->common; $this->view->position[] = $this->lang->backup->common; $this->view->backups = $backups; + if(!is_writable($this->backupPath)) $this->view->backupError = sprintf($this->lang->backup->error->plainNoWritable, $this->backupPath); + if(!is_writable($this->app->getTmpRoot())) $this->view->backupError = sprintf($this->lang->backup->error->plainNoWritable, $this->app->getTmpRoot()); $this->display(); } diff --git a/module/backup/js/index.js b/module/backup/js/index.js index c2d28c68ed..e454ffd2fa 100644 --- a/module/backup/js/index.js +++ b/module/backup/js/index.js @@ -2,6 +2,11 @@ $(function() { $('.backup').click(function() { + if(backupError) + { + alert(backupError); + return; + } var that = this; $(that).toggleClass('loading'); $(that).text(getSpaceLoading); diff --git a/module/backup/lang/de.php b/module/backup/lang/de.php index 52a4965e0b..8123ab503f 100644 --- a/module/backup/lang/de.php +++ b/module/backup/lang/de.php @@ -46,11 +46,12 @@ $lang->backup->success->backup = 'Erledigt!'; $lang->backup->success->restore = 'Wiederhergestellt!'; $lang->backup->error = new stdclass(); -$lang->backup->error->noCreateDir = 'Directory does not exist and cannot be created'; -$lang->backup->error->noWritable = "%s ist nicht beschreibbar! Bitte prüfen Sie die Berechtigungen, ansonsten kann das Backup nicht erstellt werden."; -$lang->backup->error->noDelete = "%s kann nicht gelöscht werden. Bitte passen Sie die Berechtigungen an oder löschen Sie es manuell."; -$lang->backup->error->restoreSQL = "Datenbankwiederherstellung fehlgeschlagen. Error: %s."; -$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."; +$lang->backup->error->noCreateDir = 'Directory does not exist and cannot be created'; +$lang->backup->error->noWritable = "%s ist nicht beschreibbar! Bitte prüfen Sie die Berechtigungen, ansonsten kann das Backup nicht erstellt werden."; +$lang->backup->error->plainNoWritable = "%s ist nicht beschreibbar! Bitte prüfen Sie die Berechtigungen, ansonsten kann das Backup nicht erstellt werden."; +$lang->backup->error->noDelete = "%s kann nicht gelöscht werden. Bitte passen Sie die Berechtigungen an oder löschen Sie es manuell."; +$lang->backup->error->restoreSQL = "Datenbankwiederherstellung fehlgeschlagen. Error: %s."; +$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 d0aba3d73f..ac3b7e3e28 100644 --- a/module/backup/lang/en.php +++ b/module/backup/lang/en.php @@ -46,11 +46,12 @@ $lang->backup->success->backup = 'Done!'; $lang->backup->success->restore = 'Restored!'; $lang->backup->error = new stdclass(); -$lang->backup->error->noCreateDir = 'Directory does not exist and cannot be created'; -$lang->backup->error->noWritable = "%s is not writable! Please check the privilege, or backup will not be done."; -$lang->backup->error->noDelete = "%s cannot be deleted. Please modify the privilege or manually delete it."; -$lang->backup->error->restoreSQL = "Failed to restore the database library. Error %s."; -$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->noCreateDir = 'Directory does not exist and cannot be created'; +$lang->backup->error->noWritable = "%s is not writable! Please check the privilege, or backup will not be done."; +$lang->backup->error->plainNoWritable = "%s is not writable! Please check the privilege, or backup will not be done."; +$lang->backup->error->noDelete = "%s cannot be deleted. Please modify the privilege or manually delete it."; +$lang->backup->error->restoreSQL = "Failed to restore the database library. Error %s."; +$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 79aad08dfe..1e55060221 100644 --- a/module/backup/lang/fr.php +++ b/module/backup/lang/fr.php @@ -46,11 +46,12 @@ $lang->backup->success->backup = 'Terminé avec succès !'; $lang->backup->success->restore = 'Restauré avec succès !'; $lang->backup->error = new stdclass(); -$lang->backup->error->noCreateDir = "Le répertoire n'existe pas et ne peut pas être créer. C'est problématique."; -$lang->backup->error->noWritable = "%s n'est pas autorisé à l'écriture ! Vérifier les privilèges sinon le backup ne pourra pas se faire."; -$lang->backup->error->noDelete = "%s ne peut pas être supprimé. Modifiez les privilèges ou supprimez-le avec vos petites mains."; -$lang->backup->error->restoreSQL = "Echec pour restaurer la database library. Error %s."; -$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."; +$lang->backup->error->noCreateDir = "Le répertoire n'existe pas et ne peut pas être créer. C'est problématique."; +$lang->backup->error->noWritable = "%s n'est pas autorisé à l'écriture ! Vérifier les privilèges sinon le backup ne pourra pas se faire."; +$lang->backup->error->plainNoWritable = "%s n'est pas autorisé à l'écriture ! Vérifier les privilèges sinon le backup ne pourra pas se faire."; +$lang->backup->error->noDelete = "%s ne peut pas être supprimé. Modifiez les privilèges ou supprimez-le avec vos petites mains."; +$lang->backup->error->restoreSQL = "Echec pour restaurer la database library. Error %s."; +$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/vi.php b/module/backup/lang/vi.php index 2bf657eaa8..a9e0769562 100644 --- a/module/backup/lang/vi.php +++ b/module/backup/lang/vi.php @@ -43,10 +43,11 @@ $lang->backup->success->backup = 'Sao lưu hoàn thành!'; $lang->backup->success->restore = 'Khôi phục hoàn thành!'; $lang->backup->error = new stdclass(); -$lang->backup->error->noCreateDir = 'Thư mục không tồn tại và không thể tạo'; -$lang->backup->error->noWritable = "%s không thể ghi! Vui lòng kiểm tra quyền, nếu không sao lưu sẽ không thể hoàn thành."; -$lang->backup->error->noDelete = "%s không thể xóa. Vui lòng điều chỉnh quyền hoặc xóa nó thủ công."; -$lang->backup->error->restoreSQL = "Lỗi khôi phục thư viện CSDL. Lỗi %s."; -$lang->backup->error->restoreFile = "Lỗi khôi phục tập tin. Lỗi %s."; -$lang->backup->error->backupFile = "Lỗi sao lưu tập tin. Lỗi %s."; -$lang->backup->error->backupCode = "Lỗi sao lưu mã nguồn. Lỗi %s."; +$lang->backup->error->noCreateDir = 'Thư mục không tồn tại và không thể tạo'; +$lang->backup->error->noWritable = "%s không thể ghi! Vui lòng kiểm tra quyền, nếu không sao lưu sẽ không thể hoàn thành."; +$lang->backup->error->plainNoWritable = "%s không thể ghi! Vui lòng kiểm tra quyền, nếu không sao lưu sẽ không thể hoàn thành."; +$lang->backup->error->noDelete = "%s không thể xóa. Vui lòng điều chỉnh quyền hoặc xóa nó thủ công."; +$lang->backup->error->restoreSQL = "Lỗi khôi phục thư viện CSDL. Lỗi %s."; +$lang->backup->error->restoreFile = "Lỗi khôi phục tập tin. Lỗi %s."; +$lang->backup->error->backupFile = "Lỗi sao lưu tập tin. Lỗi %s."; +$lang->backup->error->backupCode = "Lỗi sao lưu mã nguồn. Lỗi %s."; diff --git a/module/backup/lang/zh-cn.php b/module/backup/lang/zh-cn.php index 85c7cf25f5..849027f036 100644 --- a/module/backup/lang/zh-cn.php +++ b/module/backup/lang/zh-cn.php @@ -46,11 +46,12 @@ $lang->backup->success->backup = '备份成功!'; $lang->backup->success->restore = '还原成功!'; $lang->backup->error = new stdclass(); -$lang->backup->error->noCreateDir = '备份目录不存在,也无法创建该目录'; -$lang->backup->error->noWritable = "%s 不可写!请检查该目录权限,否则无法备份。"; -$lang->backup->error->noDelete = "文件 %s 无法删除,修改权限或手工删除。"; -$lang->backup->error->restoreSQL = "数据库还原失败,错误:%s"; -$lang->backup->error->restoreFile = "附件还原失败,错误:%s"; -$lang->backup->error->backupFile = "附件备份失败,错误:%s"; -$lang->backup->error->backupCode = "代码备份失败,错误:%s"; -$lang->backup->error->timeout = "备份超时"; +$lang->backup->error->noCreateDir = '备份目录不存在,也无法创建该目录'; +$lang->backup->error->noWritable = "%s 不可写!请检查该目录权限,否则无法备份。"; +$lang->backup->error->plainNoWritable = "%s 不可写!请检查该目录权限,否则无法备份。"; +$lang->backup->error->noDelete = "文件 %s 无法删除,修改权限或手工删除。"; +$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 c9fa7debd9..763468dfd9 100644 --- a/module/backup/view/index.html.php +++ b/module/backup/view/index.html.php @@ -136,4 +136,5 @@ backup->restore);?> backup->error->timeout);?> backup->insufficientDisk);?> +