mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +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\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Nette\Utils\ImageException;
|
||||||
|
|
||||||
class RebuildImagesCommand extends Command
|
class RebuildImagesCommand extends Command
|
||||||
{
|
{
|
||||||
|
@ -49,14 +50,20 @@ class RebuildImagesCommand extends Command
|
||||||
"",
|
"",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$errors = 0;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$avgTime = NULL;
|
$avgTime = NULL;
|
||||||
$begin = new \DateTimeImmutable("now");
|
$begin = new \DateTimeImmutable("now");
|
||||||
foreach($selection as $idHolder) {
|
foreach($selection as $idHolder) {
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
|
||||||
|
try {
|
||||||
$photo = (new Photos)->get($idHolder->id);
|
$photo = (new Photos)->get($idHolder->id);
|
||||||
$photo->getSizes(true, true);
|
$photo->getSizes(true, true);
|
||||||
$photo->getDimensions();
|
$photo->getDimensions();
|
||||||
|
} catch(ImageException $ex) {
|
||||||
|
$errors++;
|
||||||
|
}
|
||||||
|
|
||||||
$timeConsumed = microtime(true) - $start;
|
$timeConsumed = microtime(true) - $start;
|
||||||
if(!$avgTime)
|
if(!$avgTime)
|
||||||
|
@ -69,7 +76,7 @@ class RebuildImagesCommand extends Command
|
||||||
$int = $int->d . "d" . $int->h . "h" . $int->i . "m" . $int->s . "s";
|
$int = $int->d . "d" . $int->h . "h" . $int->i . "m" . $int->s . "s";
|
||||||
$pct = floor(100 * ($count / $totalPics));
|
$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");
|
$counter->overwrite("Processing finished :3");
|
||||||
|
|
Loading…
Reference in a new issue