X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConsole%2FStorage.php;h=e0083598c319ec07b93b7c64f7bd533fff945e44;hb=efe358c617d18740b63cd0dcb1ee23591fcb0e2d;hp=a03743f253da1d4efde29adf30319f482ae7c498;hpb=4d9d62bcdbcbccb72562f58332f230df70ead796;p=friendica.git diff --git a/src/Core/Console/Storage.php b/src/Core/Console/Storage.php index a03743f253..e0083598c3 100644 --- a/src/Core/Console/Storage.php +++ b/src/Core/Console/Storage.php @@ -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 - 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__); @@ -94,7 +101,7 @@ HELP; $name = $this->args[1]; $class = StorageManager::getByName($name); - if ($class === "") { + if ($class === '') { $this->out($name . ' is not a registered backend.'); return -1; } @@ -105,6 +112,19 @@ HELP; protected function do_move() { + $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); + $this->out(sprintf('Moved %d files', $r)); } }