Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backup-module/backup_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function backup_controller()
// This module is only to be ran by the admin user
if (!$session['write'] && !$session['admin']) {
$route->format = "html";
return "<br><div class='alert alert-error'><b>Error:</b> backup module requires admin access</div>";
return "<br><div class='alert alert-error'><b>".tr("Error:")."</b> ".tr("backup module requires admin access")."</div>";
}
if (file_exists("$linked_modules_dir/backup/config.cfg")) {
$ini_string = file_get_contents("$linked_modules_dir/backup/config.cfg");
Expand All @@ -33,7 +33,7 @@ function backup_controller()

$parsed_ini = parse_ini_string(implode("\n",$ini_string_lines), true);
} else {
return "<br><div class='alert alert-error'><b>Error:</b> missing backup config.cfg</div>";
return "<br><div class='alert alert-error'><b>".tr("Error:")."</b> ".tr("missing backup config.cfg")."</div>";
}

$export_flag = "/tmp/emoncms-flag-export";
Expand Down Expand Up @@ -113,7 +113,7 @@ function backup_controller()
// Allow certain file formats
if($imageFileType != "gz")
{
$result="Sorry, only .tar.gz files are allowed.";
$result = tr("Sorry, only .tar.gz files are allowed.");
$uploadOk = 0;
}

Expand All @@ -122,13 +122,13 @@ function backup_controller()
$redis->rpush("service-runner","$import_script $import_flag>$import_logfile");
header('Location: '.$path.'backup#import-archive');
} else {
return "<br><div class='alert alert-error'><b>Error:</b> Import archive not selected</div>";
return "<br><div class='alert alert-error'><b>".tr("Error:")."</b> ".tr("Import archive not selected")."</div>";
}
}

if ($route->action == "usbimport") {
$route->format = "text";
$result = "Starting USB import";
$result = tr("Starting USB import");
$redis->rpush("service-runner","$usb_import_script $usb_import_flag>$usb_import_logfile");
}

Expand Down
83 changes: 47 additions & 36 deletions backup-module/backup_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,70 +18,78 @@


