PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.11
Patchstack – WordPress & Plugins Security v2.2.11
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
← All changes | includes/event-log.php +9 -4 2.1.32.2.11 View file →
@@ -27,9 +27,9 @@
27 27 return;
28 28 }
29 29
30 30 // Include all the different event loggers.
31 - foreach ( array( 'posts', 'plugins', 'core', 'options', 'users', 'comments', 'attachment' ) as $event ) {
31 + foreach ( [ 'posts', 'plugins', 'core', 'options', 'users', 'comments', 'attachment' ] as $event ) {
32 32 require_once dirname( __FILE__ ) . '/events/' . $event . '.php';
33 33 $class = 'P_Event_' . ucfirst( $event );
34 34 new $class();
35 35 }
@@ -45,8 +45,13 @@
45 45 // Get the author name, if the user is logged in.
46 46 $user = get_user_by( 'id', get_current_user_id() );
47 47 $author = ! $user ? 'Unauthenticated user' : $user->data->user_login;
48 48
49 + // If it's a scheduled task running, we override the name.
50 + if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
51 + $author = 'WPCron';
52 + }
53 +
49 54 // Exception for when the action is 'logged in'.
50 55 if ( $args['action'] == 'logged in' ) {
51 56 $author = $args['object_name'];
52 57 }
@@ -62,9 +67,9 @@
62 67 // Insert into the logs.
63 68 global $wpdb;
64 69 $wpdb->insert(
65 70 $wpdb->prefix . 'patchstack_event_log',
66 - array(
71 + [
67 72 'author' => $author,
68 73 'ip' => $this->get_ip(),
69 74 'object' => isset( $args['object'] ) ? $args['object'] : '',
70 75 'object_id' => isset( $args['object_id'] ) ? (int) $args['object_id'] : '',
@@ -71,10 +76,10 @@
71 76 'action' => isset( $args['action'] ) ? $args['action'] : '',
72 77 'object_name' => isset( $args['object_name'] ) ? $args['object_name'] : '',
73 78 'date' => current_time( 'mysql' ),
74 79 'flag' => '',
75 - ),
76 - array( '%s', '%s', '%s', '%d', '%s', '%s', '%s' )
80 + ],
81 + [ '%s', '%s', '%s', '%d', '%s', '%s', '%s' ]
77 82 );
78 83 }
79 84 }
80 85 }