diff --git a/class-gwiz-gf-code-chest.php b/class-gwiz-gf-code-chest.php index dab4ce4..24e90a3 100644 --- a/class-gwiz-gf-code-chest.php +++ b/class-gwiz-gf-code-chest.php @@ -114,6 +114,8 @@ public function minimum_requirements() { public function pre_init() { parent::pre_init(); + add_filter( 'expiration_of_transient_wp_github_plugin_updater_gf-code-chest/gf-code-chest.php', array( $this, 'filter_updater_cache_ttl' ), 10, 3 ); + $this->init_auto_updater(); /** @@ -123,6 +125,29 @@ public function pre_init() { add_action( 'gform_forms_post_import', array( $this, 'import_feeds_with_form' ) ); } + /** + * Filter the updater release metadata cache TTL. + * + * Defaults to the bundled updater value, unless overridden + * with the `gfcc_updater_cache_ttl` filter. + * + * @param int $expiration Existing transient expiration in seconds. + * @param mixed $value Transient value. + * @param string $transient Transient name. + * + * @return int + */ + public function filter_updater_cache_ttl( $expiration, $value, $transient ) { + $ttl = (int) apply_filters( + 'gfcc_updater_cache_ttl', + $expiration, + $value, + $transient + ); + + return $ttl; + } + /** * Initialize the auto-updater. */