Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:closes: Fix issue with warm up link for homepage #6742

Merged
merged 13 commits into from
Jul 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions inc/Engine/Media/AboveTheFold/WarmUp/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function warm_up_home(): void {
return;
}

$this->send_to_saas( home_url() );
$this->send_to_saas( home_url(), true );
$this->queue->add_job_warmup();
}

Expand Down Expand Up @@ -203,13 +203,14 @@ function ( $link ) use ( $home_url, $reject_uri_pattern ) {
* Send link to SaaS to do the warmup.
*
* @param string $url Url to send.
* @param bool $is_warm_up set to false by default, should be true if request is warm up.
*
* @return void
*/
public function send_to_saas( string $url ) {
public function send_to_saas( string $url, bool $is_warm_up = false ) {
Khadreal marked this conversation as resolved.
Show resolved Hide resolved
$this->api_client->add_to_atf_queue( $url );

if ( $this->is_mobile() ) {
if ( $this->is_mobile( $is_warm_up ) ) {
$this->api_client->add_to_atf_queue( $url, 'mobile' );
}
}
Expand Down Expand Up @@ -237,9 +238,15 @@ public function add_wpr_imagedimensions_query_arg( string $url ): string {
/**
* Check if the current request is for mobile.
Khadreal marked this conversation as resolved.
Show resolved Hide resolved
*
* @param bool $is_warm_up if check is for warm up or not.
*
* @return bool
*/
private function is_mobile(): bool {
private function is_mobile( bool $is_warm_up = false ): bool {
if ( $is_warm_up ) {
return true;
}
Khadreal marked this conversation as resolved.
Show resolved Hide resolved

return $this->options->get( 'cache_mobile', 0 ) && $this->options->get( 'do_caching_mobile_files', 0 );
}
}
Loading