<ul class="nav nav-tabs mb-0 mt-3" id="backup-tabs">
<li class="active"><a href="#view-import-usb">Import USB</a></li>
<li><a href="#view-import-archive">Import Archive</a></li>
<li><a href="#view-export">Export</a></li>
<li class="active"><a href="#view-import-usb"><?php echo tr("Import USB"); ?></a></li>
<li><a href="#view-import-archive"><?php echo tr("Import Archive"); ?></a></li>
<li><a href="#view-export"><?php echo tr("Export Archive"); ?></a></li>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="view-import-usb">
<h3>Import from USB drive</h3>
<p>Import emoncms account data from old emonSD card mounted as a USB drive.</p>
<p>Place your old emonPi or emonBase SD card in a USB SD card reader and plug into one of the raspberry pi USB ports.<br>This importer will then find and import all emoncms account data without the need to export and import an archive.</p>
<span style="color:red;font-weight:bold;">CAUTION ALL EMONCMS ACCOUNT DATA WILL BE OVERWRITTEN BY THE IMPORTED DATA</span><br><br>
<p><i>Note: Before import update to latest version of Emoncms & emonHub.</i></p>
<button id="usb-import" class="btn btn-danger"><?php echo _('Import from USB drive'); ?></button>
<h3><?php echo tr("Import from USB drive"); ?></h3>
<p><?php echo tr("Import emoncms account data from old emonSD card mounted as a USB drive."); ?></p>
<p><?php echo tr("Place your old emonPi or emonBase SD card in a USB SD card reader and plug into one of the raspberry pi USB ports.<br>This importer will then find and import all emoncms account data without the need to export and import an archive."); ?></p>
<span style="color:red;font-weight:bold;">
<?php echo tr("CAUTION ALL EMONCMS ACCOUNT DATA WILL BE OVERWRITTEN BY THE IMPORTED DATA"); ?>
</span><br><br>
<p><i><?php echo tr("Note: Before import update to latest version of Emoncms & EmonHub."); ?></i></p>
<button id="usb-import" class="btn btn-danger"><?php echo tr('Import from USB drive'); ?></button>
<br><br>
<pre id="usb-import-log-bound" class="log"><div id="usb-import-log"></div></pre>
<br>
<p><i>Refresh page if log window does not update.</i></p>
<p><i>After import is complete logout then login using the new imported account login details.</i></p>
<p><i><?php echo tr("Refresh page if log window does not update."); ?></i></p>
<p><i><?php echo tr("After import is complete logout then login using the new imported account login details."); ?></i></p>
</div>
<div class="tab-pane" id="view-import-archive">
<h3>Import from Archive</h3>
<p>Import an emoncms backup archive.</p>
<span style="color:red;font-weight:bold;">CAUTION ALL EMONCMS ACCOUNT DATA WILL BE OVERWRITTEN BY THE IMPORTED DATA</span><br><br>
<p><i>Note: Before import update to latest version of Emoncms & emonHub.</i></p>
<h3><?php echo tr("Import from Archive"); ?></h3>
<p><?php echo tr("Import an emoncms backup archive."); ?></p>
<span style="color:red;font-weight:bold;">
<?php echo tr("CAUTION ALL EMONCMS ACCOUNT DATA WILL BE OVERWRITTEN BY THE IMPORTED DATA"); ?>
</span><br><br>
<p><i><?php echo tr("Note: Before import update to latest version of Emoncms & EmonHub."); ?></i></p>
<form action="<?php echo $path; ?>backup/upload" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file"><br><br>
<input class="btn btn-danger" type="submit" name="submit" value="Import Backup">
<input class="btn btn-danger" type="submit" name="submit" value="<?php echo tr("Import Backup"); ?>">
</form>
<br><br>
<p><i>Note: If browser upload fails for large backup files <a href="http://github.com/emoncms/backup">follow manual import instructions.</a></i></p>
<p><i>
<?php echo tr("Note: If browser upload fails for large backup files"); ?>
<a href="http://github.com/emoncms/backup"><?php echo tr("follow manual import instructions."); ?></a>
</i></p>
<pre id="import-log-bound" class="log"><div id="import-log"></div></pre>
<br>
<p><i>Refresh page if log window does not update.</i></p>
<p><i>After import is complete logout then login using the new imported account login details.</i></p>
<p><i><?php echo tr("Refresh page if log window does not update."); ?></i></p>
<p><i><?php echo tr("After import is complete logout then login using the new imported account login details."); ?></i></p>
</div>
<div class="tab-pane" id="view-export">
<h3>Export</h3>
<p>Export a compressed archive containing:</p>
<h3><?php echo tr("Export"); ?></h3>
<p><?php echo tr("Export a compressed archive containing:"); ?></p>
<ul>
<li>Emoncms MYSQL database</li>
<li>PHPFina data files</li>
<li>PHPTimeSeries data files</li>
<li>EmonHub Config</li>
<li><?php echo tr("Emoncms MYSQL database"); ?></li>
<li><?php echo tr("PHPFina data files"); ?></li>
<li><?php echo tr("PHPTimeSeries data files"); ?></li>
<li><?php echo tr("EmonHub Config"); ?></li>
</ul>
<p>These files contain all Emoncms data including:</p>
<p><?php echo tr("These files contain all Emoncms data including:"); ?></p>
<ul>
<li>Input processes</li>
<li>Feed data</li>
<li>Dashboards</li>
<li>EmonHub Config</li>
<li><?php echo tr("Input processes"); ?></li>
<li><?php echo tr("Feed data"); ?></li>
<li><?php echo tr("Dashboards"); ?></li>
<li><?php echo tr("EmonHub Config"); ?></li>
</ul>
<p>The compressed archive can be used to migrate data to another emonPi / emonBase.</p>
<button id="emonpi-backup" class="btn btn-info"><?php echo _('Create backup'); ?></button>
<p><?php echo tr("The compressed archive can be used to migrate data to another emonPi / emonBase."); ?></p>
<button id="emonpi-backup" class="btn btn-info"><?php echo tr('Create backup'); ?></button>
<br><br>
<pre id="export-log-bound" class="log"><div id="export-log"></div></pre>
<?php
$backup_filename="emoncms-backup-".gethostname()."-".date("Y-m-d").".tar.gz";
if (file_exists($parsed_ini['backup_location']."/".$backup_filename) && !file_exists("/tmp/backuplock")) {
echo '<br><br><b>Right Click > Download:</b><br><a href="'.$path.'backup/download">'.$backup_filename.'</a>';
echo '<br><br><b>'.tr("Right Click > Download:");
echo '</b><br><a href="'.$path.'backup/download">'.$backup_filename.'</a>';
}
?>
<br><br>
<p>Once export is complete refresh page to see download link.</p>
<p><i>Note: Export can take a long time; please be patient.</i></p>
<p><?php echo tr("Once export is complete refresh page to see download link."); ?></p>
<p><i><?php echo tr("Note: Export can take a long time; please be patient."); ?></i></p>
</div>
</div>

