| @@ -34,11 +34,12 @@ | ||
| 34 | 34 | private const CONTEXTS = array( 'dashboard', 'editor', 'frontend' ); |
| 35 | 35 | |
| 36 | 36 | public function ui_metadata(): array { |
| 37 | 37 | return array( |
| 38 | - 'label' => 'Heartbeat', | |
| 38 | + 'label' => __( 'Heartbeat', 'xspeed' ), | |
| 39 | 39 | 'icon' => 'Activity', |
| 40 | - 'description' => 'Control the WordPress Heartbeat API per context.', | |
| 40 | + 'description' => __( 'Controls how often WordPress checks in with your server in the background.', 'xspeed' ), | |
| 41 | + 'group' => 'performance', | |
| 41 | 42 | ); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | /** |
| @@ -60,10 +61,10 @@ | ||
| 60 | 61 | 'type' => 'enum', |
| 61 | 62 | 'default' => self::BEHAVIOR_THROTTLE, |
| 62 | 63 | 'options' => $behavior_options, |
| 63 | 64 | 'option_labels' => $behavior_option_labels, |
| 64 | - 'label' => 'Dashboard', | |
| 65 | - 'description' => 'Heartbeat behavior on /wp-admin/ screens (autosave, notifications).', | |
| 65 | + 'label' => __( 'Dashboard', 'xspeed' ), | |
| 66 | + 'description' => __( 'Background checks on admin screens, used for notifications.', 'xspeed' ), | |
| 66 | 67 | ), |
| 67 | 68 | 'behavior_editor' => array( |
| 68 | 69 | 'type' => 'enum', |
| 69 | 70 | 'default' => self::BEHAVIOR_THROTTLE, |
| @@ -68,10 +69,10 @@ | ||
| 68 | 69 | 'type' => 'enum', |
| 69 | 70 | 'default' => self::BEHAVIOR_THROTTLE, |
| 70 | 71 | 'options' => $behavior_options, |
| 71 | 72 | 'option_labels' => $behavior_option_labels, |
| 72 | - 'label' => 'Editor', | |
| 73 | - 'description' => 'Heartbeat in the post / block editor. Disable only if you do not need autosave or co-edit locks.', | |
| 73 | + 'label' => __( 'Editor', 'xspeed' ), | |
| 74 | + 'description' => __( 'Background checks in the post editor. Disable only if you do not need autosave or the warning when someone else is editing.', 'xspeed' ), | |
| 74 | 75 | ), |
| 75 | 76 | 'behavior_frontend' => array( |
| 76 | 77 | 'type' => 'enum', |
| 77 | 78 | 'default' => self::BEHAVIOR_DISABLE, |
| @@ -76,10 +77,10 @@ | ||
| 76 | 77 | 'type' => 'enum', |
| 77 | 78 | 'default' => self::BEHAVIOR_DISABLE, |
| 78 | 79 | 'options' => $behavior_options, |
| 79 | 80 | 'option_labels' => $behavior_option_labels, |
| 80 | - 'label' => 'Frontend', | |
| 81 | - 'description' => 'Controls the Heartbeat API on the public site. Only takes effect when a plugin or theme actually loads heartbeat on the frontend (e.g. WooCommerce cart fragments, membership/notification plugins) — a default WordPress site loads none there, so this has no visible effect on such sites. Recommended: Disable, to stop the admin-ajax polling those plugins add.', | |
| 81 | + 'label' => __( 'Frontend', 'xspeed' ), | |
| 82 | + 'description' => __( 'Background checks on the public site, which only some plugins add. Disable is recommended, as it cuts extra requests to your server.', 'xspeed' ), | |
| 82 | 83 | ), |
| 83 | 84 | 'frequency' => array( |
| 84 | 85 | 'type' => 'int', |
| 85 | 86 | 'default' => 60, |
| @@ -84,10 +85,19 @@ | ||
| 84 | 85 | 'type' => 'int', |
| 85 | 86 | 'default' => 60, |
| 86 | 87 | 'min' => 15, |
| 87 | 88 | 'max' => 300, |
| 88 | - 'label' => 'Throttle Frequency', | |
| 89 | - 'description' => 'Interval in seconds for contexts set to Throttle. 60 is a sane default; lower = faster sync but more requests.', | |
| 89 | + 'label' => __( 'Throttle interval', 'xspeed' ), | |
| 90 | + 'unit' => 'seconds', | |
| 91 | + 'description' => __( 'Seconds between checks where you chose Throttle. 60 suits most sites; a lower number means more requests.', 'xspeed' ), | |
| 92 | + 'advanced' => true, | |
| 93 | + 'dependsOn' => array( | |
| 94 | + 'any' => array( | |
| 95 | + array( 'field' => 'behavior_dashboard', 'value' => self::BEHAVIOR_THROTTLE ), | |
| 96 | + array( 'field' => 'behavior_editor', 'value' => self::BEHAVIOR_THROTTLE ), | |
| 97 | + array( 'field' => 'behavior_frontend', 'value' => self::BEHAVIOR_THROTTLE ), | |
| 98 | + ), | |
| 99 | + ), | |
| 90 | 100 | ), |
| 91 | 101 | ); |
| 92 | 102 | } |
| 93 | 103 | |
| @@ -99,8 +109,9 @@ | ||
| 99 | 109 | array( |
| 100 | 110 | 'name' => 'xspeed heartbeat', |
| 101 | 111 | 'callback' => array( $this, 'cli_handler' ), |
| 102 | 112 | 'shortdesc' => 'Inspect or modify xSpeed heartbeat settings.', |
| 113 | + 'ai_hint' => 'Inspect or change WordPress Heartbeat (admin-ajax polling) frequency. Use for high admin-ajax.php CPU load, or hosting warnings about too many background requests.', | |
| 103 | 114 | 'synopsis' => array( |
| 104 | 115 | array( |
| 105 | 116 | 'type' => 'positional', |
| 106 | 117 | 'name' => 'action', |