Skip to content

Commit

Permalink
fix issue where the old image is still display after it has been chan…
Browse files Browse the repository at this point in the history
…ged in the configuration
  • Loading branch information
Nicolas Barbey committed Jun 10, 2024
1 parent 965549c commit 862cdb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.3</version>
<version>1.1.4</version>
<authors>
<author>
<name>Loïc MO</name>
Expand Down
13 changes: 13 additions & 0 deletions Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use HeaderHighlights\Model\HeaderHighlightsImageQuery;
use Exception;
use Propel\Runtime\Exception\PropelException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -150,5 +151,17 @@ private function headerHighlights(
->setTitle($formData['title' . $id])
->setDescription($formData['catchphrase' . $id])
->save();

$this->emptyImageCache($headerHighlightsImage->getId());
}

private function emptyImageCache($imageId)
{
$cacheDir = THELIA_WEB_DIR."legacy-image-library".DS.'headerHighlights_image_'.$imageId;

$fs = new Filesystem();
if (is_dir($cacheDir)){
$fs->remove($cacheDir);
}
}
}

0 comments on commit 862cdb5

Please sign in to comment.