fix selecting a backup container

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-02-16 15:05:04 +01:00
parent 8a6de8f63c
commit 8f1fcde006
4 changed files with 16 additions and 16 deletions

View file

@ -64,7 +64,7 @@ class ConfigurationManager
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if (count($content) === 0) {
if ($content === '') {
return '';
}
@ -85,23 +85,25 @@ class ConfigurationManager
public function GetBackupTimes() : array {
if (!file_exists(DataConst::GetBackupArchivesList())) {
return $array[] = '';
return [];
}
$content = file_get_contents(DataConst::GetBackupArchivesList());
if (count($content) === 0) {
return $array[] = '';
if ($content === '') {
return [];
}
$backupLines = explode('\n', $content);
$backupLines = explode("\n", $content);
$backupTimes = [];
foreach($backupLines as $lines) {
$backupTimesTemp = explode(',', $lines);
$backupTimes[] = $backupTimesTemp[1];
if ($lines !== "") {
$backupTimesTemp = explode(',', $lines);
$backupTimes[] = $backupTimesTemp[1];
}
}
if (!is_array($backupTimes)) {
return $array[] = '';
return [];
}
return $backupTimes;

View file

@ -212,7 +212,7 @@
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
<select id="selected_restore_time" name="selected_restore_time" form="restore_selection">
{% for restore_time in backup_times %}
<option value="{{ restore_time }}">{{ restore_time }}"</option>
<option value="{{ restore_time }}">{{ restore_time }}</option>
{% endfor %}
</select>
<input class="button" type="submit" value="Restore selected backup" onclick="return confirm('Restore the selected backup? Are you sure that you want to restore the selected backup? This will stop all running containers and restore the selected backup. It is recommended to create a backup first. You might also want to check the backup integrity.')" />