console storage - manage storage backend and stored data
Synopsis
bin/console storage [-h|--help|-?] [-v]
+ Show this help
+
bin/console storage list
+ List avaiable 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 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);
* 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']
+ * @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach']
*
* @retur int Number of moved resources
*/
}
if (is_null($tables)) {
- $tables = ['photo'];
+ $tables = ['photo', 'attach'];
}
$moved = 0;
$data = @file_get_contents($src);
- return self::store($data, $uid, $filename, '', null, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
+ return self::store($data, $uid, $filename, '', null, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
}