Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f25ed2e
Changed: the activity log records changes to the permalink structure …
barrykooij Oct 16, 2026
a438e42
Added: failed plugin and theme updates and failed automatic WordPress…
barrykooij Oct 16, 2026
85c6213
Added: plugin and theme installs and deletions and theme switches in …
barrykooij Oct 16, 2026
618a0eb
Added: new users, deleted users, role changes and changes to key sett…
barrykooij Oct 16, 2026
d536de0
Fixed: activity log sign-up, actor name and search engine visibility …
barrykooij Oct 16, 2026
ac53aa3
Fixed: server paths in failed update errors, HTML-encoded site and th…
barrykooij Oct 16, 2026
3cf3d77
Merge branch 'feat/activity-log-improvements' into dev
barrykooij Oct 16, 2026
4367fc5
Fixed: subscriptions created by WooCommerce checkout tests could not …
barrykooij Oct 17, 2026
e81eb25
Fixed: WooCommerce checkout test requests no longer run the shop's cr…
barrykooij Oct 17, 2026
e018b9c
Fixed: subscriptions created by WooCommerce checkout tests were cance…
barrykooij Oct 17, 2026
11bd62b
Added: logins of accounts with elevated rights in the activity log, w…
barrykooij Oct 17, 2026
f375f61
Merge branch 'feat/activity-user-logins' into dev
barrykooij Oct 17, 2026
568de28
Added: new application passwords of accounts with elevated rights in …
barrykooij Oct 17, 2026
8251f21
Added: revoked application passwords of accounts with elevated rights…
barrykooij Oct 17, 2026
0f3ce5a
Added: the first use of an application password of an account with el…
barrykooij Oct 17, 2026
c8899ca
Added: password changes of accounts with elevated rights in the activ…
barrykooij Oct 17, 2026
b03ee3e
Added: email address changes of accounts with elevated rights in the …
barrykooij Oct 17, 2026
142b0e9
Added: super admin rights granted or revoked on multisite networks in…
barrykooij Oct 17, 2026
48b335e
Merge branch 'feat/activity-account-security' into dev
barrykooij Oct 17, 2026
5f80d8c
Added: post activity events report what changed (title, slug, URL, a …
barrykooij Oct 17, 2026
fd56cdc
Fixed: SEOPress 404 records no longer show in the activity log as sav…
barrykooij Oct 17, 2026
99961f3
Added: the activity log reports posts deleted permanently and categor…
barrykooij Oct 17, 2026
17f25c8
Added: the activity log reports media library changes: uploads, chang…
barrykooij Oct 17, 2026
4550007
Added: the activity log reports every setting of the General, Writing…
barrykooij Oct 18, 2026
a256a09
Added: the activity log reports navigation menus created, changed and…
barrykooij Oct 18, 2026
99ea56f
Fixed: the first time a menu is set to add new top-level pages by its…
barrykooij Oct 18, 2026
ba02137
Fixed: widgets moved or removed without a change to their settings ar…
barrykooij Oct 18, 2026
d931d9f
Fixed: a media change whose file someone else deleted before the minu…
barrykooij Oct 18, 2026
3a26011
Fixed: update services changed while the site discourages search engi…
barrykooij Oct 18, 2026
7f9b59f
Added: failed logins are counted per hour, by reason, by the way in a…
barrykooij Oct 19, 2026
b1d03ff
Added: the site data sync sends the must-use plugins, their folders a…
barrykooij Oct 19, 2026
e3d71f4
Added: the activity log reports files changed in the plugin and theme…
barrykooij Oct 19, 2026
e64507e
Added: the activity log reports theme settings changed in the Customi…
barrykooij Oct 19, 2026
a69a9af
Added: the activity log reports Site Editor changes of block themes: …
barrykooij Oct 19, 2026
bda7c2d
Changed: version 1.9.0
barrykooij Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://scanfully.com
Tags: monitoring, site health, broken links, broken media, activity log
Requires at least: 6.0
Tested up to: 7.1.0
Stable tag: 1.8.1
Stable tag: 1.9.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Requires PHP: 7.4
Expand Down
4 changes: 2 additions & 2 deletions scanfully.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* @wordpress-plugin
* Plugin Name: Scanfully
* Version: 1.8.1
* Version: 1.9.0
* Plugin URI: https://scanfully.com/wp-plugin
* Description: Scanfully is your favorite WordPress performance and health monitoring tool.
* Author: Scanfully
Expand Down Expand Up @@ -68,7 +68,7 @@ function Scanfully(): \Scanfully\Main { // phpcs:ignore WordPress.NamingConventi
function () {
// meta.
define( 'SCANFULLY_PLUGIN_FILE', __FILE__ );
define( 'SCANFULLY_VERSION', '1.8.1' );
define( 'SCANFULLY_VERSION', '1.9.0' );

// boot.
require __DIR__ . '/vendor/autoload.php';
Expand Down
50 changes: 50 additions & 0 deletions src/API/FailedLoginsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* The failed logins request class file.
*
* @package Scanfully
*/

namespace Scanfully\API;

use Scanfully\Main;
use Scanfully\Options\Controller as OptionsController;

/**
* Sends the hourly counts of failed logins to the Scanfully API.
*/
class FailedLoginsRequest extends Request {

/**
* Send the request to the API.
*
* @param array $data The data to send with the request.
*
* @return int|null The HTTP status, or null when the request itself failed.
*/
public function send( array $data ): ?int {
return parent::do_request( '', $data );
}

/**
* Get the url for the request.
*
* @param string $endpoint The endpoint to send the request to.
*
* @return string
*/
public function get_url( string $endpoint ): string {
return sprintf( Main::get_api_url() . '/sites/%s/logins/failed', rawurlencode( OptionsController::get_option( 'site_id' ) ) );
}

/**
* Get the body for the request.
*
* @param array $data The data to send with the request.
*
* @return array
*/
public function get_body( array $data ): array {
return $data;
}
}
50 changes: 50 additions & 0 deletions src/Cron/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ class Controller {
*/
public const ACTION_CLEANUP_PROBE_ORDERS = 'scanfully_woocheckout_cleanup_probe_orders';

/**
* Hook: send the failed login counts of the hours that are over
* (recurring hourly).
*/
public const ACTION_SEND_FAILED_LOGINS = 'scanfully_send_failed_logins';

/**
* Hook: check whether the MU plugins or drop-ins changed since the last
* site data sync, and sync right away when they did (recurring hourly).
*/
public const ACTION_CHECK_MU_PLUGINS = 'scanfully_check_mu_plugins';

/**
* Args marker for debounced (single) site health runs, to distinguish them
* from the recurring schedule so each can be managed independently.
Expand Down Expand Up @@ -76,6 +88,8 @@ public static function setup(): void {
add_action( self::ACTION_SYNC_DIRECTORIES, [ self::class, 'sync_directories' ] );
add_action( self::ACTION_SYNC_WOOCHECKOUT_CONFIG, [ self::class, 'sync_woocheckout_config' ] );
add_action( self::ACTION_CLEANUP_PROBE_ORDERS, [ self::class, 'cleanup_woocheckout_probe_orders' ] );
add_action( self::ACTION_SEND_FAILED_LOGINS, [ self::class, 'send_failed_logins' ] );
add_action( self::ACTION_CHECK_MU_PLUGINS, [ self::class, 'check_mu_plugins' ] );

// Register hooks that trigger a debounced site health sync.
self::register_health_sync_hooks();
Expand Down Expand Up @@ -197,6 +211,42 @@ public static function schedule_events(): void {
if ( ! as_has_scheduled_action( self::ACTION_CLEANUP_PROBE_ORDERS, [], self::AS_GROUP ) ) {
as_schedule_recurring_action( time(), DAY_IN_SECONDS, self::ACTION_CLEANUP_PROBE_ORDERS, [], self::AS_GROUP, true );
}

// A few minutes past every hour, so the hour before is over.
if ( ! as_has_scheduled_action( self::ACTION_SEND_FAILED_LOGINS, [], self::AS_GROUP ) ) {
as_schedule_recurring_action( ( intdiv( time(), HOUR_IN_SECONDS ) + 1 ) * HOUR_IN_SECONDS + 5 * MINUTE_IN_SECONDS, HOUR_IN_SECONDS, self::ACTION_SEND_FAILED_LOGINS, [], self::AS_GROUP, true );
}

if ( ! as_has_scheduled_action( self::ACTION_CHECK_MU_PLUGINS, [], self::AS_GROUP ) ) {
as_schedule_recurring_action( time() + HOUR_IN_SECONDS, HOUR_IN_SECONDS, self::ACTION_CHECK_MU_PLUGINS, [], self::AS_GROUP, true );
}
}

/**
* Check the MU plugins and drop-ins. Runs on the recurring hourly
* schedule. Files in `mu-plugins` change outside WordPress (SFTP,
* deploys, the host), so nothing tells the plugin; a quick check of the
* names, sizes and times, without reading any file, starts the site data
* sync right away when they differ from what the last sync sent.
*
* @return void
*/
public static function check_mu_plugins(): void {
$options = Options\Controller::get_options();
if ( $options->is_connected && Health\MuPlugins::changed_since_last_sync() ) {
self::schedule_health_sync();
}
}

/**
* Send the failed login counts. Runs on the recurring hourly schedule.
* Refreshes the access token if needed.
*
* @return void
*/
public static function send_failed_logins(): void {
self::refresh_access_token_if_needed();
\Scanfully\Events\FailedLogins\Reporter::send();
}

/**
Expand Down
57 changes: 57 additions & 0 deletions src/Events/AppPasswordCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
/**
* The application password created event class file.
*
* @package Scanfully
*/

namespace Scanfully\Events;

/**
* Class AppPasswordCreated
*
* An application password created for an account with elevated rights. The
* actor is whoever created it (the account itself or an administrator).
*
* @package Scanfully\Events
*/
class AppPasswordCreated extends AppPasswordEvent {

/**
* Constructor.
*/
public function __construct() {
parent::__construct( 'AppPasswordCreated', 'wp_create_application_password', 10, 2 );
}

/**
* Get the post body
*
* @param array $data The data to send: user ID, the new password's record.
*
* @return array
*/
public function get_post_body( array $data ): array {
$user = self::elevated_owner( $data[0] ?? 0 );
if ( null === $user ) {
return [];
}

return array_merge( self::describe_user( $user, true ), self::describe_app_password( $data[1] ?? [] ) );
}

/**
* A check if a event should fire
*
* @param array $data The event data: user ID, the new password's record.
*
* @return bool
*/
public function should_fire( array $data ): bool {
if ( ! is_array( $data[1] ?? null ) || null === self::elevated_owner( $data[0] ?? 0 ) ) {
return false;
}

return ! self::is_rate_limited();
}
}
52 changes: 52 additions & 0 deletions src/Events/AppPasswordEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* The application password event base class file.
*
* @package Scanfully
*/

namespace Scanfully\Events;

/**
* Class AppPasswordEvent
*
* Base for the application password events. They describe the password by
* its name and its WordPress ID (the uuid), never by the password itself or
* its hash, and only for accounts with elevated rights.
*
* @package Scanfully\Events
*/
abstract class AppPasswordEvent extends UserEvent {

/**
* The account the application password belongs to, when it has elevated
* rights.
*
* @param mixed $user The user ID or user.
*
* @return \WP_User|null
*/
protected static function elevated_owner( $user ): ?\WP_User {
if ( ! $user instanceof \WP_User ) {
$user = is_numeric( $user ) ? get_userdata( (int) $user ) : null;
}

return $user instanceof \WP_User && self::has_elevated_capabilities( $user ) ? $user : null;
}

/**
* The name and ID of an application password.
*
* @param mixed $item The application password record.
*
* @return array{app_name: string, app_id: string}
*/
protected static function describe_app_password( $item ): array {
$item = is_array( $item ) ? $item : [];

return [
'app_name' => self::plain_text( is_scalar( $item['name'] ?? null ) ? $item['name'] : '' ),
'app_id' => is_scalar( $item['uuid'] ?? null ) ? (string) $item['uuid'] : '',
];
}
}
95 changes: 95 additions & 0 deletions src/Events/AppPasswordFirstUsed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
/**
* The application password first used event class file.
*
* @package Scanfully
*/

namespace Scanfully\Events;

/**
* Class AppPasswordFirstUsed
*
* The first time an application password of an account with elevated rights
* signs a request in, with where the request came from. The hook fires on
* every request signed with an application password; WordPress passes the
* password's record as it was before this request, so a record without
* `last_used` means this is the first use.
*
* @package Scanfully\Events
*/
class AppPasswordFirstUsed extends AppPasswordEvent {

/**
* Constructor.
*/
public function __construct() {
parent::__construct( 'AppPasswordFirstUsed', 'application_password_did_authenticate', 10, 2 );
}

/**
* Return before any other work (such as reading the connection options)
* unless the password was never used: this runs on every request signed
* with an application password.
*
* @param mixed ...$args The arguments passed to the action: user, record.
*
* @return void
*/
public function listener_callback( ...$args ): void {
if ( ! is_array( $args[1] ?? null ) || ! empty( $args[1]['last_used'] ) ) {
return;
}

parent::listener_callback( ...$args );
}

/**
* The authenticated user made the request.
*
* @param array $args The event data: user, record.
*
* @return object|null
*/
protected function get_actor( array $args ): ?object {
return ( $args[0] ?? null ) instanceof \WP_User ? $args[0] : null;
}

/**
* Get the post body
*
* @param array $data The data to send: user, the password's record.
*
* @return array
*/
public function get_post_body( array $data ): array {
$user = self::elevated_owner( $data[0] ?? null );
if ( null === $user ) {
return [];
}

return array_merge(
self::describe_user( $user, true ),
self::describe_app_password( $data[1] ?? [] ),
self::request_origin()
);
}

/**
* A check if a event should fire
*
* @param array $data The event data: user, the password's record.
*
* @return bool
*/
public function should_fire( array $data ): bool {
if ( ! is_array( $data[1] ?? null ) || ! empty( $data[1]['last_used'] ) ) {
return false;
}
if ( null === self::elevated_owner( $data[0] ?? null ) ) {
return false;
}

return ! self::is_rate_limited();
}
}
Loading
Loading