Example #1
0
/**
 * Initialise the classes in this plugin.
 *
 * @since 1.1.0
 *
 * @todo Consider moving this to a dependency injection container, so we can avoid globals?
 */
function sg_cachepress_start()
{
    global $sg_cachepress, $sg_cachepress_options, $sg_cachepress_environment, $sg_cachepress_memcache, $sg_cachepress_admin, $sg_cachepress_supercacher;
    $sg_cachepress_options = new SG_CachePress_Options();
    $sg_cachepress = new SG_CachePress($sg_cachepress_options);
    $sg_cachepress_environment = new SG_CachePress_Environment($sg_cachepress_options);
    $sg_cachepress_admin = new SG_CachePress_Admin($sg_cachepress_options);
    $sg_cachepress_memcache = new SG_CachePress_Memcache($sg_cachepress_options, $sg_cachepress_environment);
    $sg_cachepress_supercacher = new SG_CachePress_Supercacher($sg_cachepress_options, $sg_cachepress_environment);
    $sg_cachepress->run();
    $sg_cachepress_admin->run();
    if ($sg_cachepress_environment->cache_is_enabled()) {
        if ($sg_cachepress_environment->autoflush_enabled()) {
            $sg_cachepress_supercacher->run();
        }
    }
    if ($sg_cachepress_environment->memcached_is_enabled()) {
        $sg_cachepress_memcache->run();
    }
}
 /**
  * Returns if the server is using Nginx
  * @return boolean
  */
 private static function is_nginx_server()
 {
     return SG_CachePress_Admin::return_and_cache_server_type();
 }