osompress / simple-social-icons

Plugin: Simple Social Icons
62 stars 33 forks source link

Rebuild W3TC minify cache during plugin updates #21

Closed nickcernis closed 6 years ago

nickcernis commented 8 years ago

When a plugin updates, the W3TC minify cache has to be cleared manually before users see updates to style and JS files that plugins such as Simple Social Icons use.

Would it be worth automatically purging the W3TC minify cache when the plugin updates, or is this something that W3TC should be handling?

If individual plugin developers are responsible for purging the cache if their CSS files change, something like this may work (untested):

add_action( 'upgrader_process_complete', 'ssi_purge_minify_caches', 10, 2 );

function ssi_purge_minify_caches( $upgrader_object, $options ) {

    // TODO: If the updated plugin list does not include Simple Social Icons, return early.

    if ( function_exists( 'w3tc_minify_flush' ) ) {
        w3tc_minify_flush();
    }

}

This could improve the upgrade experience for W3TC users that have the minify setting enabled. (When a user installs a plugin, they see a message prompting them to purge the minify cache, but no message appears when you upgrade a plugin.)

If this is something worth adding, I'm happy to explore and test it before making a pull request.

nickcernis commented 6 years ago

Closing as many other caching services besides W3TC are now popular.