mirror of
https://github.com/openvk/openvk
synced 2024-12-22 08:31:18 +03:00
Also report errors in build-images
This commit is contained in:
parent
6c0d543d26
commit
24f0f3a3f4
1 changed files with 11 additions and 4 deletions
|
@ -6,6 +6,7 @@ use Symfony\Component\Console\Command\Command;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Nette\Utils\ImageException;
|
||||
|
||||
class RebuildImagesCommand extends Command
|
||||
{
|
||||
|
@ -49,14 +50,20 @@ class RebuildImagesCommand extends Command
|
|||
"",
|
||||
]);
|
||||
|
||||
$errors = 0;
|
||||
$count = 0;
|
||||
$avgTime = NULL;
|
||||
$begin = new \DateTimeImmutable("now");
|
||||
foreach($selection as $idHolder) {
|
||||
$start = microtime(true);
|
||||
$photo = (new Photos)->get($idHolder->id);
|
||||
$photo->getSizes(true, true);
|
||||
$photo->getDimensions();
|
||||
|
||||
try {
|
||||
$photo = (new Photos)->get($idHolder->id);
|
||||
$photo->getSizes(true, true);
|
||||
$photo->getDimensions();
|
||||
} catch(ImageException $ex) {
|
||||
$errors++;
|
||||
}
|
||||
|
||||
$timeConsumed = microtime(true) - $start;
|
||||
if(!$avgTime)
|
||||
|
@ -69,7 +76,7 @@ class RebuildImagesCommand extends Command
|
|||
$int = $int->d . "d" . $int->h . "h" . $int->i . "m" . $int->s . "s";
|
||||
$pct = floor(100 * ($count / $totalPics));
|
||||
|
||||
$counter->overwrite("Processed " . ++$count . " images... ($pct% $int left)");
|
||||
$counter->overwrite("Processed " . ++$count . " images... ($pct% $int left $errors/$count fail)");
|
||||
}
|
||||
|
||||
$counter->overwrite("Processing finished :3");
|
||||
|
|
Loading…
Reference in a new issue