Skip to content

Commit

Permalink
Display details about all scheduled jobs in system info
Browse files Browse the repository at this point in the history
Fix #112
  • Loading branch information
rajanvijayan committed May 17, 2018
1 parent 630b44b commit 7ca4cb5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/helpers/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,32 @@ function bd_print_network_active_plugins() {
echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n";
}
}

/**
* Print scheduled jobs.
*
* @since 6.0
*/
function bd_print_scheduled_jobs() {
$cron = _get_cron_array();
$date_format = _x( 'M j, Y @ G:i', 'Cron table date format', 'bulk-delete' );

foreach ( $cron as $timestamp => $cronhooks ) {
foreach ( (array) $cronhooks as $hook => $events ) {
if ( 'do-bulk-delete-' === substr( $hook, 0, 15 ) ) {
$cron_item = array();

foreach ( (array) $events as $key => $event ) {
echo date_i18n( $date_format, $timestamp + ( get_option( 'gmt_offset' ) * 60 * 60 ) ). ' ('. $timestamp. ')';
echo " | ";
echo $event['schedule'];
echo " | ";
echo $hook;
// print_r( $event['args'] );
echo "\n";
}

}
}
}
}
4 changes: 4 additions & 0 deletions include/system-info/class-bd-system-info-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ protected function render_body() {

<?php bd_print_current_plugins(); ?>

SCHEDULED JOBS:

<?php bd_print_scheduled_jobs(); ?>

<?php
if ( is_multisite() ) : ?>
NETWORK ACTIVE PLUGINS:
Expand Down

0 comments on commit 7ca4cb5

Please sign in to comment.