diff --git a/datamodels/2.x/itop-backup/ajax.backup.php b/datamodels/2.x/itop-backup/ajax.backup.php index b80ebfff7..2430bf7a3 100644 --- a/datamodels/2.x/itop-backup/ajax.backup.php +++ b/datamodels/2.x/itop-backup/ajax.backup.php @@ -65,17 +65,16 @@ switch ($sOperation) */ case 'restore_exec': IssueLog::Enable(APPROOT.'log/error.log'); - if (utils::GetConfig()->Get('demo_mode')) - { - DisplayErrorAndDie($oPage, '
Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the feature is disabled.
'); + if (utils::GetConfig()->Get('demo_mode')) { + DisplayErrorAndDie($oPage, + '
Sorry, '.ITOP_APPLICATION_SHORT.' is in demonstration mode: the feature is disabled.
'); } $sToken = utils::ReadParam('token', '', false, 'raw_data'); $sBasePath = APPROOT.'/data/'; $sTokenFile = $sBasePath.'restore.'.$sToken.'.tok'; $tokenRealPath = utils::RealPath($sTokenFile, $sBasePath); - if (($tokenRealPath === false) || (!is_file($tokenRealPath))) - { + if (($tokenRealPath === false) || (!is_file($tokenRealPath))) { IssueLog::Error("ajax.backup.php operation=$sOperation ERROR = inexisting token $sToken"); $sEscapedToken = utils::HtmlEntities($sToken); DisplayErrorAndDie($oPage, "

Error: missing token file: '$sEscapedToken'

"); diff --git a/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php index 9e4e97654..265764bf7 100644 --- a/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/cs.dict.itop-backup.php @@ -18,8 +18,8 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'bkp-mysqldump-ok' => 'mysqldump nalezen: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump nemohl být nalezen: %1$s - Ujistěte se prosím, že je nainstalován a v proměnné PATH, nebo upravte konfigurační soubor (položka mysql_bindir).', 'bkp-mysqldump-issue' => 'mysqldump nemohl být spuštěn (retcode=%1$d): Ujistěte se prosím, že je nainstalován a v proměnné PATH, nebo upravte konfigurační soubor (položka mysql_bindir).', - 'bkp-missing-dir' => 'Cílová složka %1$s nebyla nalezena', - 'bkp-free-disk-space' => '%1$s volných na %2$s', + 'bkp-missing-dir' => 'Cílová složka %1$s nebyla nalezena', + 'bkp-free-disk-space' => '%1$s volných na %2$s', 'bkp-dir-not-writeable' => 'Nemohu zapisovat do adresáře %1$s', 'bkp-wrong-format-spec' => 'Současná specifikace názvu souboru nemůže být použita (%1$s). Bude nastavena výchozí: %2$s', 'bkp-name-sample' => 'Soubory zálohy jsou pojmenovány dle DB, data a času. Příklad: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php index 5de0643d6..03eca242d 100644 --- a/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/da.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s count not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php index b60f0cb1d..315ddcabf 100644 --- a/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/de.dict.itop-backup.php @@ -33,8 +33,8 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'bkp-mysqldump-ok' => 'mysqldump ist vorhanden: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump wurde nicht gefunden: %1$s - Stellen Sie sicher, das er eingespielt und im Pfad verfügbar ist oder editieren Sie die Konfigurationsdatei um das MySQL bindir anzupassen.', 'bkp-mysqldump-issue' => 'mysqldump konnte nicht eingespielt werden (retcode=%1$d): Stellen Sie sicher, das es installiert und im Pfad verfügbar ist oder editieren Sie die Konfigurationsdatei um das MySQL bindir anzupassen.', - 'bkp-missing-dir' => 'Zielverzeichniss %1$s nicht gefunden', - 'bkp-free-disk-space' => '%1$s frei in %2$s', + 'bkp-missing-dir' => 'Zielverzeichniss %1$s nicht gefunden', + 'bkp-free-disk-space' => '%1$s frei in %2$s', 'bkp-dir-not-writeable' => '%1$s ist nicht schreibbar', 'bkp-wrong-format-spec' => 'Die verwendete Definition zur Formatierung von Dateinamen ist nicht korrekt (%1$s). Die Standard-Definition %2$s wird verwendet', 'bkp-name-sample' => 'Backup-Dateien werden abhängig von Datum, Zeit und Datenbank-Identifier erstellt. Beispiel: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php index fd94c1ac6..f79cbc59f 100644 --- a/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/en.dict.itop-backup.php @@ -32,8 +32,8 @@ Dict::Add('EN US', 'English', 'English', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir', - 'bkp-missing-dir' => 'The target directory %1$s could not be found', - 'bkp-free-disk-space' => '%1$s free in %2$s', + 'bkp-missing-dir' => 'The target directory %1$s could not be found', + 'bkp-free-disk-space' => '%1$s free in %2$s', 'bkp-dir-not-writeable' => '%1$s is not writeable', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php index 59adb9638..fba401392 100644 --- a/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/es_cr.dict.itop-backup.php @@ -31,8 +31,8 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', array( 'bkp-mysqldump-ok' => 'mysqldump está presente: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump no pudo ser encontrado: %1$s - Por favor asegurese que esté instalado en el "path", o edite el archivo de configuración para ajustar mysql_bindir.', 'bkp-mysqldump-issue' => 'mysqldump no puede ejecutarse (retcode=%1$d): Por favor asegurese que esté instalado en el "path", o edite el archivo de configuración para ajustar mysql_bindir.', - 'bkp-missing-dir' => 'El directorio destino %1$s no puede ser encontrado', - 'bkp-free-disk-space' => '%1$s libre in %2$s', + 'bkp-missing-dir' => 'El directorio destino %1$s no puede ser encontrado', + 'bkp-free-disk-space' => '%1$s libre in %2$s', 'bkp-dir-not-writeable' => '%1$s no es escribible', 'bkp-wrong-format-spec' => 'La actual especificación para el formato de nombre de archivo es erróneo (%1$s). Una especifiación por omisión se aplicará: %2$s', 'bkp-name-sample' => 'Los archivos de respaldo son nombrados dependiento de identificadores de BD, fecha y hora. Ejemplo: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php index e43e35ddb..8c837b03d 100644 --- a/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/fr.dict.itop-backup.php @@ -16,8 +16,8 @@ Dict::Add('FR FR', 'French', 'Français', array( 'bkp-mysqldump-ok' => 'mysqldump est installé: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump n\'a pas été trouvé: %1$s - Veuillez vous assurer que les outils mysql sont installés et qu\'ils sont accessibles en ligne de commande, ou bien éditez le fichier de configuration pour en donner le chemin via mysql_bindir.', 'bkp-mysqldump-issue' => 'mysqldump n\'a pas pu être exécuté (code de retour: %1$d). Veuillez vérifier que les outils mysql sont installés et qu\'ils sont accessibles en ligne de commande, ou bien éditez le fichier de configuration pour en donner le chemin via mysql_bindir.', - 'bkp-missing-dir' => 'Le répertoire cible \'%1$s\' n\'existe pas ou ne peut pas être lu.', - 'bkp-free-disk-space' => 'Vous disposez de %1$s d\'espace disque sur %2$s', + 'bkp-missing-dir' => 'Le répertoire cible %1$s n\'existe pas ou ne peut pas être lu.', + 'bkp-free-disk-space' => 'Vous disposez de %1$s d\'espace disque sur %2$s', 'bkp-dir-not-writeable' => 'Le répertoire cible \'%1$s\' n\'est pas accessible en écriture.', 'bkp-wrong-format-spec' => 'La spécification de format pour le nom des sauvegarde est incorrecte (%1$s). La spécification par défaut sera appliquée: %2$s', 'bkp-name-sample' => 'Les fichiers de sauvegardes seront nommés en fonction de la base, la date et l\'heure. Par exemple: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php index da7e534dd..2900ff867 100644 --- a/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/hu.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s count not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php index e79b4c6bd..8190b2383 100644 --- a/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/it.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s count not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php index 7276dec5f..8476f0150 100644 --- a/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/ja.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s count not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php index fac8cec28..0da5345b1 100644 --- a/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/nl.dict.itop-backup.php @@ -34,8 +34,8 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'bkp-mysqldump-ok' => 'mysqldump is geïnstalleerd: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump is onvindbaar: %1$s - Zorg dat dit geïnstalleerd is in het juiste pad of pas de configuratie aan ("mysql_bindir")', 'bkp-mysqldump-issue' => 'mysqldump kon niet worden uitgevoerd (retcode=%1$d): Zorg dat dit geïnstalleerd is in het juiste pad of pas de configuratie aan ("mysql_bindir")', - 'bkp-missing-dir' => 'De doelmap %1$s is niet toegankelijk.', - 'bkp-free-disk-space' => '%1$s vrij in %2$s', + 'bkp-missing-dir' => 'De doelmap %1$s is niet toegankelijk.', + 'bkp-free-disk-space' => '%1$s vrij in %2$s', 'bkp-dir-not-writeable' => 'Geen schrijfrechten op %1$s', 'bkp-wrong-format-spec' => 'Het huidige formaat voor bestandsnamen is ongeldig (%1$s). Een standaardformaat wordt toegepast: %2$s', 'bkp-name-sample' => 'Backupbestanden krijgen een naam gebaseerd op de identificatiegegevens van het databaseschema, datum en tijd. Voorbeeld: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php index 2722e0c03..6d90e755b 100644 --- a/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/pt_br.dict.itop-backup.php @@ -16,8 +16,8 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'bkp-mysqldump-ok' => 'mysqldump está presente: %1$s', 'bkp-mysqldump-notfound' => 'mysqldump não pode ser encontrado: %1$s - Por favor, verifique se ele está instalado e no caminho, ou edite o arquivo de configuração para ajustar mysql_bindir.', 'bkp-mysqldump-issue' => 'mysqldump não pode ser executado (retcode=%1$d): Por favor, certifique-se de que está instalado e no caminho, ou edite o arquivo de configuração para ajustar mysql_bindir.', - 'bkp-missing-dir' => 'O diretório de destino %1$s não foi encontrado', - 'bkp-free-disk-space' => '%1$s livre in %2$s', + 'bkp-missing-dir' => 'O diretório de destino %1$s não foi encontrado', + 'bkp-free-disk-space' => '%1$s livre in %2$s', 'bkp-dir-not-writeable' => '%1$s não é gravável', 'bkp-wrong-format-spec' => 'A especificação atual para formatar os nomes dos arquivos está errada. (%1$s). A especificação padrão foi aplicada: %2$s', 'bkp-name-sample' => 'Os arquivos de backup são nomeados dependendo dos identificadores do banco de dados, data e hora. Exemplo: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php index df8de6541..0c8c3f552 100644 --- a/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/ru.dict.itop-backup.php @@ -19,8 +19,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'bkp-mysqldump-ok' => 'Утилита mysqldump найдена: %1$s', 'bkp-mysqldump-notfound' => 'Утилиту mysqldump найти не удалось: %1$s - пожалуйста, убедитесь в том, что она установлена, и путь до директории с бинарными файлами добавлен в PATH, либо измените параметр mysql_bindir в файле конфигурации.', 'bkp-mysqldump-issue' => 'Утилита mysqldump на может быть запущена (retcode=%1$d) Пожалуйста, убедитесь в том, что она установлена, и путь до директории с бинарными файлами добавлен в PATH, либо измените параметр mysql_bindir в файле конфигурации.', - 'bkp-missing-dir' => 'The target directory %1$s count not be found', - 'bkp-free-disk-space' => '%1$s свободно в %2$s', + 'bkp-free-disk-space' => '%1$s свободно в %2$s', 'bkp-dir-not-writeable' => '%1$s недоступен для записи', 'bkp-wrong-format-spec' => 'Неправильный формат шаблона названия файлов резервных копий (%1$s). Будет использован шаблон по умолчанию: %2$s', 'bkp-name-sample' => 'Название файлов резервных копий зависит от идентификатора БД, даты и времени. Пример: %1$s', diff --git a/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php index e6d89e877..a3372ffe4 100644 --- a/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/sk.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s could not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php index 37c7fe6f0..426fd7d38 100644 --- a/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/tr.dict.itop-backup.php @@ -31,8 +31,6 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~', 'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~', 'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~', - 'bkp-missing-dir' => 'The target directory %1$s count not be found~~', - 'bkp-free-disk-space' => '%1$s free in %2$s~~', 'bkp-dir-not-writeable' => '%1$s is not writeable~~', 'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~', 'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~', diff --git a/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php b/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php index 45c5d702b..1fbfd0920 100644 --- a/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php +++ b/datamodels/2.x/itop-backup/dictionaries/zh_cn.dict.itop-backup.php @@ -31,8 +31,8 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'bkp-mysqldump-ok' => '已找到mysqldump : %1$s', 'bkp-mysqldump-notfound' => 'mysqldump 找不到: %1$s - 请确认它安装在正确的路径, 或者调整iTop 配置文件的选项mysql_bindir.', 'bkp-mysqldump-issue' => 'mysqldump 无法运行 (retcode=%1$d): 请确认它安装在正确的路径, 或者调整iTop 配置文件的选项mysql_bindir', - 'bkp-missing-dir' => '目标目录 %1$s 找不到', - 'bkp-free-disk-space' => '%1$s 空闲 在 %2$s', + 'bkp-missing-dir' => '目标目录 %1$s 找不到', + 'bkp-free-disk-space' => '%1$s 空闲%2$s', 'bkp-dir-not-writeable' => '%1$s 没有写入权限', 'bkp-wrong-format-spec' => '当前文件名格式错误 (%1$s). 默认格式应该是: %2$s', 'bkp-name-sample' => '备份文件将以数据库名、日期和时间进行命名. 例如: %1$s', diff --git a/datamodels/2.x/itop-backup/status.php b/datamodels/2.x/itop-backup/status.php index feeeb9b1b..0e5ca48ab 100644 --- a/datamodels/2.x/itop-backup/status.php +++ b/datamodels/2.x/itop-backup/status.php @@ -17,8 +17,19 @@ * You should have received a copy of the GNU Affero General Public License */ -if (!defined('__DIR__')) define('__DIR__', dirname(__FILE__)); -if (!defined('APPROOT')) require_once(__DIR__.'/../../approot.inc.php'); +use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory; +use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSet; +use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory; +use Combodo\iTop\Application\UI\Base\UIBlock; + +if (!defined('__DIR__')) { + define('__DIR__', dirname(__FILE__)); +} +if (!defined('APPROOT')) { + require_once(__DIR__.'/../../approot.inc.php'); +} require_once(APPROOT.'application/application.inc.php'); require_once(APPROOT.'application/itopwebpage.class.inc.php'); @@ -27,41 +38,62 @@ require_once(APPROOT.'application/startup.inc.php'); require_once(APPROOT.'application/loginwebpage.class.inc.php'); +function GenerateBackupsList(string $sListTitleDictKey, string $sNoRecordDictKey, $aListConfig, $aListData): UIBlock +{ + $oFieldsetForList = new FieldSet(Dict::S($sListTitleDictKey)); + + if (count($aListData) > 0) { + $oFieldsetForList->AddSubBlock( + DataTableUIBlockFactory::MakeForForm(uniqid('form_', true), $aListConfig, array_reverse($aListData)) + ); + } else { + $oFieldsetForList->AddSubBlock( + AlertUIBlockFactory::MakeNeutral('', Dict::S($sNoRecordDictKey)) + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + } + + return $oFieldsetForList; +} + + ///////////////////////////////////////////////////////////////////// // Main program // LoginWebPage::DoLogin(); // Check user rights and prompt if needed ApplicationMenu::CheckMenuIdEnabled('BackupStatus'); -try -{ +try { $sTransactionId = utils::GetNewTransactionId(); $oP = new iTopWebPage(Dict::S('bkp-status-title')); $oP->set_base(utils::GetAbsoluteUrlAppRoot().'pages/'); - $oP->add("

".Dict::S('bkp-status-title')."

"); + $oBackupTitle = TitleUIBlockFactory::MakeForPage(Dict::S('bkp-status-title'), 1); + $oP->AddUiBlock($oBackupTitle); - if (MetaModel::GetConfig()->Get('demo_mode')) - { - $oP->add("
iTop is in demonstration mode: the feature is disabled.
"); + if (MetaModel::GetConfig()->Get('demo_mode')) { + $oBackupDisabledCauseDemoMode = AlertUIBlockFactory::MakeForFailure( + 'The feature is disabled.', + 'iTop is in demonstration mode' + ); + $oBackupDisabledCauseDemoMode + ->SetIsCollapsible(false) + ->SetIsClosable(false); + $oP->AddUiBlock($oBackupDisabledCauseDemoMode); } - $sImgOk = ' '; - $sImgError = ' '; - - $oP->add("
"); - $oP->add("".Dict::S('bkp-status-checks').""); + //--- Settings and checks + $oFieldsetChecks = new FieldSet(Dict::S('bkp-status-checks')); + $oP->AddUiBlock($oFieldsetChecks); // Availability of mysqldump // $sMySQLBinDir = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'mysql_bindir', ''); $sMySQLBinDir = utils::ReadParam('mysql_bindir', $sMySQLBinDir, true); - if (empty($sMySQLBinDir)) - { + if (empty($sMySQLBinDir)) { $sMySQLDump = 'mysqldump'; - } - else - { + } else { //echo 'Info - Found mysql_bindir: '.$sMySQLBinDir; $sMySQLDump = '"'.$sMySQLBinDir.'/mysqldump"'; } @@ -70,44 +102,57 @@ try $aOutput = array(); $iRetCode = 0; exec($sCommand, $aOutput, $iRetCode); - if ($iRetCode == 0) - { - $sMySqlDump = $sImgOk.Dict::Format("bkp-mysqldump-ok", $aOutput[0]); + if ($iRetCode == 0) { + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForSuccess('', Dict::Format("bkp-mysqldump-ok", $aOutput[0])) + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + } else { + if ($iRetCode == 1) { + $sMySqlDump = Dict::Format("bkp-mysqldump-notfound", implode(' ', $aOutput)); + } else { + $sMySqlDump = Dict::Format("bkp-mysqldump-issue", $iRetCode); + } + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForWarning($sMySqlDump, '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); } - elseif ($iRetCode == 1) - { - $sMySqlDump = $sImgError.Dict::Format("bkp-mysqldump-notfound", implode(' ', $aOutput)); - } - else - { - $sMySqlDump = $sImgError.Dict::Format("bkp-mysqldump-issue", $iRetCode); - } - foreach($aOutput as $sLine) - { + foreach ($aOutput as $sLine) { IssueLog::Info("$sCommand said: $sLine"); } - $oP->p($sMySqlDump); // Destination directory // // Make sure the target directory exists and is writeable - $sBackupDir = APPROOT.'data/backups/'; + $sBackupDir = realpath(APPROOT.'data/backups/'); SetupUtils::builddir($sBackupDir); - if (!is_dir($sBackupDir)) - { - $oP->p($sImgError.Dict::Format('bkp-missing-dir', $sBackupDir)); - } - else - { - $oP->p(Dict::Format('bkp-free-disk-space', SetupUtils::HumanReadableSize(SetupUtils::CheckDiskSpace($sBackupDir)), $sBackupDir)); - if (!is_writable($sBackupDir)) - { - $oP->p($sImgError.Dict::Format('bkp-dir-not-writeable', $sBackupDir)); + if (!is_dir($sBackupDir)) { + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForWarning(Dict::Format('bkp-missing-dir', $sBackupDir), '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + } else { + $sDiskSpaceReadable = SetupUtils::HumanReadableSize(SetupUtils::CheckDiskSpace($sBackupDir)); + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForInformation('', Dict::Format('bkp-free-disk-space', $sDiskSpaceReadable, $sBackupDir)) + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + if (!is_writable($sBackupDir)) { + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForWarning(Dict::Format('bkp-dir-not-writeable', $sBackupDir), '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); } } - $sBackupDirAuto = $sBackupDir.'auto/'; + $sBackupDirAuto = $sBackupDir.'/auto/'; SetupUtils::builddir($sBackupDirAuto); - $sBackupDirManual = $sBackupDir.'manual/'; + $sBackupDirManual = $sBackupDir.'/manual/'; SetupUtils::builddir($sBackupDirManual); // Wrong format @@ -115,17 +160,20 @@ try $sBackupFile = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'file_name_format', BACKUP_DEFAULT_FORMAT); $oBackup = new DBBackupScheduled(); $sZipName = $oBackup->MakeName($sBackupFile); - if ($sZipName == '') - { - $oP->p($sImgError.Dict::Format('bkp-wrong-format-spec', $sBackupFile, BACKUP_DEFAULT_FORMAT)); - } - else - { - $oP->p(Dict::Format('bkp-name-sample', $sZipName)); + $sZipNameInfo = ''; + if ($sZipName == '') { + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForWarning(Dict::Format('bkp-wrong-format-spec', $sBackupFile, BACKUP_DEFAULT_FORMAT), '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + } else { + $sZipNameInfo = Dict::Format('bkp-name-sample', $sZipName); } // Week Days // + $sScheduleInfo = empty($sZipNameInfo) ? '' : $sZipNameInfo.'
'; $aWeekDayToString = array( 1 => Dict::S('DayOfWeek-Monday'), 2 => Dict::S('DayOfWeek-Tuesday'), @@ -133,55 +181,51 @@ try 4 => Dict::S('DayOfWeek-Thursday'), 5 => Dict::S('DayOfWeek-Friday'), 6 => Dict::S('DayOfWeek-Saturday'), - 7 => Dict::S('DayOfWeek-Sunday') + 7 => Dict::S('DayOfWeek-Sunday'), ); $aDayLabels = array(); $oBackupExec = new BackupExec(); - foreach ($oBackupExec->InterpretWeekDays() as $iDay) - { + foreach ($oBackupExec->InterpretWeekDays() as $iDay) { $aDayLabels[] = $aWeekDayToString[$iDay]; } $sDays = implode(', ', $aDayLabels); $sBackupTime = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'time', '23:30'); - $oP->p(Dict::Format('bkp-week-days', $sDays, $sBackupTime)); + $sScheduleInfo .= Dict::Format('bkp-week-days', $sDays, $sBackupTime); $iRetention = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'retention_count', 5); - $oP->p(Dict::Format('bkp-retention', $iRetention)); + $sScheduleInfo .= '
'.Dict::Format('bkp-retention', $iRetention); - $oP->add("
"); + $oFieldsetChecks->AddSubBlock( + AlertUIBlockFactory::MakeForInformation('', $sScheduleInfo) + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); - // List of backups + + //--- List of backups // $aFiles = $oBackup->ListFiles($sBackupDirAuto); $aFilesToDelete = array(); - while (count($aFiles) > $iRetention - 1) - { + while (count($aFiles) > $iRetention - 1) { $aFilesToDelete[] = array_shift($aFiles); } $oRestoreMutex = new iTopMutex('restore.'.utils::GetCurrentEnvironment()); - if ($oRestoreMutex->IsLocked()) - { + if ($oRestoreMutex->IsLocked()) { $sDisableRestore = 'disabled="disabled"'; - } - else - { + } else { $sDisableRestore = ''; } - - // 1st table: list the backups made in the background + + //--- 1st table: list the backups made in the background // $aDetails = array(); - foreach ($oBackup->ListFiles($sBackupDirAuto) as $sBackupFile) - { + foreach ($oBackup->ListFiles($sBackupDirAuto) as $sBackupFile) { $sFileName = basename($sBackupFile); $sFilePath = 'auto/'.$sFileName; - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { $sName = $sFileName; - } - else - { + } else { $sAjax = utils::GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php', array( 'operation' => 'download', @@ -195,12 +239,13 @@ try $sConfirmRestore = addslashes(Dict::Format('bkp-confirm-restore', $sFileName)); $sFileEscaped = addslashes($sFilePath); $sRestoreBtn = ''; - if (in_array($sBackupFile, $aFilesToDelete)) - { - $aDetails[] = array('file' => $sName.' *', 'size' => $sSize, 'actions' => $sRestoreBtn); - } - else - { + if (in_array($sBackupFile, $aFilesToDelete)) { + $aDetails[] = array( + 'file' => $sName.' *', + 'size' => $sSize, + 'actions' => $sRestoreBtn, + ); + } else { $aDetails[] = array('file' => $sName, 'size' => $sSize, 'actions' => $sRestoreBtn); } } @@ -209,33 +254,26 @@ try 'size' => array('label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')), 'actions' => array('label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')), ); - $oP->add("
"); - $oP->add("".Dict::S('bkp-status-backups-auto').""); - if (count($aDetails) > 0) - { - $oP->add('
'); - $oP->table($aConfig, array_reverse($aDetails)); - $oP->add('
'); - } - else - { - $oP->p(Dict::S('bkp-status-backups-none')); - } - $oP->add("
"); - // 2nd table: list the backups made manually + $oP->AddUiBlock( + GenerateBackupsList( + 'bkp-status-backups-auto', + 'bkp-status-backups-none', + $aConfig, + $aDetails + ) + ); + + + //--- 2nd table: list the backups made manually // $aDetails = array(); - foreach ($oBackup->ListFiles($sBackupDirManual) as $sBackupFile) - { + foreach ($oBackup->ListFiles($sBackupDirManual) as $sBackupFile) { $sFileName = basename($sBackupFile); $sFilePath = 'manual/'.$sFileName; - if (MetaModel::GetConfig()->Get('demo_mode')) - { + if (MetaModel::GetConfig()->Get('demo_mode')) { $sName = $sFileName; - } - else - { + } else { $sAjax = utils::GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php', array( 'operation' => 'download', @@ -256,43 +294,69 @@ try 'size' => array('label' => Dict::S('bkp-table-size'), 'description' => Dict::S('bkp-table-size+')), 'actions' => array('label' => Dict::S('bkp-table-actions'), 'description' => Dict::S('bkp-table-actions+')), ); - $oP->add("
"); - $oP->add("".Dict::S('bkp-status-backups-manual').""); - if (count($aDetails) > 0) - { - $oP->add('
'); - $oP->table($aConfig, array_reverse($aDetails)); - $oP->add('
'); - } - else - { - $oP->p(Dict::S('bkp-status-backups-none')); - } - $oP->add("
"); + + $oP->AddUiBlock( + GenerateBackupsList( + 'bkp-status-backups-manual', + 'bkp-status-backups-none', + $aConfig, + $aDetails + ) + ); + + + //--- Backup now + $oFieldsetBackupNow = new FieldSet(Dict::S('bkp-button-backup-now')); + $oP->AddSubBlock($oFieldsetBackupNow); // Ongoing operation ? // $oBackupMutex = new iTopMutex('backup.'.utils::GetCurrentEnvironment()); - if ($oBackupMutex->IsLocked()) - { - $oP->p(Dict::S('bkp-backup-running')); + if ($oBackupMutex->IsLocked()) { + $oFieldsetBackupNow->AddSubBlock( + AlertUIBlockFactory::MakeForFailure(Dict::S('bkp-backup-running'), '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); } $oRestoreMutex = new iTopMutex('restore.'.utils::GetCurrentEnvironment()); - if ($oRestoreMutex->IsLocked()) - { - $oP->p(Dict::S('bkp-restore-running')); + if ($oRestoreMutex->IsLocked()) { + $oFieldsetBackupNow->AddSubBlock( + AlertUIBlockFactory::MakeForFailure(Dict::S('bkp-restore-running'), '') + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); } // Do backup now // $oBackupExec = new BackupExec(); $oNext = $oBackupExec->GetNextOccurrence(); - $oP->p(Dict::Format('bkp-next-backup', $aWeekDayToString[$oNext->Format('N')], $oNext->Format('Y-m-d'), $oNext->Format('H:i'))); - $oP->p(''); - $oP->add(''); - $oP->add(''); - $oP->add(''); - + $sNextOccurrence = Dict::Format('bkp-next-backup', $aWeekDayToString[$oNext->Format('N')], $oNext->Format('Y-m-d'), + $oNext->Format('H:i')); + $oFieldsetBackupNow->AddSubBlock( + AlertUIBlockFactory::MakeForInformation('', $sNextOccurrence) + ->SetIsClosable(false) + ->SetIsCollapsible(false) + ); + + $oLaunchBackupButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('bkp-button-backup-now')); + $oLaunchBackupButton->SetOnClickJsCode('LaunchBackupNow();'); + $oFieldsetBackupNow->AddSubBlock($oLaunchBackupButton); + + // restoration panels / hidden info + $oRestoreSuccess = AlertUIBlockFactory::MakeForSuccess('', '', 'backup_success') + ->AddCSSClass('ibo-is-hidden') + ->SetIsCollapsible(false) + ->SetIsClosable(true); + $oFieldsetBackupNow->AddSubBlock($oRestoreSuccess); + $oRestoreFailure = AlertUIBlockFactory::MakeForFailure('', '', 'backup_errors') + ->AddCSSClass('ibo-is-hidden') + ->SetIsCollapsible(false) + ->SetIsClosable(true); + $oFieldsetBackupNow->AddSubBlock($oRestoreFailure); + $oFieldsetBackupNow->AddHtml(''); + $sConfirmBackup = addslashes(Dict::S('bkp-confirm-backup')); $sPleaseWaitBackup = addslashes(Dict::S('bkp-wait-backup')); $sPleaseWaitRestore = addslashes(Dict::S('bkp-wait-restore')); @@ -311,8 +375,8 @@ try << $sPleaseWaitRestore' }); + return; + } - $('#backup_success').hide(); - $('#backup_errors').hide(); + $.blockUI({ message: '

$sPleaseWaitRestore

' }); + + $('#backup_success').addClass('ibo-is-hidden'); + $('#backup_errors').addClass('ibo-is-hidden'); + + var oParams = {}; + oParams.operation = 'restore_get_token'; + oParams.file = sBackupFile; + oParams.transaction_id = "$sTransactionId"; + $.post(GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php'), oParams, function(data){ + + // Get the value of restore_token + $('#backup_errors').append(data); var oParams = {}; - oParams.operation = 'restore_get_token'; - oParams.file = sBackupFile; + oParams.operation = 'restore_exec'; + oParams.token = $("#restore_token").val(); // token to check auth + rights without loading MetaModel + oParams.environment = '$sEnvironment'; // needed to load the config oParams.transaction_id = "$sTransactionId"; - $.post(GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php'), oParams, function(data){ - - // Get the value of restore_token - $('#backup_errors').append(data); - - var oParams = {}; - oParams.operation = 'restore_exec'; - oParams.token = $("#restore_token").val(); // token to check auth + rights without loading MetaModel - oParams.environment = '$sEnvironment'; // needed to load the config - oParams.transaction_id = "$sTransactionId"; - if (oParams.token.length > 0) - { - $.post(GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php'), oParams, function(data){ - if (data.search(/error|exceptio|notice|warning/i) != -1) - { - $('#backup_success').hide(); - $('#backup_errors').html(data); - $('#backup_errors').show(); - } - else - { - $('#backup_errors').hide(); - $('#backup_success').html('$sRestoreDone'); - $('#backup_success').show(); - } - $.unblockUI(); - }); - } - else - { - $('button.restore').prop('disabled', true); + if (oParams.token.length > 0) { + $.post(GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php'), oParams, function(data){ + if (data.search(/error|exceptio|notice|warning/i) != -1) { + $('#backup_success').addClass('ibo-is-hidden'); + $('#backup_errors').html(data); + $('#backup_errors').removeClass('ibo-is-hidden'); + } else { + $('#backup_errors').addClass('ibo-is-hidden'); + $('#backup_success').html('$sRestoreDone'); + $('#backup_success').removeClass('ibo-is-hidden'); + } $.unblockUI(); - } - }); - } + }); + } else { + $('button.restore').prop('disabled', true); + $.unblockUI(); + } + }); } JS ); @@ -399,4 +459,3 @@ catch(Exception $e) } $oP->output(); -?>