Upgrade hook adds version in options
This commit is contained in:
parent
e7e2ef639c
commit
57e2870904
@ -9,6 +9,9 @@ defined( 'ABSPATH' ) OR exit;
|
|||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class StatifyBlacklist_System extends StatifyBlacklist {
|
class StatifyBlacklist_System extends StatifyBlacklist {
|
||||||
|
|
||||||
|
const VERSION_MAIN = 1.3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin install handler.
|
* Plugin install handler.
|
||||||
*
|
*
|
||||||
@ -77,9 +80,6 @@ class StatifyBlacklist_System extends StatifyBlacklist {
|
|||||||
/**
|
/**
|
||||||
* Upgrade plugin options.
|
* Upgrade plugin options.
|
||||||
*
|
*
|
||||||
* @param object $upgrader Upgrader object (unused)
|
|
||||||
* @param array $options Options array
|
|
||||||
*
|
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
* @changed 1.3.0
|
* @changed 1.3.0
|
||||||
*/
|
*/
|
||||||
@ -97,9 +97,12 @@ class StatifyBlacklist_System extends StatifyBlacklist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if regular expressions option exists (pre 1.3.0) */
|
/* Check if version is set (not before 1.3.0) */
|
||||||
if ( isset( self::$_options['referer_regexp'] ) ) {
|
if ( ! isset( self::$_options['version'] ) ) {
|
||||||
$options = self::$_options;
|
$options = self::$_options;
|
||||||
|
/* Set version */
|
||||||
|
$options['version'] = self::VERSION_MAIN;
|
||||||
|
/* Add regular expression option (as of 1.3) */
|
||||||
$options['referer_regexp'] = 0;
|
$options['referer_regexp'] = 0;
|
||||||
if ( ( is_multisite() && array_key_exists( STATIFYBLACKLIST_BASE, (array) get_site_option( 'active_sitewide_plugins' ) ) ) ) {
|
if ( ( is_multisite() && array_key_exists( STATIFYBLACKLIST_BASE, (array) get_site_option( 'active_sitewide_plugins' ) ) ) ) {
|
||||||
update_site_option( 'statify-blacklist', $options );
|
update_site_option( 'statify-blacklist', $options );
|
||||||
|
@ -26,7 +26,7 @@ register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System
|
|||||||
|
|
||||||
register_uninstall_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'uninstall' ) );
|
register_uninstall_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'uninstall' ) );
|
||||||
|
|
||||||
/* Upgrade hook to v1.2.0 */
|
/* Upgrade hook */
|
||||||
register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'upgrade' ) );
|
register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System', 'upgrade' ) );
|
||||||
|
|
||||||
/* Autoload */
|
/* Autoload */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user