MainWP Child Reports - Version 1.8

Version Description

  • 8-2-2018 =
  • Fixed: an issue with logging plugin installations
  • Fixed: an issue with displaying double records
  • Fixed: multiple PHP Warnings
  • Improved: support for UpdraftPlus backups
Download this release

Release Info

Developer mainwp
Plugin Icon 128x128 MainWP Child Reports
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

connectors/installer.php CHANGED
@@ -5,6 +5,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
5
  public static $name = 'installer';
6
 
7
  public static $actions = array(
 
8
  'upgrader_process_complete', // plugins::installed | themes::installed
9
  'activate_plugin', // plugins::activated
10
  'deactivate_plugin', // plugins::deactivated
@@ -16,8 +17,10 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
16
  '_core_updated_successfully',
17
  'mainwp_child_installPluginTheme',
18
  'mainwp_child_plugin_action',
19
- 'mainwp_child_theme_action'
 
20
  );
 
21
 
22
  public static function get_label() {
23
  return __( 'Installer', 'mainwp-child-reports' );
@@ -63,9 +66,13 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
63
  return get_plugins();
64
  }
65
 
66
-
67
- public static function callback_mainwp_child_installPluginTheme($args ) {
68
- $logs = array();
 
 
 
 
69
  $success = isset($args['success']) ? $args['success'] : 0;
70
  $error = null;
71
 
@@ -148,7 +155,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
148
  }
149
  }
150
 
151
- public static function callback_mainwp_child_theme_action($args) {
152
  if (!is_array($args) || !isset($args['action']))
153
  return;
154
  $action = $args['action'];
@@ -164,6 +171,10 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
164
  }
165
 
166
  public static function callback_upgrader_process_complete( $upgrader, $extra ) {
 
 
 
 
167
  $logs = array();
168
  $success = ! is_wp_error( $upgrader->skin->result );
169
  $error = null;
@@ -229,10 +240,18 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
229
  $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $slug );
230
  $name = $plugin_data['Name'];
231
  $version = $plugin_data['Version'];
232
- $old_version = $upgrader->skin->plugin_info['Version']; // to fix old version
233
- if (version_compare($version, $old_version, '>')) { // to fix
234
- $logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
235
- }
 
 
 
 
 
 
 
 
236
  }
237
  } else { // theme
238
  if ( isset( $extra['bulk'] ) && true == $extra['bulk'] ) {
@@ -274,7 +293,63 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
274
  }
275
  }
276
 
277
- public static function callback_activate_plugin( $slug, $network_wide ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  $plugins = self::get_plugins();
279
  $name = $plugins[ $slug ]['Name'];
280
  $network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
@@ -290,7 +365,7 @@ class MainWP_WP_Stream_Connector_Installer extends MainWP_WP_Stream_Connector {
290
  );
291
  }
292
 
293
- public static function callback_deactivate_plugin( $slug, $network_wide ) {
294
  $plugins = self::get_plugins();
295
  $name = $plugins[ $slug ]['Name'];
296
  $network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
5
  public static $name = 'installer';
6
 
7
  public static $actions = array(
8
+ 'upgrader_pre_install', // use to the current version of all plugins, before they are upgraded ( Net-Concept - Xavier NUEL )
9
  'upgrader_process_complete', // plugins::installed | themes::installed
10
  'activate_plugin', // plugins::activated
11
  'deactivate_plugin', // plugins::deactivated
17
  '_core_updated_successfully',
18
  'mainwp_child_installPluginTheme',
19
  'mainwp_child_plugin_action',
20
+ 'mainwp_child_theme_action',
21
+ 'mainwp_child_upgradePluginTheme'
22
  );
23
+ public static $old_plugins = array();
24
 
25
  public static function get_label() {
26
  return __( 'Installer', 'mainwp-child-reports' );
66
  return get_plugins();
67
  }
68
 
69
+ // ( Net-Concept - Xavier NUEL ) : save all plugins versions before upgrade
70
+ public static function callback_upgrader_pre_install() {
71
+ self::$old_plugins = self::get_plugins();
72
+ }
73
+
74
+ public static function callback_mainwp_child_installPluginTheme($args) {
75
+ $logs = array();
76
  $success = isset($args['success']) ? $args['success'] : 0;
77
  $error = null;
78
 
155
  }
156
  }
