Skip to content
Permalink
Browse files

[Bugfix] Improved compatibility when upgrade outside the admin page

  • Loading branch information...
hailite committed Feb 22, 2018
1 parent 98ffbc5 commit d5afabd08ea2f1fd76083240ee93d9778af6c99f
@@ -71,6 +71,15 @@ private function __construct()
add_action('admin_enqueue_scripts', array($this, 'check_messages')) ;// We can do this bcos admin_notices hook is after admin_enqueue_scripts hook in wp-admin/admin-header.php
}
/**
* In case this is called outside the admin page
* @see https://codex.wordpress.org/Function_Reference/is_plugin_active_for_network
* @since 1.9.2
*/
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ) ;
}
// add menus ( Also check for mu-plugins)
if ( $is_network_admin && ( is_plugin_active_for_network( LSCWP_BASENAME ) || defined( 'LSCWP_MU_PLUGIN' ) ) ) {
add_action('network_admin_menu', array($this, 'register_admin_menu')) ;
@@ -34,10 +34,6 @@ private function __construct()
$this->config = LiteSpeed_Cache_Config::get_instance() ;
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ) ;//todo: check if needed
}
// initialize admin actions
add_action( 'admin_init', array( $this, 'admin_init' ) ) ;
// add link to plugin list page
@@ -119,6 +119,16 @@ private static function get_network_count()
$count++ ;
}
}
/**
* In case this is called outside the admin page
* @see https://codex.wordpress.org/Function_Reference/is_plugin_active_for_network
* @since 1.9.2
*/
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ) ;
}
if ( is_plugin_active_for_network( LSCWP_BASENAME ) ) {
$count++ ;
}
@@ -271,12 +271,17 @@ private function construct_multisite_options()
{
$site_options = get_site_option( self::OPTION_NAME ) ;
if ( ! function_exists('is_plugin_active_for_network') ) { // todo: check if needed
require_once(ABSPATH . '/wp-admin/includes/plugin.php') ;
}
$options = get_option( self::OPTION_NAME, $this->get_default_options() ) ;
/**
* In case this is called outside the admin page
* @see https://codex.wordpress.org/Function_Reference/is_plugin_active_for_network
* @since 1.9.2
*/
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ) ;
}
// If don't have site options
if ( ! $site_options || ! is_array( $site_options ) || ! is_plugin_active_for_network( 'litespeed-cache/litespeed-cache.php' ) ) {
if ( $options[ self::OPID_ENABLED_RADIO ] === self::VAL_ON2 ) { // Default to cache on
@@ -25,6 +25,8 @@ LSCWP includes additional optimization features, such as Database Optimization,

Want to know more about caching in general, and LiteSpeed caching in particular? See [our Caching 101 blog series](https://blog.litespeedtech.com/tag/caching-101/).

[Join our Slack community](https://goo.gl/FG9S4N).

== Installation ==

1. Install [LiteSpeed Web Server Enterprise](https://www.litespeedtech.com/products/litespeed-web-server) with LSCache Module, [LiteSpeed Web ADC](https://www.litespeedtech.com/products/litespeed-web-adc), or [OpenLiteSpeed](https://www.litespeedtech.com/open-source/openlitespeed) with cache module [Free].

0 comments on commit d5afabd

Please sign in to comment.
You can’t perform that action at this time.