Merge pull request #6786 from nupplaphil/issue/6758-console_storage

Fix handling table name during storage move
2022.09-rc
Hypolite Petovan 2019-03-01 16:53:55 -05:00 zatwierdzone przez GitHub
commit 50a6058f66
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -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));
}
}

Wyświetl plik

@ -111,7 +111,7 @@ class StorageManager
* 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 array|null $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach']
*
* @throws \Exception
* @return int Number of moved resources