| @@ -1,34 +1,34 @@ | ||
| 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 | -} | |
| 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 | +} | |