Simple History - Version 2.2.2

Version Description

(September 2015) =

  • Fixed: Logging stopped working for languages other then English. Sorry about that!

  • Fixed: When running unit tests for a site where Simple History is a must use plugin it sometimes tried to create tables and add columns more then once. Now uses if not exists and similar to only try to create the tables if they not already exists.

Download this release

Release Info

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

Code changes from version 2.2.1 to 2.2.2

Files changed (3) hide show
  1. inc/SimpleHistory.php +31 -32
  2. index.php +2 -2
  3. readme.txt +7 -1
inc/SimpleHistory.php CHANGED
@@ -743,6 +743,29 @@ class SimpleHistory {
743
 
744
  $loggerInfo = $loggerInstance->getInfo();
745
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  // Un-tell gettext filter
747
  $this->doFilterGettext = false;
748
  $this->doFilterGettext_currentLogger = null;
@@ -752,8 +775,8 @@ class SimpleHistory {
752
  $loopNum = 0;
753
 
754
  $arr_messages_by_message_key = array();
755
-
756
- foreach ( $loggerInfo["messages"] as $message_key => $message_untranslated ) {
757
 
758
  // Find message in array with both translated and non translated strings
759
  foreach ( $loggerInstance->messages as $one_message_with_translation_info ) {
@@ -767,7 +790,7 @@ class SimpleHistory {
767
  [context] => ...
768
  )
769
  */
770
- if ( $message_untranslated == $one_message_with_translation_info["untranslated_text"] ) {
771
  $arr_messages_by_message_key[ $message_key ] = $one_message_with_translation_info;
772
  continue;
773
  }
@@ -777,31 +800,7 @@ class SimpleHistory {
777
  }
778
 
779
  $loggerInstance->messages = $arr_messages_by_message_key;
780
-
781
- /*if ( is_array( $loggerInfo["messages"] ) ) {
782
-
783
- foreach ( $loggerInfo["messages"] as $message_key => $message ) {
784
-
785
- $loggerInstance->messages[$message_key] = $loggerInstance->messages[$loopNum];
786
- $loopNum++;
787
-
788
- }
789
- }
790
-
791
- // Remove index keys, only keeping slug keys
792
- if ( is_array( $loggerInstance->messages ) ) {
793
-
794
- foreach ( $loggerInstance->messages as $key => $val ) {
795
-
796
- if ( is_int( $key ) ) {
797
- unset( $loggerInstance->messages[$key] );
798
- }
799
-
800
- }
801
-
802
- }
803
- */
804
-
805
  // Add logger to array of loggers
806
  $this->instantiatedLoggers[$loggerInstance->slug] = array(
807
  "name" => $loggerInfo["name"],
@@ -1122,7 +1121,7 @@ class SimpleHistory {
1122
 
1123
  // We change the varchar size to add one num just to force update of encoding. dbdelta didn't see it otherwise.
1124
  // This table is missing action_description, but we add that later on
1125
- $sql = "CREATE TABLE " . $table_name . " (
1126
  id bigint(20) NOT NULL AUTO_INCREMENT,
1127
  date datetime NOT NULL,
1128
  action VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
@@ -1157,7 +1156,7 @@ class SimpleHistory {
1157
  if ( 1 == intval( $db_version ) ) {
1158
 
1159
  // Add column for action description in non-translatable free text
1160
- $sql = "ALTER TABLE {$table_name} ADD COLUMN action_description longtext";
1161
  $wpdb->query( $sql );
1162
 
1163
  $db_version_prev = $db_version;
@@ -1203,7 +1202,7 @@ class SimpleHistory {
1203
 
1204
  // Update old table
1205
  $sql = "
1206
- CREATE TABLE {$table_name} (
1207
  id bigint(20) NOT NULL AUTO_INCREMENT,
1208
  date datetime NOT NULL,
1209
  logger varchar(30) DEFAULT NULL,
@@ -1228,7 +1227,7 @@ class SimpleHistory {
1228
 
1229
  // Add context table
1230
  $sql = "
1231
- CREATE TABLE {$table_name_contexts} (
1232
  context_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1233
  history_id bigint(20) unsigned NOT NULL,
1234
  `key` varchar(255) DEFAULT NULL,
743
 
744
  $loggerInfo = $loggerInstance->getInfo();
745
 
746
+ /*
747
+ $loggerInfo["messages"]
748
+ [messages] => Array
749
+ (
750
+ [anon_comment_added] => Lade till en kommentar till {comment_post_type} "{comment_post_title}"
751
+ [user_comment_added] => Lade till en kommentar till {comment_post_type} "{comment_post_title}"
752
+ [comment_status_approve] => Godkände en kommentar till "{comment_post_title}" av {comment_author} ({comment_author_email})
753
+ [comment_status_hold] => Godkände inte en kommentar till "{comment_post_title}" av {comment_author} ({comment_author_email})
754
+ */
755
+
756
+ /*
757
+ $loggerInstance->messages
758
+ Array
759
+ (
760
+ [0] => Array
761
+ (
762
+ [untranslated_text] => Added a comment to {comment_post_type} "{comment_post_title}"
763
+ [translated_text] => Lade till en kommentar till {comment_post_type} "{comment_post_title}"
764
+ [domain] => simple-history
765
+ [context] => A comment was added to the database by a non-logged in internet user
766
+ )
767
+ */
768
+
769
  // Un-tell gettext filter
770
  $this->doFilterGettext = false;
771
  $this->doFilterGettext_currentLogger = null;
775
  $loopNum = 0;
776
 
777
  $arr_messages_by_message_key = array();
778
+
779
+ foreach ( $loggerInfo["messages"] as $message_key => $message_translated ) {
780
 
781
  // Find message in array with both translated and non translated strings
782
  foreach ( $loggerInstance->messages as $one_message_with_translation_info ) {
790
  [context] => ...
791
  )
792
  */
793
+ if ( $message_translated == $one_message_with_translation_info["translated_text"] ) {
794
  $arr_messages_by_message_key[ $message_key ] = $one_message_with_translation_info;
795
  continue;
796
  }
800
  }
801
 
802
  $loggerInstance->messages = $arr_messages_by_message_key;
803
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
  // Add logger to array of loggers
805
  $this->instantiatedLoggers[$loggerInstance->slug] = array(
806
  "name" => $loggerInfo["name"],
1121
 
1122
  // We change the varchar size to add one num just to force update of encoding. dbdelta didn't see it otherwise.
1123
  // This table is missing action_description, but we add that later on
1124
+ $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (
1125
  id bigint(20) NOT NULL AUTO_INCREMENT,
1126
  date datetime NOT NULL,
1127
  action VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
1156
  if ( 1 == intval( $db_version ) ) {
1157
 
1158
  // Add column for action description in non-translatable free text
1159
+ $sql = "ALTER TABLE {$table_name} ADD COLUMN IF NOT EXISTS action_description longtext";
1160
  $wpdb->query( $sql );
1161
 
1162
  $db_version_prev = $db_version;
1202
 
1203
  // Update old table
1204
  $sql = "
1205
+ CREATE TABLE IF NOT EXISTS {$table_name} (
1206
  id bigint(20) NOT NULL AUTO_INCREMENT,
1207
  date datetime NOT NULL,
1208
  logger varchar(30) DEFAULT NULL,
1227
 
1228
  // Add context table
1229
  $sql = "
1230
+ CREATE TABLE IF NOT EXISTS {$table_name_contexts} (
1231
  context_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1232
  history_id bigint(20) unsigned NOT NULL,
1233
  `key` varchar(255) DEFAULT NULL,
index.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://simple-history.com
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.2.1
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
@@ -46,7 +46,7 @@ if ( version_compare( phpversion(), "5.3", ">=") ) {
46
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
49
- define( 'SIMPLE_HISTORY_VERSION', '2.2.1' );
50
  }
51
 
52
  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.2.2
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
46
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
49
+ define( 'SIMPLE_HISTORY_VERSION', '2.2.2' );
50
  }
51
 
52
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 3.6.0
6
  Tested up to: 4.3
7
- Stable tag: 2.2
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -119,6 +119,12 @@ initiated by a specific user.
119
 
120
  ## Changelog
121
 
 
 
 
 
 
 
122
  = 2.2.1 (September 2015) =
123
 
124
  - Fixed: Missed to log users switching back on using the User Switching plugin. Fixes https://github.com/bonny/WordPress-Simple-History/issues/89.
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 3.6.0
6
  Tested up to: 4.3
7
+ Stable tag: 2.2.2
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
119
 
120
  ## Changelog
121
 
122
+ = 2.2.2 (September 2015) =
123
+
124
+ - Fixed: Logging stopped working for languages other then English. Sorry about that!
125
+
126
+ - Fixed: When running unit tests for a site where Simple History is a must use plugin it sometimes tried to create tables and add columns more then once. Now uses `if not exists` and similar to only try to create the tables if they not already exists.
127
+
128
  = 2.2.1 (September 2015) =
129
 
130
  - Fixed: Missed to log users switching back on using the User Switching plugin. Fixes https://github.com/bonny/WordPress-Simple-History/issues/89.