Simple History - Version 2.25

Version Description

(July 2018) = - Add wp_cron_current_filter to event context when something is logged during a cron job. This can help debugging thing like posts being added or deleted by some plugin and you're trying to figure out which plugin it is. - Fix for event details not always being shown. - Fix for sometimes missing user name and user email in export file.

Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 2.25
Comparing to
See all releases

Code changes from version 2.24 to 2.25

composer.json CHANGED
@@ -13,7 +13,7 @@
13
  "require": {
14
  "php": ">=5.3.0"
15
  },
16
- "version": "2.24",
17
  "authors": [
18
  {
19
  "name": "Pär Thernström",
@@ -23,7 +23,7 @@
23
  }
24
  ],
25
  "dist": {
26
- "url": "https://downloads.wordpress.org/plugin/simple-history.2.21.zip",
27
  "type": "zip"
28
  }
29
  }
13
  "require": {
14
  "php": ">=5.3.0"
15
  },
16
+ "version": "2.25",
17
  "authors": [
18
  {
19
  "name": "Pär Thernström",
23
  }
24
  ],
25
  "dist": {
26
+ "url": "https://downloads.wordpress.org/plugin/simple-history.2.25.zip",
27
  "type": "zip"
28
  }
29
  }
dropins/SimpleHistoryExportDropin.php CHANGED
@@ -111,7 +111,7 @@ class SimpleHistoryExportDropin {
111
 
112
  }
113
 
114
- // Paginate through all pages and all their rows
115
  $row_loop = 0;
