fix storage of user agent filter list (#28)
The user agent filer list is not flipped with the actual values as keys like the lists for referrer and target. Hence the numeric keys are compared against the actual user agent. We now flip the values in the upgrade hook.
This commit is contained in:
@ -178,6 +178,30 @@ class StatifyBlacklist_System extends StatifyBlacklist {
|
||||
self::update_options();
|
||||
}
|
||||
|
||||
// Version older than 1.6.
|
||||
if ( self::$options['version'] < 1.6 ) {
|
||||
$options = self::$options;
|
||||
if ( ! isset( $options['ua'] ) ) {
|
||||
$options['ua'] = array(
|
||||
'active' => 0,
|
||||
'regexp' => 0,
|
||||
'blacklist' => array(),
|
||||
);
|
||||
} elseif ( ! isset( $options['ua']['blacklist'] ) ) {
|
||||
$options['ua']['blacklist'] = array();
|
||||
} elseif ( isset( $options['ua'] ) ) {
|
||||
// User agent strings got stored incorrectly in 1.6.0 - luckily the version was not updated, either.
|
||||
$options['ua']['blacklist'] = array_flip( $options['ua']['blacklist'] );
|
||||
}
|
||||
$options['version'] = 1.6;
|
||||
if ( self::$multisite ) {
|
||||
update_site_option( 'statify-blacklist', $options );
|
||||
} else {
|
||||
update_option( 'statify-blacklist', $options );
|
||||
}
|
||||
self::update_options();
|
||||
}
|
||||
|
||||
// Version older than current major release.
|
||||
if ( self::VERSION_MAIN > self::$options['version'] ) {
|
||||
// Merge default options with current config, assuming only additive changes.
|
||||
|
Reference in New Issue
Block a user