From cd0622cd5588e2d80457498797fd3b52e775cc1c Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Fri, 13 Sep 2024 13:06:31 +0200 Subject: [PATCH] Check on empty/null filePath image --- src/Command/ImageCacheCommand.php | 42 ++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/Command/ImageCacheCommand.php b/src/Command/ImageCacheCommand.php index 431af96c6..dda21ecaa 100644 --- a/src/Command/ImageCacheCommand.php +++ b/src/Command/ImageCacheCommand.php @@ -50,6 +50,9 @@ private function buildUsersCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -57,8 +60,8 @@ private function buildUsersCache(): void '--filter' => ['avatar_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } @@ -71,6 +74,9 @@ private function buildEntriesCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -78,8 +84,8 @@ private function buildEntriesCache(): void '--filter' => ['entry_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } @@ -92,6 +98,9 @@ private function buildEntryCommentsCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -99,8 +108,8 @@ private function buildEntryCommentsCache(): void '--filter' => ['post_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } @@ -113,6 +122,9 @@ private function buildPostsCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -120,8 +132,8 @@ private function buildPostsCache(): void '--filter' => ['post_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } @@ -134,6 +146,9 @@ private function buildPostCommentsCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -141,8 +156,8 @@ private function buildPostCommentsCache(): void '--filter' => ['post_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } @@ -155,6 +170,9 @@ private function buildMagazinesCache(): void ->getArrayResult(); foreach ($res as $image) { + if (!$image['filePath']) { + continue; + } $command = $this->getApplication()->find('liip:imagine:cache:resolve'); $arguments = [ @@ -162,8 +180,8 @@ private function buildMagazinesCache(): void '--filter' => ['post_thumb'], ]; - $greetInput = new ArrayInput($arguments); - $returnCode = $command->run($greetInput, new NullOutput()); + $input = new ArrayInput($arguments); + $returnCode = $command->run($input, new NullOutput()); } } }