Automattic\WooCommerce\Internal\Admin

SystemStatusReport::render_daily_cron │ public │ WC 1.0

Render daily cron row.

Method of the class: SystemStatusReport{}

No Hooks.

Returns

null. Nothing (null).

Usage

$SystemStatusReport = new SystemStatusReport();
$SystemStatusReport->render_daily_cron();

SystemStatusReport::render_daily_cron() code WC 11.1.2

<?php
public function render_daily_cron() {
	$next_action_time = function_exists( 'as_next_scheduled_action' )
		? as_next_scheduled_action( 'wc_admin_daily_wrapper', null, 'woocommerce' )
		: false;
	?>
		<tr>
			<td data-export-label="Daily Cron">
				<?php esc_html_e( 'Daily Cron', 'woocommerce' ); ?>:
			</td>
			<td class="help"><?php echo wc_help_tip( esc_html__( 'Is the daily cron job active, when does it next run?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
			<td>
				<?php
				if ( $next_action_time ) {
					$status_text = true === $next_action_time
						? esc_html__( 'Currently running', 'woocommerce' )
						/* translators: %s: Date and time the daily cron job is next scheduled to run. */
						: sprintf( esc_html__( 'Next scheduled: %s', 'woocommerce' ), esc_html( date_i18n( 'Y-m-d H:i:s P', (int) $next_action_time ) ) );
					echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> ' . $status_text . '</mark>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $status_text built from esc_html()/esc_html__() above.
				} else {
					echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Not scheduled', 'woocommerce' ) . '</mark>';
				}
				?>
			</td>
		</tr>
	<?php
}