]> git.mxchange.org Git - friendica.git/commitdiff
Fix handling table name during storage move
authorPhilipp Holzer <admin@philipp.info>
Fri, 1 Mar 2019 17:07:08 +0000 (18:07 +0100)
committerPhilipp Holzer <admin@philipp.info>
Fri, 1 Mar 2019 17:07:08 +0000 (18:07 +0100)
src/Core/Console/Storage.php
src/Core/StorageManager.php

index e0083598c319ec07b93b7c64f7bd533fff945e44..52f453471eed4bc501da51bcd5d351df5e84e33e 100644 (file)
@@ -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));
        }
 }
index cfefa5f35a7dcc91738a2d63d9bc500221d6aa4b..ef6cef480a355c28f2f3dace16914a163ec18c45 100644 (file)
@@ -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