157
 
158
+ public static function callback_mainwp_child_theme_action($args) {
159
  if (!is_array($args) || !isset($args['action']))
160
  return;
161
  $action = $args['action'];
171
  }
172
 
173
  public static function callback_upgrader_process_complete( $upgrader, $extra ) {
174
+ // do not logging if update from mainwp dashboard
175
+ if (isset($_POST['mainwpsignature']) && isset($_POST['function']) && $_POST['function'] == 'upgradeplugintheme') {
176
+ return false;
177
+ }
178
  $logs = array();
179
  $success = ! is_wp_error( $upgrader->skin->result );
180
  $error = null;
240
  $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $slug );
241
  $name = $plugin_data['Name'];
242
  $version = $plugin_data['Version'];
243
+
244
+ // ( Net-Concept - Xavier NUEL ) : get old versions
245
+ if (isset(self::$old_plugins[$slug])) {
246
+ $old_version = self::$old_plugins[$slug]['Version'];
247
+ } else {
248
+ //$old_version = ''; // Hummm... will this happen ?
249
+ $old_version = $upgrader->skin->plugin_info['Version']; // to fix old version
250
+ }
251
+
252
+ if (version_compare($version, $old_version, '>')) {
253
+ $logs[] = compact('slug', 'name', 'old_version', 'version', 'message', 'action');
254
+ }
255
  }
256
  } else { // theme
257
  if ( isset( $extra['bulk'] ) && true == $extra['bulk'] ) {
293
  }
294
  }
295
 
296
+ public static function callback_mainwp_child_upgradePluginTheme( $extra ) {
297
+ $logs = array();
298
+
299
+ if ( ! isset( $extra['type'] ) ) {
300
+ return false;
301
+ }
302
+
303
+ $type = $extra['type'];
304
+ $action = $extra['action'];
305
+
306
+ if ( ! in_array( $type, array( 'plugin', 'theme' ) ) ) {
307
+ return;
308
+ }
309
+
310
+ if ( 'update' === $action ) {
311
+ if ( 'plugin' === $type ) {
312
+ $slug = $extra['slug'];
313
+ $name = $extra['name'];
314
+ $version = $extra['version'];
315
+ $old_version = $extra['old_version'];
316
+ } else { // theme
317
+ $name = $extra['name'];
318
+ $version = $extra['version'];
319
+ $old_version = $extra['old_version'];
320
+ }
321
+
322
+ $action = 'updated';
323
+ $message = _x(
324
+ 'Updated %1$s: %2$s %3$s',
325
+ 'Plugin/theme update. 1: Type (plugin/theme), 2: Plugin/theme name, 3: Plugin/theme version',
326
+ 'mainwp_child_reports'
327
+ );
328
+ $logs[] = compact( 'slug', 'name', 'old_version', 'version', 'message', 'action' );
329
+ } else {
330
+ return false;
331
+ }
332
+
333
+ $context = $type . 's';
334
+
335
+ foreach ( $logs as $log ) {
336
+ $name = isset( $log['name'] ) ? $log['name'] : null;
337
+ $version = isset( $log['version'] ) ? $log['version'] : null;
338
+ $slug = isset( $log['slug'] ) ? $log['slug'] : null;
339
+ $old_version = isset( $log['old_version'] ) ? $log['old_version'] : null;
340
+ $message = isset( $log['message'] ) ? $log['message'] : null;
341
+ $action = isset( $log['action'] ) ? $log['action'] : null;
342
+ self::log(
343
+ $message,
344
+ compact( 'type', 'name', 'version', 'slug', 'success', 'error', 'old_version' ),
345
+ null,
346
+ array( $context => $action )
347
+ );
348
+ }
349
+ }
350
+
351
+
352
+ public static function callback_activate_plugin( $slug, $network_wide = false ) {
353
  $plugins = self::get_plugins();
354
  $name = $plugins[ $slug ]['Name'];
355
  $network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
365
  );
