From 16ff5af221d7710a42fd9e02857a456c6bab8003 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Fri, 1 Mar 2019 18:07:08 +0100 Subject: [PATCH] Fix handling table name during storage move --- src/Core/Console/Storage.php | 6 ++++-- src/Core/StorageManager.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Core/Console/Storage.php b/src/Core/Console/Storage.php index e0083598c3..52f453471e 100644 --- a/src/Core/Console/Storage.php +++ b/src/Core/Console/Storage.php @@ -112,19 +112,21 @@ HELP; protected function do_move() { - $table = null; + $tables = null; if (count($this->args) < 1 || count($this->args) > 2) { throw new CommandArgsException('Invalid arguments'); } + if (count($this->args) == 2) { $table = strtolower($this->args[1]); if (!in_array($table, ['photo', 'attach'])) { throw new CommandArgsException('Invalid table'); } + $tables = [$table]; } $current = StorageManager::getBackend(); - $r = StorageManager::move($current); + $r = StorageManager::move($current, $tables); $this->out(sprintf('Moved %d files', $r)); } } diff --git a/src/Core/StorageManager.php b/src/Core/StorageManager.php index cfefa5f35a..ef6cef480a 100644 --- a/src/Core/StorageManager.php +++ b/src/Core/StorageManager.php @@ -110,8 +110,8 @@ class StorageManager * Copy existing data to destination storage and delete from source. * This method cannot move to legacy in-table `data` field. * - * @param string $dest Destination storage class name - * @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach'] + * @param string $dest Destination storage class name + * @param array|null $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach'] * * @throws \Exception * @return int Number of moved resources