Hi guys (probably Robert specifically)Â
I had a cache problem before and it's this thread where we were having an issue with cache going to S3 in our setup:Â
https://wpforo.com/community/how-to-and-troubleshooting-2/wpforo-cache-s3-uploads/#post-103744
And this ended with you adding a filter for me to change the cache location and we thought all was fine.Â
I recently became aware of S3 costs for the client were spiralling to thousands per month in costs and when we investigated this is was because of literally 100's of millions of S3 requests being made for the wpforo cached options.Â
We looked into this and found that the reason was because although there is that filter added in the cache class there is another file which is calling options from the default cache location in another class, when that is called to get cached options it has not had the default cache location modified so it tries to get them from S3.Â
In order to resolve this and allow us to go back to the official unmodded version of the wpforo plugin can you please add the following filter into your next release in the root wpforo.php file? This allows us to modify or rather override the cache directory on initialization so its correct even when used outside of the cache class.
$this->folders = apply_filters('wpforo_working_folders', $this->folders);
do_action('wpforo_after_init_folders', $this->folders);
If you do add this it may be worth removing the filter from cache class as it does not function properly anyway as I described its up to yourselves obviously.Â
Thanks.Â
PS: not that you need it but we used it like so as a filter if anyone else finds this useful obviously the constant var etc will differ for each setup:Â
add_filter('wpforo_working_folders', function ($folders) {
$folders['cache'] = [
'dir' => WPFORO_CACHE_DIR,
'url' => trailingslashit(home_url()) . str_replace('/app/web/', '', WPFORO_CACHE_DIR),
'url//' => str_replace('https:', '', home_url()) . str_replace('app/web/', '', WPFORO_CACHE_DIR),
];
return $folders;
}, 1000, 2);
Hi,
The hook will be added in the next version of the wpForo plugin. Please wait for the next update.
Thanks for confirming Sofy.