Skip to content

Commit

Permalink
Log an entry when a cron event hook is paused or resumed with the WP …
Browse files Browse the repository at this point in the history
…Crontrol plugin (#328)
  • Loading branch information
johnbillion authored Mar 26, 2023
1 parent cbf37f6 commit 27a0e17
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
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

0 comments on commit 27a0e17

Please sign in to comment.