OllieJones / sqlite-object-cache

A WordPress persistent object cache for the rest of us.
GNU General Public License v2.0
24 stars 4 forks source link

Call wp_die in `wp_cache_init` #15

Closed spacedmonkey closed 1 year ago

spacedmonkey commented 1 year ago

Instead of calling throw new \RuntimeException and letting the fatel error handle show a message, call wp_die directly.

Like this

    function wp_cache_init() {
        $message = WP_Object_Cache::has_sqlite();
        if ( true === $message ) {
            // We need to override this WordPress global in order to inject our cache.
            // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
            $GLOBALS['wp_object_cache'] = new WP_Object_Cache();
        } else {
            wp_die( $message );
        }
    }

Screenshot from 2023-01-27 11-56-13

OllieJones commented 1 year ago

Great, thanks for the suggestion!