Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log an entry when a cron event hook is paused or resumed with the WP Crontrol plugin #328

Merged
merged 2 commits into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 36 additions & 0 deletions loggers/PluginWPCrontrolLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function getInfo() {
'ran_event' => _x( 'Manually ran cron event "{event_hook}"', 'PluginWPCrontrolLogger', 'simple-history' ),
'deleted_event' => _x( 'Deleted cron event "{event_hook}"', 'PluginWPCrontrolLogger', 'simple-history' ),
'deleted_all_with_hook' => _x( 'Deleted all "{event_hook}" cron events', 'PluginWPCrontrolLogger', 'simple-history' ),
'paused_hook' => _x( 'Paused the "{event_hook}" cron event hook', 'PluginWPCrontrolLogger', 'simple-history' ),
'resumed_hook' => _x( 'Resumed the "{event_hook}" cron event hook', 'PluginWPCrontrolLogger', 'simple-history' ),
'edited_event' => _x( 'Edited cron event "{event_hook}"', 'PluginWPCrontrolLogger', 'simple-history' ),
'added_new_schedule' => _x( 'Added cron schedule "{schedule_name}"', 'PluginWPCrontrolLogger', 'simple-history' ),
'deleted_schedule' => _x( 'Deleted cron schedule "{schedule_name}"', 'PluginWPCrontrolLogger', 'simple-history' ),
Expand All @@ -48,6 +50,8 @@ public function loaded() {
add_action( 'crontrol/ran_event', array( $this, 'ran_event' ) );
add_action( 'crontrol/deleted_event', array( $this, 'deleted_event' ) );
add_action( 'crontrol/deleted_all_with_hook', array( $this, 'deleted_all_with_hook' ), 10, 2 );
add_action( 'crontrol/paused_hook', array( $this, 'paused_hook' ) );
add_action( 'crontrol/resumed_hook', array( $this, 'resumed_hook' ) );
add_action( 'crontrol/edited_event', array( $this, 'edited_event' ), 10, 2 );
add_action( 'crontrol/edited_php_event', array( $this, 'edited_event' ), 10, 2 );
add_action( 'crontrol/added_new_schedule', array( $this, 'added_new_schedule' ), 10, 3 );
Expand Down Expand Up @@ -169,6 +173,38 @@ public function deleted_all_with_hook( $hook, $deleted ) {
);
}

/**
* Fires after a cron event hook is paused.
*
* @param string $hook The hook name.
*/
public function paused_hook( $hook ) {
$context = array(
'event_hook' => $hook,
);

$this->infoMessage(
'paused_hook',
$context
);
}

/**
* Fires after a cron event hook is resumed (unpaused).
*
* @param string $hook The hook name.
*/
public function resumed_hook( $hook ) {
$context = array(
'event_hook' => $hook,
);

$this->infoMessage(
'resumed_hook',
$context
);
}

/**
* Fires after a cron event is edited.
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Simple History will log each user switch being made.

**WP Crontrol**<br>
The [WP Crontrol plugin](https://wordpress.org/plugins/wp-crontrol/) enables you to view and control what's happening in the WP-Cron system.
Simple History will log when cron events are added, edited, deleted, and manually ran, and when cron schedules are added and deleted.
Simple History will log when cron events are added, edited, deleted, paused, resumed, and manually ran, and when cron schedules are added and deleted.

**Enable Media Replace**<br>
The [Enable Media Replace plugin](https://wordpress.org/plugins/enable-media-replace/) allows you to replace a file in your media library by uploading a new file in its place.
Expand Down