Verified Commit d3e17a26 authored by Erick Hitter's avatar Erick Hitter
Browse files

Correct public-facing uses of plugin name

parent 49e7e3bc
# WP-Cron Control Revisited
# Cron Control
Execute WordPress cron events in parallel, using a custom post type for event storage.
......
<?php
/*
Plugin Name: WP-Cron Control Revisited
Plugin Name: Cron Control
Plugin URI:
Description: Take control of wp-cron execution.
Description: Execute WordPress cron events in parallel, using a custom post type for event storage.
Author: Erick Hitter, Automattic
Version: 1.0
Text Domain: wp-cron-control-revisited
Text Domain: automattic-cron-control
*/
namespace Automattic\WP\Cron_Control;
......
......@@ -113,12 +113,12 @@ class Events extends Singleton {
public function run_event( $timestamp, $action, $instance ) {
// Validate input data
if ( empty( $timestamp ) || empty( $action ) || empty( $instance ) ) {
return new \WP_Error( 'missing-data', __( 'Invalid or incomplete request data.', 'wp-cron-control-revisited' ) );
return new \WP_Error( 'missing-data', __( 'Invalid or incomplete request data.', 'automattic-cron-control' ) );
}
// Ensure we don't run jobs too far ahead
if ( $timestamp > strtotime( sprintf( '+%d seconds', JOB_EXECUTION_BUFFER_IN_SECONDS ) ) ) {
return new \WP_Error( 'premature', __( 'Event is not scheduled to be run yet.', 'wp-cron-control-revisited' ) );
return new \WP_Error( 'premature', __( 'Event is not scheduled to be run yet.', 'automattic-cron-control' ) );
}
// Find the event to retrieve the full arguments
......@@ -127,7 +127,7 @@ class Events extends Singleton {
// Nothing to do...
if ( ! is_array( $event ) ) {
return new \WP_Error( 'no-event', __( 'The specified event could not be found.', 'wp-cron-control-revisited' ) );
return new \WP_Error( 'no-event', __( 'The specified event could not be found.', 'automattic-cron-control' ) );
}
// And we're off!
......@@ -135,7 +135,7 @@ class Events extends Singleton {
// Limit how many events are processed concurrently
if ( ! is_internal_event( $event['action'] ) && ! Lock::check_lock( self::LOCK ) ) {
return new \WP_Error( 'no-free-threads', __( 'No resources available to run this job.', 'wp-cron-control-revisited' ) );
return new \WP_Error( 'no-free-threads', __( 'No resources available to run this job.', 'automattic-cron-control' ) );
}
// Prepare environment to run job
......@@ -164,7 +164,7 @@ class Events extends Singleton {
return array(
'success' => true,
'message' => sprintf( __( 'Job with action `%1$s` and arguments `%2$s` completed in %3$d seconds.', 'wp-cron-control-revisited' ), $event['action'], maybe_serialize( $event['args'] ), $time_end - $time_start ),
'message' => sprintf( __( 'Job with action `%1$s` and arguments `%2$s` completed in %3$d seconds.', 'automattic-cron-control' ), $event['action'], maybe_serialize( $event['args'] ), $time_end - $time_start ),
);
}
}
......
......@@ -39,11 +39,11 @@ class Internal_Events extends Singleton {
$this->internal_jobs_schedules = array(
'wpccrij_minute' => array(
'interval' => 1 * MINUTE_IN_SECONDS,
'display' => __( 'WP-Cron Control Revisited internal job - every minute', 'wp-cron-control-revisited' ),
'display' => __( 'Cron Control internal job - every minute', 'automattic-cron-control' ),
),
'wpccrij_ten_minutes' => array(
'interval' => 10 * MINUTE_IN_SECONDS,
'display' => __( 'WP-Cron Control Revisited internal job - every 10 minutes', 'wp-cron-control-revisited' ),
'display' => __( 'Cron Control internal job - every 10 minutes', 'automattic-cron-control' ),
),
);
......
......@@ -52,7 +52,7 @@ class Main extends Singleton {
foreach ( $constants as $constant => $expected_value ) {
if ( defined( $constant ) ) {
if ( constant( $constant ) !== $expected_value ) {
error_log( sprintf( __( '%s: %s set to unexpected value; must be corrected for proper behaviour.', 'wp-cron-control-revisited' ), 'WP-Cron Control Revisited', $constant ) );
error_log( sprintf( __( '%s: %s set to unexpected value; must be corrected for proper behaviour.', 'automattic-cron-control' ), 'Cron Control', $constant ) );
}
} else {
define( $constant, $expected_value );
......@@ -66,7 +66,7 @@ class Main extends Singleton {
public function block_direct_cron() {
if ( false !== stripos( $_SERVER['REQUEST_URI'], '/wp-cron.php' ) || false !== stripos( $_SERVER['SCRIPT_NAME'], '/wp-cron.php' ) ) {
status_header( 403 );
wp_send_json_error( new \WP_Error( 'forbidden', sprintf( __( 'Normal cron execution is blocked when the %s plugin is active.', 'wp-cron-control-revisited' ), 'WP-Cron Control Revisited' ) ) );
wp_send_json_error( new \WP_Error( 'forbidden', sprintf( __( 'Normal cron execution is blocked when the %s plugin is active.', 'automattic-cron-control' ), 'Cron Control' ) ) );
}
}
......@@ -89,7 +89,7 @@ class Main extends Singleton {
public function admin_notice() {
?>
<div class="notice notice-error">
<p><?php printf( __( '<strong>%1$s</strong>: To use this plugin, define the constant %2$s.', 'wp-cron-control-revisited' ), 'WP-Cron Control Revisited', '<code>WP_CRON_CONTROL_SECRET</code>' ); ?></p>
<p><?php printf( __( '<strong>%1$s</strong>: To use this plugin, define the constant %2$s.', 'automattic-cron-control' ), 'Cron Control', '<code>WP_CRON_CONTROL_SECRET</code>' ); ?></p>
</div>
<?php
}
......
......@@ -68,7 +68,7 @@ class REST_API extends Singleton {
// For now, mimic original plugin's "authentication" method. This needs to be better.
if ( ! isset( $body['secret'] ) || ! hash_equals( \WP_CRON_CONTROL_SECRET, $body['secret'] ) ) {
return new \WP_Error( 'no-secret', __( 'Secret must be specified with all requests', 'wp-cron-control-revisited' ) );
return new \WP_Error( 'no-secret', __( 'Secret must be specified with all requests', 'automattic-cron-control' ) );
}
return true;
......
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