PluginProbe
Patchstack – WordPress & Plugins Security / trunk
Patchstack – WordPress & Plugins Security vtrunk
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / migrations / v301.php

v301.php in Patchstack – WordPress & Plugins Security trunk, at includes/migrations/v301.php

35 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 update_option('patchstack_db_version', '3.0.1');
9
10 // Get the last id.
11 $lastid_firewall = get_option( 'patchstack_firewall_log_lastid', 0 );
12 $lastid_event = get_option( 'patchstack_eventlog_lastid', 0 );
13
14 // Get the current first id.
15 $first_firewall = $wpdb->get_var( 'SELECT id FROM ' . $prefix . 'patchstack_firewall_log ORDER BY id ASC LIMIT 0, 1' );
16 $first_event = $wpdb->get_var( 'SELECT id FROM ' . $prefix . 'patchstack_event_log ORDER BY id ASC LIMIT 0, 1' );
17
18 // Get the current last id.
19 $last_firewall = $wpdb->get_var( 'SELECT id FROM ' . $prefix . 'patchstack_firewall_log ORDER BY id DESC LIMIT 0, 1' );
20 $last_event = $wpdb->get_var( 'SELECT id FROM ' . $prefix . 'patchstack_event_log ORDER BY id DESC LIMIT 0, 1' );
21
22 // Update the lastid value of the firewall log.
23 if ( ! is_null( $first_firewall ) && ! is_null( $last_firewall ) ) {
24 if ( (int) $lastid_firewall > (int) $last_firewall ) {
25 update_option( 'patchstack_firewall_log_lastid', ( (int) $first_firewall ) - 1 );
26 }
27 }
28
29 // Update the lastid value of the activity log.
30 if ( ! is_null( $first_event ) && ! is_null( $last_event ) ) {
31 if ( (int) $lastid_event > (int) $last_event ) {
32 update_option( 'patchstack_eventlog_lastid', ( (int) $first_event ) - 1 );
33 }
34 }
35