Changeset 2940115
- Timestamp:
- 07/19/2023 02:29:15 AM (3 years ago)
- Location:
- logdash-activity-log/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (3 diffs)
-
logdash-activity-log.php (modified) (2 diffs)
-
src/Actions/RemoveExpiredLog.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
logdash-activity-log/trunk/README.txt
r2916058 r2940115 6 6 Tested up to: 6.2 7 7 Requires PHP: 7.4 8 Stable tag: 1.1. 28 Stable tag: 1.1.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 76 76 == Changelog == 77 77 78 = 1.1.3 = 79 * Performance improved while deleting old events 80 78 81 = 1.1.2 = 79 82 * Fixed a critical bug with Autoload … … 89 92 == Upgrade Notice == 90 93 94 = 1.1.3 = 95 * Performance improved while deleting old events 96 91 97 = 1.1.2 = 92 98 * Fixed a critical bug with Autoload -
logdash-activity-log/trunk/logdash-activity-log.php
r2916058 r2940115 9 9 * Plugin URI: https://deryckoe.com/logdash-activity-log 10 10 * Description: The ultimate solution for tracking activities and security issues on your WordPress site. 11 * Version: 1.1. 211 * Version: 1.1.3 12 12 * Author: Deryck Oñate 13 13 * Author URI: http://deryckoe.com … … 27 27 * Currently plugin version. 28 28 */ 29 define( 'LOGDASH_VERSION', '1.1. 2' );29 define( 'LOGDASH_VERSION', '1.1.3' ); 30 30 31 31 /** -
logdash-activity-log/trunk/src/Actions/RemoveExpiredLog.php
r2916051 r2940115 12 12 public function __construct() { 13 13 global $wpdb; 14 $this->wpdb = $wpdb;14 $this->wpdb = $wpdb; 15 15 } 16 16 … … 28 28 29 29 public function actions() { 30 add_action( 'init', [ $this, 'delete_expired_log' ] ); 30 31 // add_action( 'init', [ $this, 'delete_expired_log' ] ); 32 add_action( 'init', [ $this, 'register_expired_log_job' ] ); 33 add_action( 'delete_expired_log', [ $this, 'delete_expired_log' ] ); 34 } 35 36 public function register_expired_log_job( ) { 37 if ( ! wp_next_scheduled( 'delete_expired_log' ) ) { 38 wp_schedule_single_event( time(), 'delete_expired_log' ); 39 } 31 40 } 32 41 33 42 public function delete_expired_log() { 34 35 43 $options = $this->get_options(); 36 44 … … 42 50 $activity_log = DB::log_table(); 43 51 $activity_meta = DB::meta_table(); 44 $site_id = get_current_blog_id();52 $site_id = get_current_blog_id(); 45 53 46 $this->wpdb->query( "DELETE l FROM $activity_log l 47 LEFT JOIN $activity_meta m 48 ON l.ID = m.event_id 49 WHERE FROM_UNIXTIME(l.created, '%Y-%m-%d') < DATE_SUB(CURRENT_DATE, INTERVAL {$days} DAY) AND site_id = {$site_id};" ); 54 $this->wpdb->query( "DELETE FROM $activity_log WHERE FROM_UNIXTIME(created, '%Y-%m-%d') < DATE_SUB(CURRENT_DATE, INTERVAL {$days} DAY) AND {$site_id} = 1;" ); 55 $this->wpdb->query( "DELETE FROM $activity_meta WHERE NOT EXISTS ( SELECT 1 FROM $activity_log WHERE $activity_log.ID = $activity_meta.event_id);" ); 50 56 51 57 $rows_affected = $this->wpdb->rows_affected; … … 55 61 } 56 62 57 update_option( 'logdash_deleted_events', [63 update_option( 'logdash_deleted_events', [ 58 64 'rows' => $rows_affected, 59 65 'date' => time(),
Note: See TracChangeset
for help on using the changeset viewer.