Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid to delete images/ folder after using GPM #1481

Closed
wants to merge 1 commit into from
Closed

Avoid to delete images/ folder after using GPM #1481

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented May 17, 2017

When I installed or updated a Grav plugin, it deleted all the cache, but also the "compiled" images,
makes the website very slow (for a relatively complex website).

My initial reason for this patch is because I installed fastcgi_cache in order to make the site still available while
deploying with Ansible, but the images got cleared when the provisioning run the update GPM command,
then showing "missing picture" errors on the website.

This patch nows permit to use the function like :

Grav\Console\ConsoleTrait::clearCache('all');
Grav\Console\ConsoleTrait::clearCache('cache-only');

Please note that those examples are static, just consider the method parameter.

And then I've linked it after the update and install classes. So when a plugin got updated/installed,
it does only clear the cache instead of clear the cache plus the compiled pictures, agressively slowing the website.

In hope that this will break nothing in the actual core, because I don't know Grav well enough to deal with all the parameters in my mind.

Thanks !

When I installed or updated a Grav plugin, it deleted all the cache, but also the "compiled" images,
makes the website very slow (for a relatively complex website).

My initial reason for this patch is because I installed fastcgi_cache in order to make the site still available while
deploying with Ansible, but the images got cleared when the provisioning run the update GPM command,
then showing "missing picture" errors on the website.

This patch nows permit to use the function like :

```php
Grav\Console\ConsoleTrait::clearCache('all');
Grav\Console\ConsoleTrait::clearCache('cache-only');
```

*Please not that those examples are static, just consider the method parameter.*

And then I've linked it after the update and install classes. So when a plugin got updated/installed,
it does only clear the cache instead of clear the cache plus the compiled pictures, agressively slowing the website.

In hope that this will break nothing in the actual core, because I don't know Grav well enough to deal with all the parameters in my mind.

Thanks !
@rhukster
Copy link
Member

I can appreciate this PR after dealing with a large image-based site that continually has to re-process large images even when only minor content is changed.

However, i think the better approach is to have a configuration option that changes the default 'clear cache' behavior. I hesitate to change the current behavior by default (ie in system/config/system.yaml), but i think that having the ability to not touch mess with the images/ folder when calling clear() would be very useful for some use cases.

I think i will test this though because we used to have issues with Gregwar Image caching not picking up changes it should of detected. Perhaps this has been addressed now and we can assume that it will automatically handle things rather than us manually clearing the whole folder out.

@rhukster
Copy link
Member

Ok i've implemented this as a system option.

@rhukster rhukster closed this Jul 26, 2017
OleVik added a commit to OleVik/grav-learn that referenced this pull request Jul 15, 2018
- [x] Document optional collection ordering PHP flags getgrav/grav#1640
	- Added under /content/collections#php-collections
- [x] Added cache_control system and page override getgrav/grav#1591
	- Added reference-link to /basics/grav-configuration#pages
	- Added /content/headers#cache-control
- [x] clear_images_by_default cache option getgrav/grav#1481
	- Clarified description in /basics/grav-configuration#pages
- [x] Collection::intersect() getgrav/grav#1605
	- Added under /content/collections#collection-object-methods
- [x] Collection::merge() method
	- Added under /content/collections#collection-object-methods
- [x] Page::collection() filtering
	- Added under /content/collections#complex-collections, with a bit of cleanup
- [x] Document EXIF support in Grav (and in capabilities)
	- Clarified /themes/twig-filters-functions#exif
	- Added note at the end of /cookbook/general-recipes#creating-a-simple-gallery
- [x] document not being able to scroll caused by cloudlare. getgrav/grav-plugin-admin#808 (comment)
	- Done in getgrav#397
	- Duplicated under Admin Plugin and Cookbook headers
- [x] Document adding custom form fields with examples..
	- Done in getgrav#401
- [x] Document range field
	- Done in [7e0dcbc](getgrav@7e0dcbc)
- [x] Tutorial on how to create a split menu system (vertical menu?)
	- Duplicated under Cookbook header
- [x] Tutorial walkthrough covering going from and HTML site/design to Grav theme
	- Duplicated under Cookbook header

getgrav#356 needs some cleanup to remove completed tasks, they're not really needed.
rhukster pushed a commit to getgrav/grav-learn that referenced this pull request Jul 27, 2018
- [x] Document optional collection ordering PHP flags getgrav/grav#1640
	- Added under /content/collections#php-collections
- [x] Added cache_control system and page override getgrav/grav#1591
	- Added reference-link to /basics/grav-configuration#pages
	- Added /content/headers#cache-control
- [x] clear_images_by_default cache option getgrav/grav#1481
	- Clarified description in /basics/grav-configuration#pages
- [x] Collection::intersect() getgrav/grav#1605
	- Added under /content/collections#collection-object-methods
- [x] Collection::merge() method
	- Added under /content/collections#collection-object-methods
- [x] Page::collection() filtering
	- Added under /content/collections#complex-collections, with a bit of cleanup
- [x] Document EXIF support in Grav (and in capabilities)
	- Clarified /themes/twig-filters-functions#exif
	- Added note at the end of /cookbook/general-recipes#creating-a-simple-gallery
- [x] document not being able to scroll caused by cloudlare. getgrav/grav-plugin-admin#808 (comment)
	- Done in #397
	- Duplicated under Admin Plugin and Cookbook headers
- [x] Document adding custom form fields with examples..
	- Done in #401
- [x] Document range field
	- Done in [7e0dcbc](7e0dcbc)
- [x] Tutorial on how to create a split menu system (vertical menu?)
	- Duplicated under Cookbook header
- [x] Tutorial walkthrough covering going from and HTML site/design to Grav theme
	- Duplicated under Cookbook header

#356 needs some cleanup to remove completed tasks, they're not really needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant