Changeset 2361544
- Timestamp:
- 08/14/2020 11:58:07 PM (6 years ago)
- Location:
- wpbase-cache/trunk
- Files:
-
- 2 edited
-
wpbase-cache.php (modified) (1 diff)
-
wpbase-redis-cache.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpbase-cache/trunk/wpbase-cache.php
r2321389 r2361544 3 3 Plugin Name: WPBase-Cache 4 4 Plugin URI: https://www.wpoven.com/ 5 Description: Custom WordPress Caching plugin for WPOven Hosted Sites which uses all caches on varnish, nginx, php-fpm stack with php-apc. This plugin also includes db-cache-reloaded-fix for dbcache.6 Version: 5.5. 25 Description: Custom WordPress Caching plugin for WPOven Hosted Sites which uses all caches on varnish, nginx, php-fpm stack and Redis. 6 Version: 5.5.32 7 7 Author: Vikrant Datta 8 8 Author URI: https://www.wpoven.com/ -
wpbase-cache/trunk/wpbase-redis-cache.php
r2006649 r2361544 27 27 add_action( 'admin_notices', array( $this, 'show_admin_notices' ) ); 28 28 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); 29 add_action( 'load-' . $this->screen, array( $this, 'do_admin_actions' ) ); 29 add_action('load-options.php', array($this, 'do_admin_actions'), 1); 30 //add_action( 'load-' . $this->screen, array( $this, 'do_admin_actions' ) ); 30 31 add_action( 'load-' . $this->screen, array( $this, 'add_admin_page_notices' ) ); 31 32 … … 249 250 } 250 251 251 public function do_admin_actions() { 252 253 global $wp_filesystem; 254 255 if ( isset( $_GET[ '_wpnonce' ], $_GET[ 'action' ] ) ) { 256 257 $action = $_GET[ 'action' ]; 258 259 // verify nonce 260 foreach ( $this->actions as $name ) { 261 if ( $action === $name && ! wp_verify_nonce( $_GET[ '_wpnonce' ], $action ) ) { 262 return; 263 } 264 } 265 266 if ( in_array( $action, $this->actions ) ) { 267 268 $url = wp_nonce_url( network_admin_url( add_query_arg( 'action', $action, $this->page ) ), $action ); 269 270 if ( $action === 'flush-cache' ) { 271 $message = wp_cache_flush() ? 'cache-flushed' : 'flush-cache-failed'; 272 } 273 274 // do we have filesystem credentials? 275 if ( $this->initialize_filesystem( $url, true ) ) { 276 277 switch ( $action ) { 278 279 case 'enable-cache': 280 $result = $wp_filesystem->copy( plugin_dir_path( __FILE__ ) . '/includes/object-cache.php', WP_CONTENT_DIR . '/object-cache.php', true ); 281 do_action( 'redis_object_cache_enable', $result ); 282 $message = $result ? 'cache-enabled' : 'enable-cache-failed'; 283 break; 284 285 case 'disable-cache': 286 $result = $wp_filesystem->delete( WP_CONTENT_DIR . '/object-cache.php' ); 287 do_action( 'redis_object_cache_disable', $result ); 288 $message = $result ? 'cache-disabled' : 'disable-cache-failed'; 289 break; 290 291 case 'update-dropin': 292 $result = $wp_filesystem->copy( plugin_dir_path( __FILE__ ) . '/includes/object-cache.php', WP_CONTENT_DIR . '/object-cache.php', true ); 293 do_action( 'redis_object_cache_update_dropin', $result ); 294 $message = $result ? 'dropin-updated' : 'update-dropin-failed'; 295 break; 296 297 } 298 299 } 300 301 // redirect if status `$message` was set 302 if ( isset( $message ) ) { 303 wp_safe_redirect( network_admin_url( add_query_arg( 'message', $message, $this->page ) ) ); 304 exit; 305 } 306 307 } 308 309 } 310 311 } 252 public function do_admin_actions() { 253 254 global $wp_filesystem; 255 if ($_POST['wpbase_cache_options']['redis_cache'] == '1') { 256 update_option('wpbase_cache_options', 'redis_cache', "1"); 257 $wp_filesystem->copy(plugin_dir_path(__FILE__) . '/includes/object-cache.php', WP_CONTENT_DIR . '/object-cache.php', true); 258 //do_action( 'redis_object_cache_enable', $result ); 259 } else if ($_POST['wpbase_cache_options']['redis_cache'] == NULL || $_POST['wpbase_cache_options']['redis_cache'] == '0') { 260 update_option('wpbase_cache_options', 'redis_cache', '0'); 261 $wp_filesystem->delete(WP_CONTENT_DIR . '/object-cache.php'); 262 //do_action( 'redis_object_cache_disable', $result ); 263 } 264 } 312 265 313 266 public function initialize_filesystem( $url, $silent = false ) {
Note: See TracChangeset
for help on using the changeset viewer.