diff --git a/Containers/borgbackup/backupscript.sh b/Containers/borgbackup/backupscript.sh
index d5fe6e2a..66e505e7 100644
--- a/Containers/borgbackup/backupscript.sh
+++ b/Containers/borgbackup/backupscript.sh
@@ -320,6 +320,13 @@ if [ "$BORG_MODE" = restore ]; then
fi
echo "Restoring '$SELECTED_ARCHIVE'..."
+ # Exclude previews from restore if selected to speed up process
+ ADDITIONAL_RSYNC_EXCLUDES=()
+ if [ -n "$RESTORE_EXCLUDE_PREVIEWS" ]; then
+ ADDITIONAL_RSYNC_EXCLUDES=(--exclude "nextcloud_aio_nextcloud_data/appdata_*/preview/**")
+ echo "Excluding previews from restore"
+ fi
+
# Save Additional Backup dirs
if [ -f "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/additional_backup_directories" ]; then
ADDITIONAL_BACKUP_DIRECTORIES="$(cat /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/additional_backup_directories)"
@@ -365,6 +372,7 @@ if [ "$BORG_MODE" = restore ]; then
--exclude "nextcloud_aio_mastercontainer/data/daily_backup_running" \
--exclude "nextcloud_aio_mastercontainer/data/session_date_file" \
--exclude "nextcloud_aio_mastercontainer/session/**" \
+ "${ADDITIONAL_RSYNC_EXCLUDES[@]}" \
/tmp/borg/nextcloud_aio_volumes/ /nextcloud_aio_volumes/; then
RESTORE_FAILED=1
echo "Something failed while restoring from backup."
@@ -488,6 +496,12 @@ if [ "$BORG_MODE" = restore ]; then
touch "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/fingerprint.update"
chmod 777 "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/fingerprint.update"
+ # Add file to Netcloud container to trigger a preview scan the next time it starts
+ if [ -n "$RESTORE_EXCLUDE_PREVIEWS" ]; then
+ touch "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/trigger-preview.scan"
+ chmod 777 "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data/trigger-preview.scan"
+ fi
+
# Delete redis cache
rm -f "/mnt/redis/dump.rdb"
fi
diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh
index 24bae727..419401cd 100644
--- a/Containers/nextcloud/entrypoint.sh
+++ b/Containers/nextcloud/entrypoint.sh
@@ -495,6 +495,12 @@ if [ -f "$NEXTCLOUD_DATA_DIR/fingerprint.update" ]; then
rm "$NEXTCLOUD_DATA_DIR/fingerprint.update"
fi
+# Perform preview scan if previews were excluded from restore
+if [ -f "$NEXTCLOUD_DATA_DIR/trigger-preview.scan" ]; then
+ php /var/www/html/occ files:scan-app-data preview -vvv
+ rm "$NEXTCLOUD_DATA_DIR/trigger-preview.scan"
+fi
+
# AIO one-click settings start # Do not remove or change this line!
# Apply one-click-instance settings
echo "Applying one-click-instance settings..."
diff --git a/php/containers.json b/php/containers.json
index 60047776..bf5ae3e9 100644
--- a/php/containers.json
+++ b/php/containers.json
@@ -477,6 +477,7 @@
"BORG_PASSWORD=%BORGBACKUP_PASSWORD%",
"BORG_MODE=%BORGBACKUP_MODE%",
"SELECTED_RESTORE_TIME=%SELECTED_RESTORE_TIME%",
+ "RESTORE_EXCLUDE_PREVIEWS=%RESTORE_EXCLUDE_PREVIEWS%",
"BACKUP_RESTORE_PASSWORD=%BACKUP_RESTORE_PASSWORD%",
"ADDITIONAL_DIRECTORIES_BACKUP=%ADDITIONAL_DIRECTORIES_BACKUP%",
"BORGBACKUP_HOST_LOCATION=%BORGBACKUP_HOST_LOCATION%",
diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php
index 840985f8..f040e169 100644
--- a/php/src/Controller/DockerController.php
+++ b/php/src/Controller/DockerController.php
@@ -113,6 +113,11 @@ readonly class DockerController {
$config = $this->configurationManager->GetConfig();
$config['backup-mode'] = 'restore';
$config['selected-restore-time'] = $request->getParsedBody()['selected_restore_time'] ?? '';
+ if (isset($request->getParsedBody()['restore-exclude-previews'])) {
+ $config['restore-exclude-previews'] = 1;
+ } else {
+ $config['restore-exclude-previews'] = '';
+ }
$this->configurationManager->WriteConfig($config);
$id = self::TOP_CONTAINER;
diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php
index 69f59d5c..3c54b1b1 100644
--- a/php/src/Data/ConfigurationManager.php
+++ b/php/src/Data/ConfigurationManager.php
@@ -427,6 +427,15 @@ class ConfigurationManager
return $config['selected-restore-time'];
}
+ public function GetRestoreExcludePreviews() : string {
+ $config = $this->GetConfig();
+ if(!isset($config['restore-exclude-previews'])) {
+ $config['restore-exclude-previews'] = '';
+ }
+
+ return $config['restore-exclude-previews'];
+ }
+
public function GetAIOURL() : string {
$config = $this->GetConfig();
if(!isset($config['AIO_URL'])) {
diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php
index 89385a11..29866965 100644
--- a/php/src/Docker/DockerActionManager.php
+++ b/php/src/Docker/DockerActionManager.php
@@ -273,6 +273,8 @@ readonly class DockerActionManager {
$replacements[1] = $this->configurationManager->GetAIOURL();
} elseif ($out[1] === 'SELECTED_RESTORE_TIME') {
$replacements[1] = $this->configurationManager->GetSelectedRestoreTime();
+ } elseif ($out[1] === 'RESTORE_EXCLUDE_PREVIEWS') {
+ $replacements[1] = $this->configurationManager->GetRestoreExcludePreviews();
} elseif ($out[1] === 'APACHE_PORT') {
$replacements[1] = $this->configurationManager->GetApachePort();
} elseif ($out[1] === 'TALK_PORT') {
diff --git a/php/templates/containers.twig b/php/templates/containers.twig
index 531ea0d7..b2640b40 100644
--- a/php/templates/containers.twig
+++ b/php/templates/containers.twig
@@ -168,7 +168,8 @@
{% for restore_time in backup_times %}
{% endfor %}
-
+
+
{% endif %}