• When temporarily deactivating wppp all settings are lost. Specifically I care for the dynamic_images module. Skimming through the code makes apparent the issue is in a lack of differentiation between deactivation vs uninstall, which are 2 separate hooks. The fix that currently worked for me:

    wp-performance-pack.php ~line 459 add:

    register_deactivation_hook( __FILE__, array( $wp_performance_pack, 'deactivate' ) );
    register_uninstall_hook( __FILE__, 'uninstall' ); // added

    wp-performance-pack.php ~line 364 comment out the block of code below in deactivate():

    public function deactivate() {
    	if ( $this->options['dynamic_images'] ) {
    		// Delete rewrite rules from htaccess
    		WPPP_Dynamic_Images::static_disable_rewrite_rules();
    	}
    /*
    	if ( is_multisite() && isset( $_GET['networkwide'] ) && 1 == $_GET['networkwide'] ) {
    		delete_site_option( self::wppp_options_name );
    	} else {
    		delete_option( self::wppp_options_name );
    	}
    	delete_option( 'wppp_dynimg_sizes' );
    	delete_option( 'wppp_version' );
    */
    	// restore static links
    	WPPP_CDN_Support::restore_static_links();
    }

    performance-pack.php ~line 378 move the commented out code above to a new function uninstall():

    #alx359-->
    	public function uninstall() {
            
    		if ( is_multisite() && isset( $_GET['networkwide'] ) && 1 == $_GET['networkwide'] ) {
    			delete_site_option( self::wppp_options_name );
    		} else {
    			delete_option( self::wppp_options_name );
    		}
    		delete_option( 'wppp_dynimg_sizes' );
    		delete_option( 'wppp_version' );
    	}
    #<--alx359

    (This of course is just an example that seems to suit me atm. Bjoern would have to implement a throughout fix.)

Viewing 1 replies (of 1 total)
  • Thread Starter alx359

    (@alx359)

    Subsequently, noticed deactivating/reactivating wasn’t recreating the .htaccess rules for dynamic images module. A possible fix:

    In class.wppp_dynamic_images.php , after the static_disable_rewrite_rules() definition, added a new function:

    public function enable_rewrite_rules() {
         $this->set_rewrite_rules();
         flush_rewrite_rules();
    }

    In wp-performance-pack.php in function activate(), after the version_compare block, added this code:

    if ( $this->options['dynamic_images'] ) {
    	// add rewrite rules to htaccess
        $this->modules['dynamic_images']->enable_rewrite_rules();
    }

    Now the .htaccess rules should be properly deleted/inserted upon deactivation/activation.

Viewing 1 replies (of 1 total)
  • The topic ‘Settings lost upon deactivation’ is closed to new replies.