Fixing cached asset path for dev mode #200
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is still not fixed in the latest commit 8ee4e5f although it was close...
The problem is that in dev mode the URL generated by the
router->generate()
contains "app_dev.php" so the URL can never be directly converted to a file path.eg. the
$cached
file path is/var/www/site/app/../web/app_dev.php/media/cache/background/uploads/Big_dipper.png
so the linefile_exists($cached)
doesn't existThis will affect any user of this bundle who uses
app_dev.php
in the URL of their dev environment (which I think is the majority) and the images will always be regenerated and never loaded from cache. On pages with a lot of generated images this was taking a long time to load.This fix will make sure that the app_dev.php (or any other *.php files) are removed from the generated URL. It's not the most elegant solution but it will work for majority of people this affects.