Skip to content

Commit

Permalink
Merge 4.4.0 from develop to master (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrcho authored Feb 25, 2022
1 parent bf2929e commit 8c36d4b
Show file tree
Hide file tree
Showing 14 changed files with 868 additions and 29 deletions.
17 changes: 17 additions & 0 deletions classes/Upgrade/MetadataMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ class WSAL_Upgrade_MetadataMigration extends WSAL_Vendor\WP_Background_Process {
* Displays an admin notice if a metadata migration is in progress.
*/
public static function maybe_display_progress_admin_notice() {
if ( ! is_user_logged_in() ) {
// Don't show to anonymous users (obviously).
return;
}

$current_user = get_userdata( get_current_user_id() );
if ( false === $current_user ) {
// Bail if there is a problem retrieving the current user.
return;
}

$is_admin = in_array( 'administrator', $current_user->roles, true ) || ( function_exists( 'is_super_admin' ) && is_super_admin( $current_user->ID ) );
if ( ! $is_admin ) {
// Don't show to admin users.
return;
}

$plugin = WpSecurityAuditLog::GetInstance();
$existing_info = $plugin->GetGlobalSetting( self::OPTION_NAME_MIGRATION_INFO, array() );
if ( empty( $existing_info ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/Upgrade/Upgrade_43000_to_44400.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function remove_wfcm_leftover_settings() {
*
* @param string|array $connection Connection alias or configuration data.
*
* @throws Freemius_Exception
* @throws Freemius_Exception Freemius exception.
*/
private function upgrade_occurrence_table( $connection ) {
$connector = $this->plugin->getConnector( $connection );
Expand Down
29 changes: 22 additions & 7 deletions classes/Utilities/UserUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ public static function get_display_label( $plugin, $user ) {
}

if ( 'first_last_name' === self::$user_label_setting && ( ! empty( $user->first_name ) || ! empty( $user->last_name ) ) ) {
return trim( implode( ' ', [
$user->first_name,
$user->last_name
] ) );
return trim(
implode(
' ',
array(
$user->first_name,
$user->last_name,
)
)
);
}

return $user->user_login;
Expand Down Expand Up @@ -90,13 +95,23 @@ public static function get_tooltip_user_content( $user ) {
return '';
}

$tooltip = '<strong>' . esc_attr__( 'Username: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->user_login . '</br>';
$tooltip = '<strong>' . esc_attr__( 'Username: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->user_login . '</br>';
$tooltip .= ( ! empty( $user->data->first_name ) ) ? '<strong>' . esc_attr__( 'First name: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->first_name . '</br>' : '';
$tooltip .= ( ! empty( $user->data->first_name ) ) ? '<strong>' . esc_attr__( 'Last Name: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->first_name . '</br>' : '';
$tooltip .= '<strong>' . esc_attr__( 'Email: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->user_email . '</br>';
$tooltip .= '<strong>' . esc_attr__( 'Nickname: ', 'wp-security-audit-log' ) . '</strong>' . $user->data->user_nicename . '</br></br>';

$additional_content = apply_filters( 'wsal_additional_user_tooltip_content', false );
/**
* WSAL Filter: `wsal_additional_user_tooltip_content'
*
* Allows 3rd parties to append HTML to the user tooltip content in audit log viewer.
*
* @since 4.4.0
*
* @param string $content Blank string to append to.
* @param object $user - User object.
*/
$additional_content = apply_filters( 'wsal_additional_user_tooltip_content', '', $user );

$tooltip .= $additional_content;

Expand Down Expand Up @@ -155,4 +170,4 @@ public static function get_roles_label( $roles ) {
return '<i>' . esc_html__( 'Unknown', 'wp-security-audit-log' ) . '</i>';

}
}
}
18 changes: 9 additions & 9 deletions languages/wp-security-audit-log.pot
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ msgid "Message:"
msgstr ""

#: classes/AuditLogGridView.php:401 classes/AuditLogGridView.php:405
#: classes/AuditLogListView.php:413 classes/Utilities/UserUtils.php:155
#: classes/AuditLogListView.php:413 classes/Utilities/UserUtils.php:170
msgid "Unknown"
msgstr ""

Expand Down Expand Up @@ -606,11 +606,11 @@ msgstr ""
msgid "Keep a record of when someone adds, modifies or deletes forms, entries and more in the Gravity Forms plugin."
msgstr ""

#: classes/Upgrade/MetadataMigration.php:48
#: classes/Upgrade/MetadataMigration.php:65
msgid "Activity log database update in progress."
msgstr ""

#: classes/Upgrade/MetadataMigration.php:50
#: classes/Upgrade/MetadataMigration.php:67
msgid "WP Activity Log is updating the database tables where it stores the activity log. This is needed to upgrade the activity log tables to the new database schema, so the logs can be stored and read more efficiently. The duration of this process varies, depending on the number of events in the activity log. This process runs in the background and won't affect your website. During the upgrade, you might notice some \"null\" values in the activity log. This is temporary until the process is complete."
msgstr ""

Expand Down Expand Up @@ -657,23 +657,23 @@ msgstr ""
msgid "Tried to install a zip or slug that was not in the allowed list"
msgstr ""

#: classes/Utilities/UserUtils.php:93
#: classes/Utilities/UserUtils.php:98
msgid "Username: "
msgstr ""

#: classes/Utilities/UserUtils.php:94
#: classes/Utilities/UserUtils.php:99
msgid "First name: "
msgstr ""

#: classes/Utilities/UserUtils.php:95
#: classes/Utilities/UserUtils.php:100
msgid "Last Name: "
msgstr ""

#: classes/Utilities/UserUtils.php:96
#: classes/Utilities/UserUtils.php:101
msgid "Email: "
msgstr ""

#: classes/Utilities/UserUtils.php:97
#: classes/Utilities/UserUtils.php:102
msgid "Nickname: "
msgstr ""

Expand Down Expand Up @@ -5011,7 +5011,7 @@ msgstr ""
msgid "Dummy"
msgstr ""

#: third-party/vendor/classes/wp-background-process.php:371
#: third-party/vendor/deliciousbrains/wp-background-processing/classes/wp-background-process.php:371
#, php-format
msgid "Every %d Minutes"
msgstr ""
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ Release notes: [New Reports engine with more criteria, reports management & more
* Updated the "Help & Contact Us" page; improved text and added more relevant information.
* Improved several UI sections in the Third Party Connections module.
* Improved the check for writing activity log to external database; now it is less restrictive and faster.

* **Security fix**
* Upgraded the Freemius SDK to version 2.4.3.

* **Bug fixes**
* Fixed: Database error when trying to log in with a non-existing user and a login notification is enabled.
Expand Down
2 changes: 1 addition & 1 deletion third-party/vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitda871ac9d44d5000b1d72c074debffbb::getLoader();
return ComposerAutoloaderInit23aaeb6864f7a0ba3de7e8f407e351c7::getLoader();
5 changes: 3 additions & 2 deletions third-party/vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$baseDir = dirname($vendorDir);

return array(
'WSAL_Vendor\\WP_Async_Request' => $vendorDir . '/classes/wp-async-request.php',
'WSAL_Vendor\\WP_Background_Process' => $vendorDir . '/classes/wp-background-process.php',
'WSAL_Vendor\\MirazMac\\Requirements\\Checker' => $vendorDir . '/mirazmac/php-requirements-checker/src/Checker.php',
'WSAL_Vendor\\WP_Async_Request' => $vendorDir . '/deliciousbrains/wp-background-processing/classes/wp-async-request.php',
'WSAL_Vendor\\WP_Background_Process' => $vendorDir . '/deliciousbrains/wp-background-processing/classes/wp-background-process.php',
);
8 changes: 4 additions & 4 deletions third-party/vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitda871ac9d44d5000b1d72c074debffbb
class ComposerAutoloaderInit23aaeb6864f7a0ba3de7e8f407e351c7
{
private static $loader;

Expand All @@ -22,15 +22,15 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitda871ac9d44d5000b1d72c074debffbb', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit23aaeb6864f7a0ba3de7e8f407e351c7', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitda871ac9d44d5000b1d72c074debffbb', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit23aaeb6864f7a0ba3de7e8f407e351c7', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInitda871ac9d44d5000b1d72c074debffbb::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit23aaeb6864f7a0ba3de7e8f407e351c7::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
Expand Down
10 changes: 5 additions & 5 deletions third-party/vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

namespace Composer\Autoload;

class ComposerStaticInitda871ac9d44d5000b1d72c074debffbb
class ComposerStaticInit23aaeb6864f7a0ba3de7e8f407e351c7
{
public static $classMap = array (
'WSAL_Vendor\\WP_Async_Request' => __DIR__ . '/..' . '/classes/wp-async-request.php',
'WSAL_Vendor\\WP_Background_Process' => __DIR__ . '/..' . '/classes/wp-background-process.php',
'WSAL_Vendor\\MirazMac\\Requirements\\Checker' => __DIR__ . '/..' . '/mirazmac/php-requirements-checker/src/Checker.php',
'WSAL_Vendor\\WP_Async_Request' => __DIR__ . '/..' . '/deliciousbrains/wp-background-processing/classes/wp-async-request.php',
'WSAL_Vendor\\WP_Background_Process' => __DIR__ . '/..' . '/deliciousbrains/wp-background-processing/classes/wp-background-process.php',
);

public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInitda871ac9d44d5000b1d72c074debffbb::$classMap;

$loader->classMap = ComposerStaticInit23aaeb6864f7a0ba3de7e8f407e351c7::$classMap;
}, null, ClassLoader::class);
}
}
Loading

0 comments on commit 8c36d4b

Please sign in to comment.