Expand Down Expand Up @@ -123,7 +131,10 @@ function selectTab(hash) {

<?php
if (empty($servicerunnerproc)) {
echo "<div class='alert alert-error'><b>Warning:</b> service-runner is not running and is required. To install service-runner see <a href='https://github.com/emoncms/emoncms/blob/master/scripts/services/install-service-runner-update.md'>service-runner installation</a></div>";
echo "<div class='alert alert-error'><b>".tr("Warning:");
echo "</b> ".tr("service-runner is not running and is required. To install service-runner see");
echo " <a href='https://github.com/emoncms/emoncms/blob/master/scripts/services/install-service-runner-update.md'>";
echo tr("service-runner installation")."</a></div>";
}
?>

Expand Down
42 changes: 41 additions & 1 deletion backup-module/locale/fr_FR.json
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
{}
{
"Import from USB drive": "Importer depuis un périphérique USB",
"Import USB": "Import USB",
"Import Archive": "Import archive existante",
"Export Archive": "Export vers une archive",
"Export": "Exporter",
"Import emoncms account data from old emonSD card mounted as a USB drive.": "Importer les données de compte emoncms depuis une ancienne carte emonSD montée comme périphérique USB.",
"Place your old emonPi or emonBase SD card in a USB SD card reader and plug into one of the raspberry pi USB ports.<br>This importer will then find and import all emoncms account data without the need to export and import an archive.": "Placez votre ancienne carte SD emonPi ou emonBase dans un lecteur de carte SD USB et connectez-le à un des ports USB du Raspberry Pi.<br>Ce module trouvera et importera alors toutes les données de compte emoncms sans nécessiter ni export ni import manuel.",
"CAUTION ALL EMONCMS ACCOUNT DATA WILL BE OVERWRITTEN BY THE IMPORTED DATA": "ATTENTION : TOUTES LES DONNÉES DE COMPTE EMONCMS SERONT ÉCRASÉES PAR LES DONNÉES IMPORTÉES",
"Note: Before import update to latest version of Emoncms & EmonHub.": "Remarque : avant tout import, mettez à jour vers la dernière version de Emoncms et EmonHub.",
"Refresh page if log window does not update.": "Actualisez la page si la fenêtre de journal ne se met pas à jour.",
"After import is complete logout then login using the new imported account login details.": "Une fois les données importées, déconnectez-vous puis reconnectez-vous avec les identifiants du compte importé.",
"Import from Archive": "Importer depuis une archive",
"Import an emoncms backup archive.": "Importer une archive de sauvegarde emoncms.",
"Import Backup": "Importer une sauvegarde",
"Note: If browser upload fails for large backup files": "Remarque : si le téléversement échoue en raison de la taille de la sauvegarde",
"follow manual import instructions.": "suivez les instructions pour réaliser une importation manuelle.",
"Export a compressed archive containing:": "Exporter une archive compressée contenant :",
"Emoncms MYSQL database": "Base de données MYSQL",
"PHPFina data files": "Fichiers de données PHPFina",
"PHPTimeSeries data files": "Fichiers de données PHPTimeSeries",
"EmonHub Config": "Configuration EmonHub",
"These files contain all Emoncms data including:": "Ces fichiers contiennent toutes les données Emoncms, y compris :",
"Input processes": "Sources de données et processus de traitement associés",
"Feed data": "Flux de données",
"Dashboards": "Tableaux de bord",
"The compressed archive can be used to migrate data to another emonPi / emonBase.": "Cette archive compressée peut servir pour migrer les données vers un autre emonPi \/ emonBase.",
"Right Click > Download:": "Clic droit > Télécharger :",
"Once export is complete refresh page to see download link.": "Après tout export terminé avec succès, actualisez la page pour voir le lien de téléchargement.",
"Note: Export can take a long time; please be patient.": "Remarque : un export peut prendre du temps, veuillez patienter.",
"Warning:": "Avertissement :",
"service-runner is not running and is required. To install service-runner see": "Le process service-runner est requis. Consulter ",
"service-runner installation": "la procédure pour installer service-runner",
"Error:": "Erreur :",
"backup module requires admin access": "le module de sauvegarde nécessite un accès administrateur",
"missing backup config.cfg": "fichier config.cfg de sauvegarde manquant",
"Sorry, only .tar.gz files are allowed.": "Désolé, seuls les fichiers .tar.gz sont autorisés.",
"Import archive not selected": "Archive à importer non sélectionnée",
"Starting USB import": "importer depuis le port USB",
"Create backup": "Démarrer la sauvegarde"
}