Commit 8fd5d7e8 authored by Erick Hitter's avatar Erick Hitter
Browse files

Move time constant for plugin-wide use

parent a14433fc
...@@ -78,7 +78,7 @@ class REST_API extends Singleton { ...@@ -78,7 +78,7 @@ class REST_API extends Singleton {
if ( 1 === $run_disabled ) { if ( 1 === $run_disabled ) {
$message = __( 'Automatic event execution is disabled indefinitely.', 'automattic-cron-control' ); $message = __( 'Automatic event execution is disabled indefinitely.', 'automattic-cron-control' );
} else { } else {
$message = sprintf( __( 'Automatic event execution is disabled until %s UTC (%d).', 'automattic-cron-control' ), date_i18n( 'Y-m-d H:i:s', $run_disabled ), $run_disabled ); $message = sprintf( __( 'Automatic event execution is disabled until %s UTC (%d).', 'automattic-cron-control' ), date_i18n( TIME_FORMAT, $run_disabled ), $run_disabled );
} }
return rest_ensure_response( new \WP_Error( 'automatic-execution-disabled', $message, array( 'status' => 403, ) ) ); return rest_ensure_response( new \WP_Error( 'automatic-execution-disabled', $message, array( 'status' => 403, ) ) );
......
...@@ -33,3 +33,10 @@ const JOB_LOCK_EXPIRY_IN_MINUTES = 30; ...@@ -33,3 +33,10 @@ const JOB_LOCK_EXPIRY_IN_MINUTES = 30;
*/ */
const LOCK_DEFAULT_LIMIT = 10; const LOCK_DEFAULT_LIMIT = 10;
const LOCK_DEFAULT_TIMEOUT_IN_MINUTES = 10; const LOCK_DEFAULT_TIMEOUT_IN_MINUTES = 10;
/**
* Consistent time format across plugin
*
* Excludes timestamp as UTC is used throughout
*/
const TIME_FORMAT = 'Y-m-d H:i:s';
...@@ -37,8 +37,10 @@ prepare_environment(); ...@@ -37,8 +37,10 @@ prepare_environment();
/** /**
* Consistent time format across commands * Consistent time format across commands
*
* Defined here for backwards compatibility, as it was here before it was in the primary namespace
*/ */
const TIME_FORMAT = 'Y-m-d H:i:s'; const TIME_FORMAT = \Automattic\WP\Cron_Control\TIME_FORMAT;
/** /**
* Clear all of the caches for memory management * Clear all of the caches for memory management
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment