<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Hardcoded 1000-file wipe in Cache::check() — please add a filter - Bug Reports - wpForo 3.0				            </title>
            <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/</link>
            <description>Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 05 Oct 2026 23:54:53 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Hardcoded 1000-file wipe in Cache::check() — please add a filter</title>
                        <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139157</link>
                        <pubDate>Tue, 29 Sep 2026 11:07:15 +0000</pubDate>
                        <description><![CDATA[@robert we made some further changes because of performance issues we found, is it possible to have these also added to the next version? I have included a list of these changes and the reas...]]></description>
                        <content:encoded><![CDATA[<p>@robert we made some further changes because of performance issues we found, is it possible to have these also added to the next version? I have included a list of these changes and the reasons why we made them, I have also attached the Cache.php should you wish to take a look directly at the file.</p>
132
<p> (can't upload .php files)<br /><br />These are the 2 filters we have set for these changes: <br /><br /></p>
<div>
<pre contenteditable="false"><span>add_filter</span>( <span>'wpforo_cache_dir_max_files'</span>, <span>fn</span>() =&gt; <span>0 </span>);<br /><br /><span>// Cache trash cleanup runs from the prod cron against EFS (~1,100 deletes per 20s), allow longer runs so a full clear doesn't take hours.<br /></span><span>add_filter</span>( <span>'wpforo_cache_trash_time_limit'</span>, <span>fn</span>() =&gt; <span>120 </span>);</pre>
</div>
<p><br /><br /><br /># wpForo 3.0.5: requested changes to `classes/Cache.php`<br /><br />We run wpForo on three load-balanced PHP pods that share one cache folder on a network filesystem (AWS EFS/NFS). There are two problems with how `Cache` deletes files. We've patched both locally and would like the changes, or equivalent ones, added upstream so plugin updates don't overwrite them. The full diff against stock 3.0.5 is in `wpforo-cache.patch`.<br /><br />---<br /><br />## Change 1 (sent before): `wpforo_cache_dir_max_files` filter in `Cache::check()`<br /><br />**Problem:** `check()` counts the files in a cache folder on every cache write and clears the folder once it holds more than a fixed 1000 files. On a network filesystem, counting and clearing are both slow, and a busy forum goes over 1000 files all the time.<br /><br />**Change:** the limit can now be changed with a filter, and a value of `0` skips the count altogether:<br /><br /></p>
<pre contenteditable="false">$max = (int) apply_filters( 'wpforo_cache_dir_max_files', 1000, $directory );
if( $max === 0 ) return;
// ...existing count...
if( $filecount &gt; $max ) $this-&gt;clean_files( $directory );</pre>
<p><br /><br /><br />With the default of 1000, behaviour is the same as before.<br /><br />---<br /><br />## Change 2 (new): `Cache::clean_files()` renames the folder instead of deleting each file<br /><br />**Problem:** A new topic, a post, or a moderator approving a topic calls `wpforo_clean_cache()`. That calls `Cache::clean()`, which calls `clean_files()` on `forum/`, `topic/` and `post/`. `clean_files()` globs the folder and then runs `is_dir()`, `file_exists()` and `unlink()` on every file. On NFS/EFS each of those calls is a network round trip. With about 1,200 files, the user's save request is blocked for 20–24 seconds. Our php-fpm slowlog showed those saves stuck in `Cache::clean_files() → unlink()`, which caused 502s at the load balancer. The `wpforo_cache_*` filters don't help here: they only control the item caches, and these folders are cleared by the global cache setting alone.<br /><br />**Change:**<br /><br />1. `clean_files()` first calls a new private method, `swap_dir()`. It renames the folder to `&lt;folder&gt;.old-&lt;unix time&gt;-&lt;8 hex chars&gt;`, for example `post.old-1790670666-3fa91c0e`. It then recreates the folder empty using the existing `mkdir()`, which also writes `index.html` and `.htaccess`. A rename is a single operation however many files the folder holds, so the request finishes in milliseconds.<br />2. `swap_dir()` schedules a one-off WP-Cron event, `wpforo_cache_trash_cleanup`, 60 seconds later, if one isn't already scheduled. The event's only argument is the cache root.<br />3. The cron callback `Cache::cleanup_trash()`:<br />- finds `*.old-*` folders in the cache root and in `item/`<br />- deletes each one recursively, within a time limit (20 seconds by default)<br />- skips folders renamed less than 60 seconds ago, so requests still writing into them can finish<br />- reschedules itself if anything is left<br />4. If the rename fails, or the new filter turns it off, `clean_files()` falls back to the original per-file delete, unchanged.<br /><br />Nothing that reads the cache sees the renamed folders: every cache path is built from `$this-&gt;dir . '/&lt;template&gt;/'`. If a request writes a cache file between the rename and the re-create, `wpforo_write_file()` already recreates a missing folder, so the write doesn't fail.<br /><br />**New hooks:**<br /><br />|    Hook    |    Type    |    Default    |    Purpose    |<br />|------------|-----------|--------------|---------------|<br />| `wpforo_cache_clean_deferred` | filter `( bool $enabled, string $directory )` | `true` | Return `false` to keep the original per-file delete (for example on sites with no working WP-Cron). |<br />| `wpforo_cache_trash_time_limit` | filter `( int $seconds )` | `20` | How long one cron run spends deleting before it reschedules itself. |<br />| `wpforo_cache_trash_cleanup` | action (WP-Cron event) `( string $cache_root )` | — | The background deletion job. |<br /><br /><br />**Safety of the cleanup job:**<br />- It only deletes folders whose names match `/\.old-(\d+)(-+)?$/`, directly inside the cache root or `item/`.<br />- It doesn't follow symlinks.<br />- It ignores errors from files that are still open (NFS "silly rename" `.nfsXXXX` files) and retries on its next run.<br /><br />---<br /><br />## Diff<br /><br />- three new `use` statements<br />- the `wpforo_cache_trash_cleanup` hook registered in the constructor<br />- one line added at the top of `clean_files()`<br />- four new methods after `clean_files()`: `swap_dir()`, `schedule_trash_cleanup()`, `cleanup_trash()`, `delete_dir()`<br />- the `check()` change from Change 1<br /><br /></p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/bug-reports-wpforo-3/">Bug Reports - wpForo 3.0</category>                        <dc:creator>sc89me</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139157</guid>
                    </item>
				                    <item>
                        <title>RE: Hardcoded 1000-file wipe in Cache::check() — please add a filter</title>
                        <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139026</link>
                        <pubDate>Tue, 25 Aug 2026 10:53:08 +0000</pubDate>
                        <description><![CDATA[Hi Robert, Appreciate that thanks, Will you please still include a skip (early return) of the function if set to infinite? When we initially didn&#039;t return early and still allowed those file ...]]></description>
                        <content:encoded><![CDATA[<p>Hi Robert, <br /><br />Appreciate that thanks, <br /><br />Will you please still include a skip (early return) of the function if set to infinite? <br /><br />When we initially didn't return early and still allowed those file count calls to happen it was heavily loading the CPU because we hit periods of 50 - 100 views per second at peak times which caused those to happen per view. <br /><br /></p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/bug-reports-wpforo-3/">Bug Reports - wpForo 3.0</category>                        <dc:creator>sc89me</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139026</guid>
                    </item>
				                    <item>
                        <title>RE: Hardcoded 1000-file wipe in Cache::check() — please add a filter</title>
                        <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139024</link>
                        <pubDate>Tue, 25 Aug 2026 08:52:49 +0000</pubDate>
                        <description><![CDATA[Hi @sc89me,
Thank you for sharing this issue. We&#039;ll fix this in the next version release. It&#039;ll change the max file number dynamically based on the forum activity and also we&#039;ll add filter ...]]></description>
                        <content:encoded><![CDATA[<p>Hi @sc89me,</p>
<p>Thank you for sharing this issue. We'll fix this in the next version release. It'll change the max file number dynamically based on the forum activity and also we'll add filter hook to set a custom value. </p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/bug-reports-wpforo-3/">Bug Reports - wpForo 3.0</category>                        <dc:creator>Robert</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139024</guid>
                    </item>
				                    <item>
                        <title>RE: Hardcoded 1000-file wipe in Cache::check() — please add a filter</title>
                        <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139011</link>
                        <pubDate>Thu, 20 Aug 2026 12:14:46 +0000</pubDate>
                        <description><![CDATA[We have modified the check function to skip the file count function calls entirely when the max is set to 0 this avoids expensive CPU calls to count large directories which will not be clear...]]></description>
                        <content:encoded><![CDATA[<p>We have modified the check function to skip the file count function calls entirely when the max is set to 0 this avoids expensive CPU calls to count large directories which will not be cleared anyway.  <br /><br /></p>
<pre contenteditable="false">public function check( $directory ) {
		$directory = (string) $directory;
		$directory = wpforo_fix_dir_sep( $directory );
		$filecount = 0;
        $max = (int) apply_filters( 'wpforo_cache_dir_max_files', 1000, $directory );

        if($max === 0) {
            return;
        }

        if( class_exists( 'FilesystemIterator' ) &amp;&amp; is_dir( $directory ) ) {
			$fi        = new FilesystemIterator( $directory, FilesystemIterator::SKIP_DOTS );
			$filecount = iterator_count( $fi );
		}
		if( ! $filecount ) {
			$directory_ns = trim( $directory, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . '*';
			$directory_ws = DIRECTORY_SEPARATOR . trim( $directory, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . '*';
			$files        = glob( $directory_ns );
			if( empty( $files ) ) $files = glob( $directory_ws );
			$filecount = count( $files );
		}

        if ( $filecount &gt; $max ) {
            $this-&gt;clean_files( $directory );
        }
}</pre>
<p><br />Filter Used: <br /><br /></p>
<pre contenteditable="false">add_filter( 'wpforo_cache_dir_max_files', fn() =&gt; 0 );</pre>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/bug-reports-wpforo-3/">Bug Reports - wpForo 3.0</category>                        <dc:creator>sc89me</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139011</guid>
                    </item>
				                    <item>
                        <title>Hardcoded 1000-file wipe in Cache::check() — please add a filter</title>
                        <link>https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139003</link>
                        <pubDate>Wed, 19 Aug 2026 14:02:22 +0000</pubDate>
                        <description><![CDATA[IssueOn a large, busy forum, wpForo’s file cache under {cache_dir}/item/post regularly exceeds 1000 files. Cache::check() then deletes every file in that directory on the same frontend reque...]]></description>
                        <content:encoded><![CDATA[<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc"><strong><span class="font-semibold" data-streamdown="strong">Issue</span></strong><br />On a large, busy forum, wpForo’s file cache under<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">{cache_dir}/item/post</code><span> </span>regularly exceeds<span> </span><span class="font-semibold" data-streamdown="strong">1000 files</span>.<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">Cache::check()</code><span> </span>then deletes<span> </span><span class="font-semibold" data-streamdown="strong">every file in that directory</span><span> </span>on the same frontend request.</p>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc">That runs from<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk md-inline-variable-like">wp_footer</code><span> </span>→<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">WPF()-&gt;cache-&gt;create()</code><span> </span>when the template is<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">forum</code><span> </span>(forum index). After the wipe, traffic rebuilds the files, the folder hits 1000 again, and the wipe repeats (for us, every few minutes). PHP CPU spikes and the cache is not useful.</p>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc">We have thousands of posts. Each cached post is its own file (<code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">{postid}_{locale}</code>). A 1000-file cap is far below our working set. There is no setting or filter to change it.</p>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc">This is still present in<span> </span><span class="font-semibold" data-streamdown="strong">3.1.5</span>.<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk ui-s2xxs2 ui-7pq1vu ui-6tor67 ui-1ypdohk ui-l1v4ol ui-1sur9pj md-clickable-code md-inline-path-filename-like" role="button"><span class="ui-markdown__inline-path-prefix ui-1heor9g md-inline-path-prefix">classes/</span><span class="ui-markdown__inline-path-filename ui-1heor9g md-inline-path-filename">Cache.php</span></code><span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">check()</code>:</p>
<div class="composer-message-codeblock">
<div class="ui-code-block ui-1n2onr6 ui-1j66ri5 ui-14l7nz5 ui-1yf7rl7 ui-t4zf8z ui-zboxd6 ui-j3b58b ui-1vb4fzf ui-14gibnr ui-10a2chs ui-1u51yxl ui-178xt8z ui-13fuv20 ui-1aeic0j ui-s1s249 ui-32b0ac ui-141kqco ui-so031l ui-1q0q8m5 ui-17fyfba ui-e0pwq ui-19ypqd9 ui-1arpupx ui-6ikm8r ui-10wlt62 ui-1ua6jya ui-1k89b3v ui-8nuxf3">
<div class="ui-code-block-content ui-1n2onr6">
<div class="ui-scroll-area ui-1ekbvf6 ui-1logqu4 ui-1fx8caa ui-8ddqcf ui-1n2onr6 ui-6ikm8r ui-10wlt62 ui-rvj5dj ui-ypqxfk" data-scroll-padding="4" data-visibility="hover" data-direction="horizontal">
<div class="ui-scroll-area__viewport ui-175mniq ui-2lwn1j ui-mz0i5r ui-1pjcqnp ui-1rohswg ui-6ehuon ui-fk6m8 ui-w2csxc ui-10wlt62 ui-k8sdt9 ui-1duton ui-101ixbw ui-exgr1p ui-7p5m3t ui-y5w88m" data-native-scrollbar="none">
<div class="ui-scroll-area__content ui-9f619 ui-1us19tq ui-78zum5 ui-g7h5cd ui-1q0g3np ui-ezivpi ui-gqtt45 ui-1x1rfll">
<div class="ui-default-code ui-1wm8ruf ui-1lfj9qp ui-1ja60sm ui-1ua6jya ui-1m21r4p ui-cj37ws ui-13r5tfd ui-uve7l6 ui-1xpa7k ui-1rgtt3y ui-1uhho1l ui-o9w7m5 ui-17ewauw ui-1vakzcb ui-105xmc4 ui-1nsav61 ui-1jxofbz ui-947h55 ui-ta7kcf ui-1iagb1a ui-ez8t0j ui-i2wo5x ui-1iq2d2k ui-1qoclnz ui-k609h7 ui-1rqnq8e ui-19gwdp1 ui-1yfyyyg ui-1apie5d ui-dcvkk1 ui-code-block-default-code">
<div class="ui-1pshirs ui-awy1a7">
<div class="ui-78zum5 ui-10fesj9">
<div class="ui-default-code__line-content ui-98rzlu ui-1sdyfia ui-b3r6kr ui-lyipyv ui-wp9v23 ui-lgbajd ui-16b7oty ui-1n2onr6">
<pre contenteditable="false">if ( $filecount &gt; 1000 ) {
$this-&gt;clean_files( $directory );
}</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc">Page cache (WP Rocket etc.) is not in use on the forum; this is only wpForo’s on-disk cache.</p>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc"><strong><span class="font-semibold" data-streamdown="strong">Request</span></strong><br />Please make the limit filterable, default<span> </span><span class="font-semibold" data-streamdown="strong">1000</span>, pass<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">$directory</code>, and treat<span> </span><span class="font-semibold" data-streamdown="strong">0 as never wipe</span>:</p>
<div class="composer-message-codeblock">
<div class="ui-code-block ui-1n2onr6 ui-1j66ri5 ui-14l7nz5 ui-1yf7rl7 ui-t4zf8z ui-zboxd6 ui-j3b58b ui-1vb4fzf ui-14gibnr ui-10a2chs ui-1u51yxl ui-178xt8z ui-13fuv20 ui-1aeic0j ui-s1s249 ui-32b0ac ui-141kqco ui-so031l ui-1q0q8m5 ui-17fyfba ui-e0pwq ui-19ypqd9 ui-1arpupx ui-6ikm8r ui-10wlt62 ui-1ua6jya ui-1k89b3v ui-8nuxf3">
<div class="ui-code-block-content ui-1n2onr6">
<div class="ui-scroll-area ui-1ekbvf6 ui-1logqu4 ui-1fx8caa ui-8ddqcf ui-1n2onr6 ui-6ikm8r ui-10wlt62 ui-rvj5dj ui-ypqxfk" data-scroll-padding="4" data-visibility="hover" data-direction="horizontal">
<div class="ui-scroll-area__viewport ui-175mniq ui-2lwn1j ui-mz0i5r ui-1pjcqnp ui-1rohswg ui-6ehuon ui-fk6m8 ui-w2csxc ui-10wlt62 ui-k8sdt9 ui-1duton ui-101ixbw ui-exgr1p ui-7p5m3t ui-y5w88m" data-native-scrollbar="none">
<div class="ui-scroll-area__content ui-9f619 ui-1us19tq ui-78zum5 ui-g7h5cd ui-1q0g3np ui-ezivpi ui-gqtt45 ui-1x1rfll">
<div class="ui-default-code ui-1wm8ruf ui-1lfj9qp ui-1ja60sm ui-1ua6jya ui-1m21r4p ui-cj37ws ui-13r5tfd ui-uve7l6 ui-1xpa7k ui-1rgtt3y ui-1uhho1l ui-o9w7m5 ui-17ewauw ui-1vakzcb ui-105xmc4 ui-1nsav61 ui-1jxofbz ui-947h55 ui-ta7kcf ui-1iagb1a ui-ez8t0j ui-i2wo5x ui-1iq2d2k ui-1qoclnz ui-k609h7 ui-1rqnq8e ui-19gwdp1 ui-1yfyyyg ui-1apie5d ui-dcvkk1 ui-code-block-default-code">
<div class="ui-1pshirs ui-awy1a7">
<div class="ui-78zum5 ui-10fesj9">
<div class="ui-default-code__line-content ui-98rzlu ui-1sdyfia ui-b3r6kr ui-lyipyv ui-wp9v23 ui-lgbajd ui-16b7oty ui-1n2onr6">
<pre contenteditable="false">$max = (int) apply_filters( 'wpforo_cache_dir_max_files', 1000, $directory );
if ( $max &gt; 0 &amp;&amp; $filecount &gt; $max ) {
$this-&gt;clean_files( $directory );
}</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc">That stays backward compatible. Large forums can raise the cap or disable the wipe without forking the plugin.</p>
<p class="ui-markdown__paragraph ui-z80ra4 ui-uu7i3w ui-1nhcn8o ui-j7cesy ui-13faqbe ui-14l7nz5 ui-zboxd6 ui-19d5a1n ui-bpgzfc"><strong><span class="font-semibold" data-streamdown="strong">Optional follow-up</span></strong><br />Counting the directory with<span> </span><code class="ui-markdown__inline-code ui-rtu7ee ui-1i9v5mb ui-1hhlpkd ui-6lrnw6 ui-115g5cq ui-odjx36 ui-1wd3ewq ui-hayvgc ui-eb7xqv ui-15bjb6t ui-1lldw8n ui-1mzt3pk">FilesystemIterator</code><span> </span>on<span> </span><span class="font-semibold" data-streamdown="strong">every</span><span> </span>forum-index request is expensive once the folder is large, even if you never delete. A throttle (e.g. at most once per N minutes) would help. Full-directory unlink is also harsh vs deleting oldest files; the filter is the minimum we need please.</p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/bug-reports-wpforo-3/">Bug Reports - wpForo 3.0</category>                        <dc:creator>sc89me</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/bug-reports-wpforo-3/hardcoded-1000-file-wipe-in-cachecheck-please-add-a-filter/#post-139003</guid>
                    </item>
							        </channel>
        </rss>
		