From a861eb65afa999a0be7e001b0d5b239623b569a6 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Fri, 12 Mar 2021 18:24:45 +0100 Subject: [PATCH] Storage: small fixes to 'storage move' - stop command if current storage backend is still "legacy" - write destination backend name in log --- src/Console/Storage.php | 5 +++++ src/Core/StorageManager.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Console/Storage.php b/src/Console/Storage.php index d0a2a6663..a048d74ff 100644 --- a/src/Console/Storage.php +++ b/src/Console/Storage.php @@ -23,6 +23,7 @@ namespace Friendica\Console; use Asika\SimpleConsole\CommandArgsException; use Friendica\Core\StorageManager; +use Friendica\Model\Storage\StorageException; /** * tool to manage storage backend and stored data from CLI @@ -165,6 +166,10 @@ HELP; $current = $this->storageManager->getBackend(); $total = 0; + if (is_null($current)) { + throw new StorageException(sprintf("Cannot move to legacy storage. Please select a storage backend.")); + } + do { $moved = $this->storageManager->move($current, $tables, $this->getOption('n', 5000)); if ($moved) { diff --git a/src/Core/StorageManager.php b/src/Core/StorageManager.php index b832b20fa..6fadcb52b 100644 --- a/src/Core/StorageManager.php +++ b/src/Core/StorageManager.php @@ -305,7 +305,7 @@ class StorageManager $data = $source->get($sourceRef); } - $this->logger->info('Save data to new backend.', ['newBackend' => $destination]); + $this->logger->info('Save data to new backend.', ['newBackend' => $destination::getName()]); $destinationRef = $destination->put($data); $this->logger->info('Saved data.', ['newReference' => $destinationRef]);