]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Console/Storage.php
Merge pull request #6746 from nupplaphil/issue/6338-notices
[friendica.git] / src / Core / Console / Storage.php
index 9334824e355c5e7aa13836bc785c270345fa8cf8..e0083598c319ec07b93b7c64f7bd533fff945e44 100644 (file)
@@ -19,17 +19,24 @@ class Storage extends \Asika\SimpleConsole\Console
 console storage - manage storage backend and stored data
 Synopsis
     bin/console storage [-h|--help|-?] [-v]
+        Show this help
+    
     bin/console storage list
+        List available storage backends
+    
     bin/console storage set <name>
-    bin/console storage move
+        Set current storage backend
+            name        storage backend to use. see "list".
+    
+    bin/console storage move [table]
+        Move stored data to current storage backend.
+            table       one of "photo" or "attach". default to both
 HELP;
                return $help;
        }
 
        protected function doExecute()
        {
-               $a = \Friendica\BaseObject::getApp();
-
                if ($this->getOption('v')) {
                        $this->out('Executable: ' . $this->executable);
                        $this->out('Class: ' . __CLASS__);
@@ -105,9 +112,16 @@ HELP;
 
        protected function do_move()
        {
-               if (count($this->args) !== 1) {
+               $table = 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');
+                       }
+               }
 
                $current = StorageManager::getBackend();
                $r = StorageManager::move($current);