From 57e2870904b430b02af3ff3a4524f86fb6e9dda4 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Mon, 10 Oct 2016 10:07:48 +0200 Subject: [PATCH] Upgrade hook adds version in options --- inc/statifyblacklist_system.class.php | 13 ++++++++----- statify-blacklist.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/inc/statifyblacklist_system.class.php b/inc/statifyblacklist_system.class.php index bcf06c6..e4d56f6 100644 --- a/inc/statifyblacklist_system.class.php +++ b/inc/statifyblacklist_system.class.php @@ -9,6 +9,9 @@ defined( 'ABSPATH' ) OR exit; * @since 1.0.0 */ class StatifyBlacklist_System extends StatifyBlacklist { + + const VERSION_MAIN = 1.3; + /** * Plugin install handler. * @@ -77,9 +80,6 @@ class StatifyBlacklist_System extends StatifyBlacklist { /** * Upgrade plugin options. * - * @param object $upgrader Upgrader object (unused) - * @param array $options Options array - * * @since 1.2.0 * @changed 1.3.0 */ @@ -97,9 +97,12 @@ class StatifyBlacklist_System extends StatifyBlacklist { } } - /* Check if regular expressions option exists (pre 1.3.0) */ - if ( isset( self::$_options['referer_regexp'] ) ) { + /* Check if version is set (not before 1.3.0) */ + if ( ! isset( self::$_options['version'] ) ) { $options = self::$_options; + /* Set version */ + $options['version'] = self::VERSION_MAIN; + /* Add regular expression option (as of 1.3) */ $options['referer_regexp'] = 0; if ( ( is_multisite() && array_key_exists( STATIFYBLACKLIST_BASE, (array) get_site_option( 'active_sitewide_plugins' ) ) ) ) { update_site_option( 'statify-blacklist', $options ); diff --git a/statify-blacklist.php b/statify-blacklist.php index f747685..2efcff3 100644 --- a/statify-blacklist.php +++ b/statify-blacklist.php @@ -26,7 +26,7 @@ register_activation_hook( STATIFYBLACKLIST_FILE, array( 'StatifyBlacklist_System 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' ) ); /* Autoload */