AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] Cache / directory location overrides (s3 to local)

3 Posts
2 Users
1 Reactions
1,074 Views
sc89me
Posts: 28
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sc89me)
Eminent Member
Joined: 6 years ago
[#58063]

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);

2 Replies
Sofy
Posts: 5776
 Sofy
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sofy)
Support Team
Joined: 8 years ago

Hi,

The hook will be added in the next version of the wpForo plugin. Please wait for the next update.


sc89me
Posts: 28
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sc89me)
Eminent Member
Joined: 6 years ago

Thanks for confirming Sofy.


Share: