Skip to content

Enable garbage collector by default

Compare
Choose a tag to compare
@swashata swashata released this 31 Dec 12:32
· 107 commits to master since this release
ea3a288

Starting v2.6.2 we have enabled the garbage collector system by default. More information about it can be found here.

If for some reason you want to explicitly disable it (for example, while you are developing something locally), you can do so by defining this constant in your wp-config.php file.

// Disable Freemius WP-SDK Garbage Collector
if ( ! defined( 'WP_FS__ENABLE_GARBAGE_COLLECTOR' ) ) {
    define( 'WP_FS__ENABLE_GARBAGE_COLLECTOR', false );
}

The Garbage Collector will run once every day and will clear data of any plugins/themes that have not been active for more than 1 week.

You can configure the expiration time with another constant:

// Set expiration time to 30 days
if ( ! defined( 'WP_FS__GARBAGE_COLLECTOR_EXPIRATION_TIME_SECS' ) ) {
    define( 'WP_FS__GARBAGE_COLLECTOR_EXPIRATION_TIME_SECS', ( 30 * 24 * 60 * 60 ) );	
}

Additionally, we also identified and fixed a typo in the logic which could have caused a regression in the GC logic.