disabled_url( $url ); $history = new Speed_Score_History( $url_no_boost ); $score_request = $this->get_score_request_by_url( $url_no_boost ); if ( // If there isn't already a pending request. ( empty( $score_request ) || ! $score_request->is_pending() ) && ! empty( $this->modules ) && $history->is_stale() ) { $score_request = new Speed_Score_Request( $url_no_boost, array(), null, 'pending', null, $this->client ); // Dispatch a new speed score request to measure score without boost. $score_request->store( 3600 ); // Keep the request for 1 hour even if no one access the results. The value is persisted for 1 hour in wp.com from initial request. // Send the request. $score_request->execute(); } remove_filter( 'jetpack_boost_excluded_query_parameters', array( $this, 'allow_jb_disable_module' ) ); return $score_request; } /** * Get Speed_Score_Request instance by url. * * @param string $url Url to get the Speed_Score_Request instance for. * * @return Speed_Score_Request */ private function get_score_request_by_url( $url ) { return Speed_Score_Request::get( Speed_Score_Request::generate_cache_id_from_url( $url ) ); } /** * Add query parameters to the url that would disable all boost modules. * * @param string $url The original URL we are measuring for score. * * @return string */ private function get_boost_modules_disabled_url( $url ) { return add_query_arg( 'jb-disable-modules', 'all', $url ); } /** * Can the user access speed scores? * * @return bool */ public function can_access_speed_scores() { return current_user_can( 'manage_options' ); } /** * Clear speed score request cache on jetpack_boost_deactivate action. */ public function clear_speed_score_request_cache() { Speed_Score_Request::clear_cache(); } /** * Prepare the speed score response. * * @param string $url URL of the speed is requested for. * @param Speed_Score_Request $score_request Speed score request. * @param Speed_Score_Request $score_request_no_boost Speed score request without boost enabled. * * @return \WP_Error|\WP_HTTP_Response|\WP_REST_Response */ private function prepare_speed_score_response( $url, $score_request, $score_request_no_boost ) { $history = new Speed_Score_History( $url ); $url_no_boost = $this->get_boost_modules_disabled_url( $url ); $history_no_boost = new Speed_Score_History( $url_no_boost ); $response = array(); if ( ( ! $score_request || $score_request->is_success() ) && ( ! $score_request_no_boost || $score_request_no_boost->is_success() ) ) { $response['status'] = 'success'; $response['scores'] = array( 'current' => $history->latest_scores(), 'noBoost' => null, ); // Only include noBoost scores if at least one module is enabled. if ( $score_request && ! empty( $score_request->get_active_modules() ) ) { $response['scores']['noBoost'] = $history_no_boost->latest_scores(); } $response['scores']['isStale'] = $history->is_stale(); } elseif ( ( $score_request && $score_request->is_error() ) || ( $score_request_no_boost && $score_request_no_boost->is_error() ) ) { // If either request ended up in error, we can just return the one with error so front-end can take action. The relevent url is available on the serialized object. if ( $score_request->is_error() ) { // Serialized version of score request contains the status property and error description if any. $response = $score_request->jsonSerialize(); } else { $response = $score_request_no_boost->jsonSerialize(); } } else { // If no request ended up in error/success as previous conditions dictate, it means that either of them are in pending state. $response['status'] = 'pending'; } return rest_ensure_response( $response ); } }
Fatal error: Uncaught Error: Class 'Automattic\Jetpack\Boost_Speed_Score\Speed_Score' not found in /var/www/html/alertamt.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/class-initializer.php:96 Stack trace: #0 /var/www/html/alertamt.com.br/web/wp-content/plugins/jetpack/class.jetpack.php(871): Automattic\Jetpack\My_Jetpack\Initializer::init() #1 /var/www/html/alertamt.com.br/web/wp-includes/class-wp-hook.php(324): Jetpack->late_initialization('') #2 /var/www/html/alertamt.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #3 /var/www/html/alertamt.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /var/www/html/alertamt.com.br/web/wp-settings.php(559): do_action('plugins_loaded') #5 /var/www/html/alertamt.com.br/web/wp-config.php(115): require_once('/var/www/html/a...') #6 /var/www/html/alertamt.com.br/web/wp-load.php(50): require_once('/var/www/html/a...') #7 /var/www/html/alertamt.com.br/web/wp-blog-header.php(13): require_once('/v in /var/www/html/alertamt.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-my-jetpack/src/class-initializer.php on line 96