Merge pull request #14752 from MrPetovan/bug/fatal-errors

Add expected final return in Console\Storage->doMove
This commit is contained in:
Tobias Diekershoff 2025-01-29 22:57:51 +01:00 committed by GitHub
commit db93456027
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,17 +42,17 @@ console storage - manage storage backend and stored data
Synopsis Synopsis
bin/console storage [-h|--help|-?] [-v] bin/console storage [-h|--help|-?] [-v]
Show this help Show this help
bin/console storage list bin/console storage list
List available storage backends List available storage backends
bin/console storage clear bin/console storage clear
Remove the contact avatar cache data Remove the contact avatar cache data
bin/console storage set <name> bin/console storage set <name>
Set current storage backend Set current storage backend
name storage backend to use. see "list". name storage backend to use. see "list".
bin/console storage move [table] [-n 5000] bin/console storage move [table] [-n 5000]
Move stored data to current storage backend. Move stored data to current storage backend.
table one of "photo" or "attach". default to both table one of "photo" or "attach". default to both
@ -96,7 +96,7 @@ HELP;
protected function doList() protected function doList()
{ {
$rowfmt = ' %-3s | %-20s'; $rowfmt = ' %-3s | %-20s';
$current = $this->storageManager->getBackend(); $current = $this->storageManager->getBackend();
$this->out(sprintf($rowfmt, 'Sel', 'Name')); $this->out(sprintf($rowfmt, 'Sel', 'Name'));
$this->out('-----------------------'); $this->out('-----------------------');
@ -104,7 +104,7 @@ HELP;
foreach ($this->storageManager->listBackends() as $name) { foreach ($this->storageManager->listBackends() as $name) {
$issel = ' '; $issel = ' ';
if ($current && $current::getName() == $name) { if ($current && $current::getName() == $name) {
$issel = '*'; $issel = '*';
$isregisterd = true; $isregisterd = true;
}; };
$this->out(sprintf($rowfmt, $issel, $name)); $this->out(sprintf($rowfmt, $issel, $name));
@ -176,7 +176,7 @@ HELP;
} }
$current = $this->storageManager->getBackend(); $current = $this->storageManager->getBackend();
$total = 0; $total = 0;
if (is_null($current)) { if (is_null($current)) {
throw new StorageException(sprintf("Cannot move to legacy storage. Please select a storage backend.")); throw new StorageException(sprintf("Cannot move to legacy storage. Please select a storage backend."));
@ -192,5 +192,7 @@ HELP;
} while ($moved); } while ($moved);
$this->out(sprintf(date('[Y-m-d H:i:s] ') . 'Moved %d files total', $total)); $this->out(sprintf(date('[Y-m-d H:i:s] ') . 'Moved %d files total', $total));
return 0;
} }
} }