Add loop to console storage move

- Add timestamp to output messages
This commit is contained in:
Hypolite Petovan 2019-03-20 00:42:50 -04:00
parent 8ddbeb087f
commit 385e3a09f2
1 changed files with 14 additions and 3 deletions

View File

@ -28,9 +28,10 @@ Synopsis
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] 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
-n limit of processed entry batch size
HELP; HELP;
return $help; return $help;
} }
@ -130,7 +131,17 @@ HELP;
} }
$current = StorageManager::getBackend(); $current = StorageManager::getBackend();
$r = StorageManager::move($current, $tables); $total = 0;
$this->out(sprintf('Moved %d files', $r));
do {
$moved = StorageManager::move($current, $tables, $this->getOption('n', 5000));
if ($moved) {
$this->out(date('[Y-m-d H:i:s] ') . sprintf('Moved %d files', $moved));
}
$total += $moved;
} while ($moved);
$this->out(sprintf(date('[Y-m-d H:i:s] ') . 'Moved %d files total', $total));
} }
} }