Skip to content

Commit

Permalink
Make homepage warm_up delayed to after setup
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuLamiot committed Jun 27, 2024
1 parent ec2d892 commit 263efa5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions inc/Engine/Activation/Activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public static function activate_plugin() {
]
);

// Signify to rocket_upgrader that we are on a fresh activation.
set_transient('rocket_fresh_activation', true, MINUTE_IN_SECONDS);

/**
* Fires after WP Rocket is activated
*/
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Media/AboveTheFold/Activation/Activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct( Controller $controller, ContextInterface $context )
* Add actions on activation.
*/
public function activate() {
add_action( 'rocket_after_activation', [ $this, 'warm_up' ] );
add_action( 'rocket_after_activation_and_setup', [ $this, 'warm_up' ] );
}

/**
Expand Down
1 change: 1 addition & 0 deletions inc/Engine/Media/ImageDimensions/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct( ImageDimensions $dimensions, Tests $buffer_tests )
* @return array
*/
public static function get_subscribed_events() {
error_log("Registering events for start_image_dimensions_buffer");

Check notice on line 46 in inc/Engine/Media/ImageDimensions/Subscriber.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/Engine/Media/ImageDimensions/Subscriber.php#L46

Expected 1 spaces after opening parenthesis; 0 found

Check notice on line 46 in inc/Engine/Media/ImageDimensions/Subscriber.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/Engine/Media/ImageDimensions/Subscriber.php#L46

String "Registering events for start_image_dimensions_buffer" does not require double quotes; use single quotes instead
return [
'rocket_buffer' => [ 'specify_image_dimensions', 17 ],
'template_redirect' => [ 'start_image_dimensions_buffer', 3 ],
Expand Down
6 changes: 6 additions & 0 deletions inc/admin/upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ function rocket_upgrader() {
update_option( WP_ROCKET_SLUG, $options );
}

// If we just completed an activation

Check notice on line 41 in inc/admin/upgrader.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/admin/upgrader.php#L41

Inline comments must end in full-stops, exclamation marks, or question marks
if ( get_transient('rocket_fresh_activation') ) {

Check notice on line 42 in inc/admin/upgrader.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/admin/upgrader.php#L42

Expected 1 spaces after opening parenthesis; 0 found
delete_transient('rocket_fresh_activation');
do_action('rocket_after_activation_and_setup');

Check notice on line 44 in inc/admin/upgrader.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/admin/upgrader.php#L44

Expected 1 spaces after opening parenthesis; 0 found
}

$page = isset( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended

if (
Expand Down

0 comments on commit 263efa5

Please sign in to comment.