81 lines
2.6 KiB
PHP
Executable File
81 lines
2.6 KiB
PHP
Executable File
<?php
|
||
// -----------------------------------------------------
|
||
// SAVE
|
||
// -----------------------------------------------------
|
||
echo '<div class="encadre">';
|
||
echo '<span class="actionMessages" >';
|
||
echo '<b><u>Sauvegarder la base de données vers un fichier</u></b>';
|
||
echo '</span>';
|
||
|
||
echo '<br>';
|
||
echo '<span class="informationsTechLib">La base de données complète va être exportée dans un fichier de sauvegarde.<span>';
|
||
|
||
echo '  ';
|
||
echo '<span class="boutonsWebmaster" style="color:green;" onclick="saveDB();" >';
|
||
echo ' <i class="fad fa-save" ></i> ';
|
||
echo 'Sauvegarder';
|
||
echo '</span>';
|
||
echo '<br>';
|
||
echo '</div> ';
|
||
|
||
// -----------------------------------------------------
|
||
// RESTORE
|
||
// -----------------------------------------------------
|
||
echo '<div class="encadre">';
|
||
echo '<span class="actionMessages" >';
|
||
echo '<b><u>Restaurer une base de données antérieure depuis un fichier de sauvegarde</u></b>';
|
||
echo '</span>';
|
||
|
||
echo '<br><br>';
|
||
echo '<span class="informationsTechLib">La base de données va être restaurée depuis un fichier de sauvegarde.</span>';
|
||
|
||
echo '<br><br>';
|
||
echo '<span class="informationsTechLib">Choisir une sauvegarde </span> ';
|
||
|
||
echo '<span>';
|
||
$repSav = $includePathVar . '/sauvegardes';
|
||
$dumpFile = []; // pour éviter un "undefined variable"
|
||
|
||
if (is_dir($repSav) && is_readable($repSav)) {
|
||
$listSav = opendir($repSav);
|
||
if ($listSav) {
|
||
$a = 0;
|
||
while (($fichier = readdir($listSav)) !== false) {
|
||
$pos = strpos($fichier, 'complet');
|
||
if ($fichier != "" && $fichier != "." && $fichier != ".." && $pos === false) {
|
||
$dumpFile[$a] = $fichier;
|
||
$a++;
|
||
}
|
||
}
|
||
closedir($listSav);
|
||
} else {
|
||
$admMsg .= "Impossible d’ouvrir le dossier : $repSav";
|
||
}
|
||
} else {
|
||
$admMsg .= "Dossier inexistant ou illisible : $repSav";
|
||
}
|
||
|
||
echo '<select onChange="" name="restorFile" id="restorFile" >';
|
||
echo '<option>Liste des sauvegardes</option>';
|
||
if (count($dumpFile) > 0) {
|
||
for($fi=0; $fi<count($dumpFile); $fi++) {
|
||
|
||
if ($fi==$dumpFile[$fi]) {
|
||
echo '<option value="' .$dumpFile[$fi]. '" selected>' .$dumpFile[$fi]. '</option>';
|
||
}
|
||
else {
|
||
echo '<option value="' .$dumpFile[$fi]. '">' .$dumpFile[$fi]. '</option>';
|
||
}
|
||
}
|
||
}
|
||
echo '</select>';
|
||
echo '</span>';
|
||
|
||
echo ' <span class="boutonsWebmaster" onClick="restore();" >';
|
||
echo ' <i class="fad fa-database" style="color:blue;"></i> ';
|
||
echo 'Restaurer';
|
||
echo '</span>';
|
||
echo '<br>';
|
||
echo '</div> ';
|
||
?>
|