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