Corrections for case-(in)sensitive DB cleanup
This commit is contained in:
parent
036c1927fd
commit
e7e2ef639c
@ -126,10 +126,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
|
||||
|
||||
if ( isset( self::$_options['referer_regexp'] ) && self::$_options['referer_regexp'] > 0 ) {
|
||||
/* Merge given regular expressions into one */
|
||||
$refererRegexp = '/' . implode( "|", array_keys( self::$_options['referer'] ) ) . '/';
|
||||
if ( self::$_options['referer_regexp'] == 2 ) {
|
||||
$refererRegexp .= 'i';
|
||||
}
|
||||
$refererRegexp = implode( "|", array_keys( self::$_options['referer'] ) );
|
||||
} else {
|
||||
/* Sanitize URLs */
|
||||
$referer = self::sanitizeURLs( self::$_options['referer'] );
|
||||
@ -141,7 +138,9 @@ class StatifyBlacklist_Admin extends StatifyBlacklist {
|
||||
if ( ! empty( $refererRegexp ) ) {
|
||||
/* Execute filter on database */
|
||||
$wpdb->query(
|
||||
$wpdb->prepare( "DELETE FROM `$wpdb->statify` WHERE referrer REGEXP %s", $refererRegexp )
|
||||
$wpdb->prepare( "DELETE FROM `$wpdb->statify` WHERE "
|
||||
. ( ( self::$_options['referer_regexp'] == 1 ) ? " BINARY " : "" )
|
||||
. "referrer REGEXP %s", $refererRegexp )
|
||||
);
|
||||
|
||||
/* Optimize DB */
|
||||
|
@ -83,6 +83,7 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
<li>
|
||||
<label for="statify-blacklist_referer_regexp">
|
||||
<?php esc_html_e( 'Use regular expressions', 'statify-blacklist' ); ?>:
|
||||
<br />
|
||||
<select name="statifyblacklist[referer_regexp]" id="statifyblacklist_referer_regexp">
|
||||
<option value="0" <?php selected( StatifyBlacklist::$_options['referer_regexp'], 0 ); ?>>
|
||||
<?php esc_html_e( 'Disabled', 'statify-blacklist' ); ?>
|
||||
@ -94,7 +95,6 @@ if ( ! empty( $_POST['statifyblacklist'] ) ) {
|
||||
<?php esc_html_e( 'Case-insensitive', 'statify-blacklist' ); ?>
|
||||
</option>
|
||||
</select>
|
||||
<br />
|
||||
<small>(<?php esc_html_e( 'Performance slower than standard domain filter. Recommended for cron or manual execition only.', 'statify-blacklist' ); ?>)</small>
|
||||
</label>
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user