116
  while ( $page_current <= $pages_count + 1 ) {
117
 
@@ -128,8 +128,8 @@ class SimpleHistoryExportDropin {
128
 
129
  $message_output = strip_tags( html_entity_decode( $this->sh->getLogRowPlainTextOutput( $one_row ), ENT_QUOTES, 'UTF-8' ) );
130
 
131
- $user_email = empty( $one_row->context['user_email'] ) ? null : $one_row->context['user_email'];
132
- $user_login = empty( $one_row->context['user_login'] ) ? null : $one_row->context['user_login'];
133
 
134
  fputcsv($fp, array(
135
  $one_row->date,
@@ -146,7 +146,7 @@ class SimpleHistoryExportDropin {
146
 
147
  } elseif ( 'json' == $export_format ) {
148
 
149
- // If not first loop then add a comma between all json objects
150
  if ( $row_loop == 0 ) {
151
  $comma = "\n";
152
  } else {
111
 
112
  }
113
 
114
+ // Paginate through all pages and all their rows.
115
  $row_loop = 0;
116
  while ( $page_current <= $pages_count + 1 ) {
117
 
128
 
129
  $message_output = strip_tags( html_entity_decode( $this->sh->getLogRowPlainTextOutput( $one_row ), ENT_QUOTES, 'UTF-8' ) );
130
 
131
+ $user_email = empty( $one_row->context['_user_email'] ) ? null : $one_row->context['_user_email'];
132
+ $user_login = empty( $one_row->context['_user_login'] ) ? null : $one_row->context['_user_login'];
133
 
134
  fputcsv($fp, array(
135
  $one_row->date,
146
 
147
  } elseif ( 'json' == $export_format ) {
148
 
149
+ // If not first loop then add a comma between all json objects.
150
  if ( $row_loop == 0 ) {
151
  $comma = "\n";
152
  } else {
index.php CHANGED
@@ -5,7 +5,7 @@
5
  * Text Domain: simple-history
6
  * Domain Path: /languages
7
  * Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
- * Version: 2.24
9
  * Author: Pär Thernström
10
  * Author URI: http://simple-history.com/
11
  * License: GPL2
@@ -47,7 +47,7 @@ if ( $ok_php_version && $ok_wp_version ) {
47
  */
48
 
49
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
50
- define( 'SIMPLE_HISTORY_VERSION', '2.24' );
51
  }
52
 
53
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
5
  * Text Domain: simple-history
6
  * Domain Path: /languages
7
  * Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
+ * Version: 2.25
9
  * Author: Pär Thernström
10
  * Author URI: http://simple-history.com/
11
  * License: GPL2
47
  */
48
 
49
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
50
+ define( 'SIMPLE_HISTORY_VERSION', '2.25' );
51
  }
52
 
53
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
loggers/Plugin_ACF.php CHANGED
@@ -517,7 +517,7 @@ if ( ! class_exists( 'Plugin_ACF' ) ) {
517
 
518
  // Bail if not ACF Field Group.
519
  if ( $post_type !== 'acf-field-group' ) {
520
- return '';
521
  }
522
 
523
  // Field group fields to check for and output if found
517
 
518
  // Bail if not ACF Field Group.
519
  if ( $post_type !== 'acf-field-group' ) {
520
+ return $diff_table_output;
521
  }
522
 
523
  // Field group fields to check for and output if found
loggers/SimpleLogger.php CHANGED
@@ -1118,10 +1118,14 @@ class SimpleLogger {
1118
  // If cron then set WordPress as responsible
1119
  if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
1120
 
1121
- // Seems to be wp cron running and doing this
1122
  $data['initiator'] = SimpleLoggerLogInitiators::WORDPRESS;
1123
  $context['_wp_cron_running'] = true;
1124
 
 
 
 
 
1125
  }
1126
 
1127
  // If running as CLI and WP_CLI_PHP_USED is set then it is WP CLI that is doing it
@@ -1312,7 +1316,7 @@ class SimpleLogger {
1312
  } // log
1313
 
1314
  /**
1315
- * Append new info to the contextof history item with id $post_logger->lastInsertID..
1316
  *
1317
  * @param int $history_id The id of the history row to add context to.
1318
  * @param array $context Context to append to existing context for the row.
1118
  // If cron then set WordPress as responsible
1119
  if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
1120
 
1121
+ // Seems to be wp cron running and doing this.
1122
  $data['initiator'] = SimpleLoggerLogInitiators::WORDPRESS;
1123
  $context['_wp_cron_running'] = true;
1124
 
1125
+ // To aid debugging we log the current filter and a list of all filters.
1126
+ global $wp_current_filter;
1127
+ $context['_wp_cron_current_filter'] = current_filter();
1128
+
1129
  }
1130
 
1131
  // If running as CLI and WP_CLI_PHP_USED is set then it is WP CLI that is doing it
1316
  } // log
1317
 
1318
  /**
1319
+ * Append new info to the context of history item with id $post_logger->lastInsertID.
1320
  *
1321
  * @param int $history_id The id of the history row to add context to.
1322
  * @param array $context Context to append to existing context for the row.
loggers/SimplePostLogger.php CHANGED
@@ -445,6 +445,7 @@ class SimplePostLogger extends SimpleLogger {
445
  From pending to trash
446
  From something to publish = post published
447
  if not from & to = same, then user has changed something
 
448
  */
449
  $context = array(
450
  'post_id' => $post->ID,
@@ -825,7 +826,6 @@ class SimplePostLogger extends SimpleLogger {
825
 
826
  $post_old_value = $context[ $key ];
827
  $post_new_value = $context[ $key_for_new_val ];
828
-
829
  if ( $post_old_value != $post_new_value ) {
830
 
831
  // Different diffs for different keys.
@@ -855,7 +855,6 @@ class SimplePostLogger extends SimpleLogger {
855
  } elseif ( 'post_status' == $key_to_diff ) {
856
 
857
  $has_diff_values = true;
858
-
859
  $diff_table_output .= sprintf(
860
  '<tr>
861
  <td>%1$s</td>
445
  From pending to trash
446
  From something to publish = post published
447
  if not from & to = same, then user has changed something
448
+ From draft to publish in future: status = "future"
449
  */
450
  $context = array(
451
  'post_id' => $post->ID,
826
 
827
  $post_old_value = $context[ $key ];
828
  $post_new_value = $context[ $key_for_new_val ];
 
829
  if ( $post_old_value != $post_new_value ) {
830
 
831
  // Different diffs for different keys.
855
  } elseif ( 'post_status' == $key_to_diff ) {
856
 
857
  $has_diff_values = true;
 
858
  $diff_table_output .= sprintf(
859
  '<tr>
860
  <td>%1$s</td>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: history, log, changes, changelog, audit, trail, pages, attachments, users,
5
  Requires at least: 4.5.1
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
- Stable tag: 2.24
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11
 
@@ -167,6 +167,11 @@ A simple way to see any uncommon activity, for example an increased number of lo
167
 
168
  ## Changelog
169
 
 
 
 
 
 
170
  = 2.24 (July 2018) =
171
 
172
  - Added user login and user email to CSV export file.
5
  Requires at least: 4.5.1
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
+ Stable tag: 2.25
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11
 
167
 
168
  ## Changelog
169
 
170
+ = 2.25 (July 2018) =
171
+ - Add `wp_cron_current_filter` to event context when something is logged during a cron job. This can help debugging thing like posts being added or deleted by some plugin and you're trying to figure out which plugin it is.
172
+ - Fix for event details not always being shown.
173
+ - Fix for sometimes missing user name and user email in export file.
174
+
175
  = 2.24 (July 2018) =
176
 
177
  - Added user login and user email to CSV export file.