Version Description
(July 2018) =
- Added user login and user email to CSV export file.
- Fix notice in postlogger when a post was deleted from the trash.
- Clear database in smaller steps. Fixes https://github.com/bonny/WordPress-Simple-History/issues/143.
- Fix notice in ACF logger due to misspelled variable. Fixes https://wordpress.org/support/topic/problem-with-recent-version-and-acf/.
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 2.24 |
Comparing to | |
See all releases |
Code changes from version 2.23.1 to 2.24
- composer.json +1 -1
- dropins/SimpleHistoryExportDropin.php +5 -0
- inc/SimpleHistory.php +39 -37
- index.php +2 -2
- loggers/Plugin_ACF.php +1 -1
- loggers/SimplePostLogger.php +2 -0
- readme.txt +8 -1
composer.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
"require": {
|
14 |
"php": ">=5.3.0"
|
15 |
},
|
16 |
-
"version": "2.
|
17 |
"authors": [
|
18 |
{
|
19 |
"name": "Pär Thernström",
|
13 |
"require": {
|
14 |
"php": ">=5.3.0"
|
15 |
},
|
16 |
+
"version": "2.24",
|
17 |
"authors": [
|
18 |
{
|
19 |
"name": "Pär Thernström",
|
dropins/SimpleHistoryExportDropin.php
CHANGED
@@ -128,12 +128,17 @@ class SimpleHistoryExportDropin {
|
|
128 |
|
129 |
$message_output = strip_tags( html_entity_decode( $this->sh->getLogRowPlainTextOutput( $one_row ), ENT_QUOTES, 'UTF-8' ) );
|
130 |
|
|
|
|
|
|
|
131 |
fputcsv($fp, array(
|
132 |
$one_row->date,
|
133 |
$one_row->logger,
|
134 |
$one_row->level,
|
135 |
$one_row->initiator,
|
136 |
$one_row->context_message_key,
|
|
|
|
|
137 |
$header_output,
|
138 |
$message_output,
|
139 |
$one_row->subsequentOccasions,
|
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,
|
136 |
$one_row->logger,
|
137 |
$one_row->level,
|
138 |
$one_row->initiator,
|
139 |
$one_row->context_message_key,
|
140 |
+
$user_email,
|
141 |
+
$user_login,
|
142 |
$header_output,
|
143 |
$message_output,
|
144 |
$one_row->subsequentOccasions,
|
inc/SimpleHistory.php
CHANGED
@@ -2331,7 +2331,7 @@ Because Simple History was just recently installed, this feed does not contain m
|
|
2331 |
|
2332 |
$days = $this->get_clear_history_interval();
|
2333 |
|
2334 |
-
// Never clear log if days = 0
|
2335 |
if ( 0 == $days ) {
|
2336 |
return;
|
2337 |
}
|
@@ -2341,57 +2341,59 @@ Because Simple History was just recently installed, this feed does not contain m
|
|
2341 |
$table_name = $wpdb->prefix . SimpleHistory::DBTABLE;
|
2342 |
$table_name_contexts = $wpdb->prefix . SimpleHistory::DBTABLE_CONTEXTS;
|
2343 |
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
|
|
2349 |
|
2350 |
-
|
2351 |
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
|
2357 |
-
|
2358 |
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
|
2368 |
-
|
2369 |
-
|
2370 |
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
|
2387 |
-
|
|
|
2388 |
|
2389 |
}
|
2390 |
|
2391 |
/**
|
2392 |
* Return plain text output for a log row
|
2393 |
* Uses the getLogRowPlainTextOutput of the logger that logged the row
|
2394 |
-
* with fallback to SimpleLogger if logger is not available
|
2395 |
*
|
2396 |
* @param array $row
|
2397 |
* @return string
|
2331 |
|
2332 |
$days = $this->get_clear_history_interval();
|
2333 |
|
2334 |
+
// Never clear log if days = 0.
|
2335 |
if ( 0 == $days ) {
|
2336 |
return;
|
2337 |
}
|
2341 |
$table_name = $wpdb->prefix . SimpleHistory::DBTABLE;
|
2342 |
$table_name_contexts = $wpdb->prefix . SimpleHistory::DBTABLE_CONTEXTS;
|
2343 |
|
2344 |
+
while( 1 > 0 ) {
|
2345 |
+
// Get id of rows to delete.
|
2346 |
+
$sql = $wpdb->prepare(
|
2347 |
+
"SELECT id FROM $table_name WHERE DATE_ADD(date, INTERVAL %d DAY) < now() LIMIT 100000",
|
2348 |
+
$days
|
2349 |
+
);
|
2350 |
|
2351 |
+
$ids_to_delete = $wpdb->get_col( $sql );
|
2352 |
|
2353 |
+
if ( empty( $ids_to_delete ) ) {
|
2354 |
+
// Nothing to delete.
|
2355 |
+
return;
|
2356 |
+
}
|
2357 |
|
2358 |
+
$sql_ids_in = implode( ',', $ids_to_delete );
|
2359 |
|
2360 |
+
// Add number of deleted rows to total_rows option.
|
2361 |
+
$prev_total_rows = (int) get_option( 'simple_history_total_rows', 0 );
|
2362 |
+
$total_rows = $prev_total_rows + sizeof( $ids_to_delete );
|
2363 |
+
update_option( 'simple_history_total_rows', $total_rows );
|
2364 |
|
2365 |
+
// Remove rows + contexts.
|
2366 |
+
$sql_delete_history = "DELETE FROM {$table_name} WHERE id IN ($sql_ids_in)";
|
2367 |
+
$sql_delete_history_context = "DELETE FROM {$table_name_contexts} WHERE history_id IN ($sql_ids_in)";
|
2368 |
|
2369 |
+
$wpdb->query( $sql_delete_history );
|
2370 |
+
$wpdb->query( $sql_delete_history_context );
|
2371 |
|
2372 |
+
$message = _nx(
|
2373 |
+
'Simple History removed one event that were older than {days} days',
|
2374 |
+
'Simple History removed {num_rows} events that were older than {days} days',
|
2375 |
+
count( $ids_to_delete ),
|
2376 |
+
'Database is being cleared automagically',
|
2377 |
+
'simple-history'
|
2378 |
+
);
|
2379 |
|
2380 |
+
SimpleLogger()->info(
|
2381 |
+
$message,
|
2382 |
+
array(
|
2383 |
+
'days' => $days,
|
2384 |
+
'num_rows' => count( $ids_to_delete ),
|
2385 |
+
)
|
2386 |
+
);
|
2387 |
|
2388 |
+
$this->get_cache_incrementor( true );
|
2389 |
+
}
|
2390 |
|
2391 |
}
|
2392 |
|
2393 |
/**
|
2394 |
* Return plain text output for a log row
|
2395 |
* Uses the getLogRowPlainTextOutput of the logger that logged the row
|
2396 |
+
* with fallback to SimpleLogger if logger is not available.
|
2397 |
*
|
2398 |
* @param array $row
|
2399 |
* @return string
|
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.
|
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.
|
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.24
|
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.24' );
|
51 |
}
|
52 |
|
53 |
if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
|
loggers/Plugin_ACF.php
CHANGED
@@ -892,7 +892,7 @@ if ( ! class_exists( 'Plugin_ACF' ) ) {
|
|
892 |
|
893 |
foreach ( $arr_added_fields_keys_to_add as $one_key_to_add ) {
|
894 |
// Check that new and old exist.
|
895 |
-
$
|
896 |
$old_exists = isset( $modifiedFields['old'][ $modifiedFieldId ][ $one_key_to_add ] );
|
897 |
|
898 |
if ( ! $new_exists || ! $old_exists ) {
|
892 |
|
893 |
foreach ( $arr_added_fields_keys_to_add as $one_key_to_add ) {
|
894 |
// Check that new and old exist.
|
895 |
+
$new_exists = isset( $modifiedFields['new'][ $modifiedFieldId ][ $one_key_to_add ] );
|
896 |
$old_exists = isset( $modifiedFields['old'][ $modifiedFieldId ][ $one_key_to_add ] );
|
897 |
|
898 |
if ( ! $new_exists || ! $old_exists ) {
|
loggers/SimplePostLogger.php
CHANGED
@@ -290,6 +290,8 @@ class SimplePostLogger extends SimpleLogger {
|
|
290 |
return;
|
291 |
}
|
292 |
|
|
|
|
|
293 |
if ( ! $this->ok_to_log_post_posttype( $post ) ) {
|
294 |
$ok_to_log = false;
|
295 |
}
|
290 |
return;
|
291 |
}
|
292 |
|
293 |
+
$ok_to_log = true;
|
294 |
+
|
295 |
if ( ! $this->ok_to_log_post_posttype( $post ) ) {
|
296 |
$ok_to_log = false;
|
297 |
}
|
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.
|
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,13 @@ A simple way to see any uncommon activity, for example an increased number of lo
|
|
167 |
|
168 |
## Changelog
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
= 2.23.1 (May 2018) =
|
171 |
|
172 |
- Remove some debug messages that was outputed to the error log. Fixes https://wordpress.org/support/topic/errors-in-php-log-since-v2-23/.
|
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 |
|
168 |
## Changelog
|
169 |
|
170 |
+
= 2.24 (July 2018) =
|
171 |
+
|
172 |
+
- Added user login and user email to CSV export file.
|
173 |
+
- Fix notice in postlogger when a post was deleted from the trash.
|
174 |
+
- Clear database in smaller steps. Fixes https://github.com/bonny/WordPress-Simple-History/issues/143.
|
175 |
+
- Fix notice in ACF logger due to misspelled variable. Fixes https://wordpress.org/support/topic/problem-with-recent-version-and-acf/.
|
176 |
+
|
177 |
= 2.23.1 (May 2018) =
|
178 |
|
179 |
- Remove some debug messages that was outputed to the error log. Fixes https://wordpress.org/support/topic/errors-in-php-log-since-v2-23/.
|