366
  }
367
 
368
+ public static function callback_deactivate_plugin( $slug, $network_wide = false) {
369
  $plugins = self::get_plugins();
370
  $name = $plugins[ $slug ]['Name'];
371
  $network_wide = $network_wide ? __( 'network wide', 'mainwp-child-reports' ) : null;
includes/admin.php CHANGED
@@ -95,7 +95,10 @@ class MainWP_WP_Stream_Admin {
95
  if (!is_array($last_backup))
96
  return $last_backup;
97
 
98
- if (isset($last_backup['backup_time'])) {
 
 
 
99
  $date = $last_backup['backup_time'];
100
  $backup = $last_backup['backup_array'];
101
 
@@ -218,6 +221,7 @@ class MainWP_WP_Stream_Admin {
218
  'current_page' => isset( $_GET['paged'] ) ? esc_js( $_GET['paged'] ) : '1',
219
  'current_order' => isset( $_GET['order'] ) ? esc_js( $_GET['order'] ) : 'desc',
220
  'current_query' => json_encode( $_GET ),
 
221
  'filters' => self::$list_table ? self::$list_table->get_filters() : false,
222
  'locale' => esc_js( $locale )
223
  )
@@ -390,7 +394,7 @@ class MainWP_WP_Stream_Admin {
390
  private static function reset_stream_settings() {
391
  global $wpdb;
392
 
393
- $blogs = wp_get_sites();
394
 
395
  if ( $blogs ) {
396
  foreach ( $blogs as $blog ) {
@@ -446,8 +450,7 @@ class MainWP_WP_Stream_Admin {
446
  ON `meta`.`record_id` = `stream`.`ID`
447
  WHERE `stream`.`type` = %s
448
  $where;",
449
- 'stream',
450
- $date->format( 'Y-m-d H:i:s' )
451
  )
452
  );
453
  }
95
  if (!is_array($last_backup))
96
  return $last_backup;
97
 
98
+ if (isset($last_backup['backup_time'])) {
99
+ if (empty($last_backup['success']))
100
+ return false;
101
+
102
  $date = $last_backup['backup_time'];
103
  $backup = $last_backup['backup_array'];
104
 
221
  'current_page' => isset( $_GET['paged'] ) ? esc_js( $_GET['paged'] ) : '1',
222
  'current_order' => isset( $_GET['order'] ) ? esc_js( $_GET['order'] ) : 'desc',
223
  'current_query' => json_encode( $_GET ),
224
+ 'current_query_count' => count( $_GET ),
225
  'filters' => self::$list_table ? self::$list_table->get_filters() : false,
226
  'locale' => esc_js( $locale )
227
  )
394
  private static function reset_stream_settings() {
395
  global $wpdb;
396
 
397
+ $blogs = get_sites();
398
 
399
  if ( $blogs ) {
400
  foreach ( $blogs as $blog ) {
450
  ON `meta`.`record_id` = `stream`.`ID`
451
  WHERE `stream`.`type` = %s
452
  $where;",
453
+ 'stream'
 
454
  )
455
  );
456
  }
includes/connector.php CHANGED
@@ -54,57 +54,58 @@ abstract class MainWP_WP_Stream_Connector {
54
 
55
  $created_timestamp = null;
56
 
57
- if (is_array($contexts) && is_array($args)) {
58
-
59
- if (isset($contexts['plugins']) && !empty($contexts['plugins']) ) {
60
- if (isset($args['slug']) && ( $args['slug'] == 'mainwp-child/mainwp-child.php' || $args['slug'] == 'mainwp-child-reports/mainwp-child-reports.php' )) {
61
- $hide_child_plugins = get_option('mainwp_creport_hide_child_plugins', 'yes');
62
- if ($hide_child_plugins == 'yes') {
63
- return false;
 
 
 
 
64
  } else {
65
- $branding_text = MainWP_WP_Stream_Admin::get_branding_title();
66
- if (!empty($branding_text)) {
67
- if ($args['slug'] == 'mainwp-child/mainwp-child.php') {
68
- $args['name'] = $branding_text;
69
- } else {
70
- $args['name'] = $branding_text . ' Reports';
71
- }
72
- }
73
  }
74
  }
75
  }
76
-
77
- $created_timestamp = 0;
78
- $child_context = '';
79
-
80
- if ( isset($contexts['backwpup_backups']) ) {
81
- $child_context = 'backwpup_backups';
82
- } elseif ( isset($contexts['backupwordpress_backups']) ) {
83
- $child_context = 'backupwordpress_backups';
84
- } elseif ( isset($contexts['backupbuddy_backups']) ) {
85
- $child_context = 'backupbuddy_backups';
86
- } elseif ( isset($contexts['wordfence_scans']) ) {
87
- $child_context = 'wordfence_scans';
88
- }
89
-
90
- if ( !empty($child_context) ) {
91
- if (is_array($args)) {
92
- if (isset($args['backup_time'])) {
93
- $created_timestamp = $args['backup_time'];
94
- } else if (isset($args['scan_time'])) {
95
- $created_timestamp = $args['scan_time'];
96
- }
97
- }
98
-
99
- if (empty($created_timestamp) )
100
- return;
101
-
102
- $saved_item = MainWP_WP_Stream_Log::get_instance()->get_log( array( 'context' => $child_context, 'created' => date("Y-m-d H:i:s", $created_timestamp ) ) );
103
-
104
- if ($saved_item)
105
- return;
106
  }
107
  }
 
 
 
 
 
 
 
 
 
 
108
 
109
  $class = get_called_class();
110
 
54
 
55
  $created_timestamp = null;
56
 
57
+ if (is_array($contexts) && is_array($args)) {
58
+ if (isset($contexts['plugins']) && !empty($contexts['plugins']) ) {
59
+ if (isset($args['slug']) && ( $args['slug'] == 'mainwp-child/mainwp-child.php' || $args['slug'] == 'mainwp-child-reports/mainwp-child-reports.php' )) {
60
+ $hide_child_plugins = get_option('mainwp_creport_hide_child_plugins', 'yes');
61
+ if ($hide_child_plugins == 'yes') {
62
+ return false;
63
+ } else {
64
+ $branding_text = MainWP_WP_Stream_Admin::get_branding_title();
65
+ if (!empty($branding_text)) {
66
+ if ($args['slug'] == 'mainwp-child/mainwp-child.php') {
67
+ $args['name'] = $branding_text;
68
  } else {
69
+ $args['name'] = $branding_text . ' Reports';
 
 
 
 
 
 
 
70
  }
71
  }
72
  }
73
+ }
74
+ }
75
+
76
+ $created_timestamp = 0;
77
+ $child_context = '';
78
+
79
+ if ( isset($contexts['backwpup_backups']) ) {
80
+ $child_context = 'backwpup_backups';
81
+ } elseif ( isset($contexts['backupwordpress_backups']) ) {
82
+ $child_context = 'backupwordpress_backups';
83
+ } elseif ( isset($contexts['backupbuddy_backups']) ) {
84
+ $child_context = 'backupbuddy_backups';
85
+ } elseif ( isset($contexts['wordfence_scans']) ) {
86
+ $child_context = 'wordfence_scans';
87
+ } elseif ( isset($contexts['updraftplus_backups']) ) {
88
+ $child_context = 'updraftplus_backups';
89
+ }
90
+
91
+ if ( !empty($child_context) ) {
92
+ if (is_array($args)) {
93
+ if (isset($args['backup_time'])) {
94
+ $created_timestamp = $args['backup_time'];
95
+ } else if (isset($args['scan_time'])) {
96
+ $created_timestamp = $args['scan_time'];
 
 
 
 
 
 
97
  }
98
  }
99
+
100
+ if (empty($created_timestamp) )
101
+ return;
102
+
103
+ $saved_item = MainWP_WP_Stream_Log::get_instance()->get_log( array( 'context' => $child_context, 'created' => date("Y-m-d H:i:s", $created_timestamp ) ) );
104
+
105
+ if ($saved_item)
106
+ return;
107
+ }
108
+ }
109
 
110
  $class = get_called_class();
111
 
includes/connectors.php CHANGED
@@ -29,9 +29,9 @@ class MainWP_WP_Stream_Connectors {
29
  'updraftplus',
30
  'backupwordpress',
31
  'backwpup',
32
- 'backupbuddy',
33
- 'wordfence',
34
- 'maintenance',
35
  );
36
  $classes = array();
37
  foreach ( $connectors as $connector ) {
29
  'updraftplus',
30
  'backupwordpress',
31
  'backwpup',
32
+ 'backupbuddy',
33
+ 'wordfence',
34
+ 'maintenance'
35
  );
36
  $classes = array();
37
  foreach ( $connectors as $connector ) {
includes/context-query.php CHANGED
@@ -100,7 +100,7 @@ class MainWP_WP_Stream_Context_Query {
100
  }
101
  $compare_string = '(' . substr( str_repeat( ',%s', count( $value ) ), 1 ) . ')';
102
  } elseif ( 'LIKE' === substr( $compare, -4 ) ) {
103
- $value = '%' . like_escape( $value ) . '%';
104
  $compare_string = '%s';
105
  } else {
106
  $compare_string = '%s';
100
  }
101
  $compare_string = '(' . substr( str_repeat( ',%s', count( $value ) ), 1 ) . ')';
102
  } elseif ( 'LIKE' === substr( $compare, -4 ) ) {
103
+ $value = '%' . $wpdb->esc_like( $value ) . '%';
104
  $compare_string = '%s';
105
  } else {
106
  $compare_string = '%s';
includes/list-table.php CHANGED
@@ -182,12 +182,8 @@ class MainWP_WP_Stream_List_Table extends WP_List_Table {
182
  $out = $this->column_link( $date_string, 'date', get_date_from_gmt( $created, 'Y/m/d' ) );
183
  $out .= '<br />';
184
  $out .= get_date_from_gmt( $created, 'h:i:s A' );
185
- $out .= '<span class="timestamp" timestamp="' . strtotime( $item->created ) . '"></span>';
186
-
187
-
188
-
189
  break;
190
-
191
  case 'summary' :
192
  $out = $item->summary;
193
  if ( $item->object_id ) {
182
  $out = $this->column_link( $date_string, 'date', get_date_from_gmt( $created, 'Y/m/d' ) );
183
  $out .= '<br />';
184
  $out .= get_date_from_gmt( $created, 'h:i:s A' );
185
+ $out .= '<span class="timestamp" timestamp="' . strtotime( $item->created ) . '"></span>';
 
 
 
186
  break;
 
187
  case 'summary' :
188
  $out = $item->summary;
189
  if ( $item->object_id ) {
includes/network.php CHANGED
@@ -309,7 +309,7 @@ class MainWP_WP_Stream_Network {
309
  );
310
 
311
  // add all sites
312
- foreach ( (array) wp_get_sites() as $blog ) {
313
  $blog_data = get_blog_details( $blog );
314
 
315
  $blogs[ $blog['blog_id'] ] = array(
309
  );
310
 
311
  // add all sites
312
+ foreach ( (array) get_sites() as $blog ) {
313
  $blog_data = get_blog_details( $blog );
314
 
315
  $blogs[ $blog['blog_id'] ] = array(
includes/query.php CHANGED
@@ -142,24 +142,20 @@ class MainWP_WP_Stream_Query {
142
  * PARSE DATE FILTERS
143
  */
144
  if ( isset( $args['date'] ) && !empty( $args['date'] ) ) {
145
- $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date'] ) ) );
146
- //$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) = %s", $date );
147
- $where .= " AND (DATE($wpdb->mainwp_reports.created) = STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
148
  } else {
149
  if ( isset($args['date_from']) && !empty($args['date_from']) ) {
150
- $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_from'] ) ) );
151
- //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $date );
152
- $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
153
  }
154
  if ( isset($args['date_to']) && !empty($args['date_to']) ) {
155
- $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_to'] ) ) );
156
- //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created <= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $date );
157
- $where .= " AND ($wpdb->mainwp_reports.created <= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
158
  }
159
- if ( isset($args['datetime_from']) && !empty($args['datetime_from']) ) {
160
- $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['datetime_from'] ) ) );
161
- //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $args['datetime_from'] );
162
- $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
163
  }
164
  }
165
 
@@ -171,9 +167,8 @@ class MainWP_WP_Stream_Query {
171
  }
172
 
173
  if ( $args['created_greater_than'] ) {
174
- $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['created_greater_than'] ) ) );
175
- //$where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.created > %s", date('Y-m-d H:i:s', $args['created_greater_than'] ) );
176
- $where .= " AND ($wpdb->mainwp_reports.created > STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
177
  }
178
 
179
  if ( $args['record__in'] ) {
142
  * PARSE DATE FILTERS
143
  */
144
  if ( isset( $args['date'] ) && !empty( $args['date'] ) ) {
145
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date'] ) ) );
146
+ $where .= " AND (DATE($wpdb->mainwp_reports.created) = STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
 
147
  } else {
148
  if ( isset($args['date_from']) && !empty($args['date_from']) ) {
149
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_from'] ) ) );
150
+ $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
 
151
  }
152
  if ( isset($args['date_to']) && !empty($args['date_to']) ) {
153
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_to'] ) ) );
154
+ $where .= " AND ($wpdb->mainwp_reports.created <= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
 
155
  }
156
+ if ( isset($args['datetime_from']) && !empty($args['datetime_from']) ) {
157
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['datetime_from'] ) ) );
158
+ $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
 
159
  }
160
  }
161
 
167
  }
168
 
169
  if ( $args['created_greater_than'] ) {
170
+ $date = date( 'Y-m-d H:i:s', $args['created_greater_than'] );
171
+ $where .= " AND ($wpdb->mainwp_reports.created > STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
 
172
  }
173
 
174
  if ( $args['record__in'] ) {
includes/settings.php CHANGED
@@ -134,7 +134,7 @@ class MainWP_WP_Stream_Settings {
134
  ORDER BY inet_aton(`ip`) ASC
135
  LIMIT %d;
136
  ",
137
- like_escape( $_POST['find'] ) . '%',
138
  $_POST['limit']
139
  )
140
  );
134
  ORDER BY inet_aton(`ip`) ASC
135
  LIMIT %d;
136
  ",
137
+ $wpdb->esc_like( $_POST['find'] ) . '%',
138
  $_POST['limit']
139
  )
140
  );
includes/vendor/Carbon.php CHANGED
@@ -650,7 +650,7 @@ class Carbon extends DateTime
650
  *
651
  * @return Carbon
652
  */
653
- public function setTime($hour, $minute, $second = 0)
654
  {
655
  return $this->hour($hour)->minute($minute)->second($second);
656
  }
650
  *
651
  * @return Carbon
652
  */
653
+ public function setTime($hour, $minute, $second = null, $microseconds = null)
654
  {
655
  return $this->hour($hour)->minute($minute)->second($second);
656
  }
mainwp-child-reports.php CHANGED
@@ -5,7 +5,7 @@
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
- Version: 1.7
9
  */
10
 
11
  /**
@@ -84,24 +84,24 @@ class MainWP_WP_Stream {
84
  require_once MAINWP_WP_STREAM_INC_DIR . 'context-query.php';
85
  $this->plugin_slug = plugin_basename( __FILE__ );
86
 
87
- require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
88
- add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Admin', 'load' ) );
89
 
90
 
91
- // Registers a hook that connectors and other plugins can use whenever a stream update happens
92
- add_action( 'admin_init', array( __CLASS__, 'update_activation_hook' ) );
93
 
94
- require_once MAINWP_WP_STREAM_INC_DIR . 'dashboard.php';
95
- add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Dashboard_Widget', 'load' ) );
96
 
97
- require_once MAINWP_WP_STREAM_INC_DIR . 'live-update.php';
98
- add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Live_Update', 'load' ) );
99
- add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
100
- // branding proccess
101
- $cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
102
- if ( !$cancelled_branding ) {
103
- add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
104
- }
105
 
106
  }
107
 
@@ -172,7 +172,7 @@ class MainWP_WP_Stream {
172
  }
173
  }
174
 
175
- static function update_activation_hook() {
176
  MainWP_WP_Stream_Admin::register_update_hook( dirname( plugin_basename( __FILE__ ) ), array( __CLASS__, 'install' ), self::VERSION );
177
  }
178
 
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
+ Version: 1.8
9
  */
10
 
11
  /**
84
  require_once MAINWP_WP_STREAM_INC_DIR . 'context-query.php';
85
  $this->plugin_slug = plugin_basename( __FILE__ );
86
 
87
+ require_once MAINWP_WP_STREAM_INC_DIR . 'admin.php';
88
+ add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Admin', 'load' ) );
89
 
90
 
91
+ // Registers a hook that connectors and other plugins can use whenever a stream update happens
92
+ add_action( 'admin_init', array( __CLASS__, 'update_activation_hook' ) );
93
 
94
+ require_once MAINWP_WP_STREAM_INC_DIR . 'dashboard.php';
95
+ add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Dashboard_Widget', 'load' ) );
96
 
97
+ require_once MAINWP_WP_STREAM_INC_DIR . 'live-update.php';
98
+ add_action( 'plugins_loaded', array( 'MainWP_WP_Stream_Live_Update', 'load' ) );
99
+ add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
100
+ // branding proccess
101
+ $cancelled_branding = ( get_option( 'mainwp_child_branding_disconnected' ) === 'yes' ) && ! get_option( 'mainwp_branding_preserve_branding' );
102
+ if ( !$cancelled_branding ) {
103
+ add_filter( 'all_plugins', array( $this, 'branding_child_plugin' ) );
104
+ }
105
 
106
  }
107
 
172
  }
173
  }
174
 
175
+ static function update_activation_hook() {
176
  MainWP_WP_Stream_Admin::register_update_hook( dirname( plugin_basename( __FILE__ ) ), array( __CLASS__, 'install' ), self::VERSION );
177
  }
178
 
readme.txt CHANGED
@@ -6,8 +6,8 @@ Author: mainwp
6
  Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
- Tested up to: 4.9
10
- Stable tag: 1.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -36,6 +36,12 @@ Credit to the [Stream Plugin](https://wordpress.org/plugins/stream/) which the M
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
 
39
  = 1.7 - 5-12-2017 =
40
  * Fixed: an issue with recording version numbers
41
  * Fixed: conflict with Select2 library
6
  Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
+ Tested up to: 4.9.8
10
+ Stable tag: 1.8
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.8 - 8-2-2018 =
40
+ * Fixed: an issue with logging plugin installations
41
+ * Fixed: an issue with displaying double records
42
+ * Fixed: multiple PHP Warnings
43
+ * Improved: support for UpdraftPlus backups
44
+
45
  = 1.7 - 5-12-2017 =
46
  * Fixed: an issue with recording version numbers
47
  * Fixed: conflict with Select2 library
ui/admin.js CHANGED
@@ -329,6 +329,11 @@ jQuery(function( $ ) {
329
  return;
330
  }
331
 
 
 
 
 
 
332
  var list_sel = '.mainwp_child_reports_wrap #the-list';
333
 
334
  // Set initial beat to fast. WP is designed to slow this to 15 seconds after 2.5 minutes.
329
  return;
330
  }
331
 
332
+ // Do not run if there are filters in use
333
+ if ( parseInt( mainwp_wp_stream.current_query_count, 10 ) > 1 ) {
334
+ return;
335
+ }
336
+
337
  var list_sel = '.mainwp_child_reports_wrap #the-list';
338
 
339
  // Set initial beat to fast. WP is designed to slow this to 15 seconds after 2.5 minutes.