Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 0 additions & 28 deletions inc/Engine/Admin/RocketInsights/APIHandler/APIClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ public function add_to_queue( string $url, array $options = [], array $args = []
$args
);

$this->logger::debug(
'Rocket Insights: Initiating test',
[
'url' => $url,
'options' => $options,
]
);

$sent = $this->handle_post( $args );

if ( ! $sent ) {
Expand All @@ -78,13 +70,6 @@ public function add_to_queue( string $url, array $options = [], array $args = []

$response_data = json_decode( $this->response_body, true );

$this->logger::info(
'Rocket Insights: Test initiated successfully',
[
'job_id' => $response_data['uuid'],
]
);

$response_data['code'] = $this->response_code;

return $response_data;
Expand All @@ -107,11 +92,6 @@ public function get_queue_job_status( string $test_id, $queue_name, $is_home = f
'timeout' => 15,
];

$this->logger::debug(
'Rocket Insights: Checking test status',
[ 'test_id' => $test_id ]
);

$sent = $this->handle_get( $args );

if ( ! $sent ) {
Expand Down Expand Up @@ -146,14 +126,6 @@ public function get_queue_job_status( string $test_id, $queue_name, $is_home = f
return $error_data;
}

$this->logger::debug(
'Rocket Insights: Status check completed',
[
'test_id' => $test_id,
'status' => $response_data['status'] ?? 'unknown',
]
);

switch ( $response_data['status'] ?? 'pending' ) {
case 'pending':
$code = 425;
Expand Down
19 changes: 1 addition & 18 deletions inc/Engine/Admin/RocketInsights/Jobs/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@ public function __construct(
* @return array
*/
public function get_pending_jobs( int $num_rows ): array {
$this->logger::debug( "Rocket Insights: Start getting number of {$num_rows} pending jobs." );

$pending_jobs = $this->query->get_pending_jobs( $num_rows );

if ( ! $pending_jobs ) {
$this->logger::debug( 'Rocket Insights: No pending jobs are there.' );
return [];
}

Expand Down Expand Up @@ -157,25 +154,11 @@ public function process( array $job_details, $row_details, string $optimization_
}

if ( ! empty( $job_details['status'] ) && 'pending' === $job_details['status'] ) {
$this->logger::info(
'Rocket Insights: Revert to pending because of API status is pending',
[
'job_id' => $row_details->job_id,
]
);

$this->query->revert_to_pending( $row_details->id );

return;
}

$this->logger::info(
'Rocket Insights: Test completed successfully',
[
'job_id' => $row_details->job_id,
'score' => $job_details['performance_score'] ?? null,
]
);

$this->query->make_status_completed( $row_details->id, 'completed', $this->parse_test_results( $job_details ) );

$row_details = $this->query->get_row_by_id( $row_details->id );
Expand Down
12 changes: 0 additions & 12 deletions inc/Engine/Common/JobManager/JobProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,11 @@ public function process_pending_jobs() {
'3.16',
'rocket_rucss_process_pending_jobs_start'
);
$this->logger::debug( 'RUCSS: Start processing pending jobs inside cron.' );

if ( ! $this->is_allowed() ) {
$this->logger::debug( 'Stop processing cron iteration for pending jobs.' );

return;
}

$this->logger::debug( 'Start processing pending jobs inside cron.' );

// Get some items from the DB with status=pending & job_id isn't empty.

/**
Expand Down Expand Up @@ -161,10 +156,8 @@ public function process_pending_jobs() {
* @return void
*/
public function check_job_status( string $url, bool $is_mobile, string $optimization_type ) {

$row_details = $this->get_single_job( $url, $is_mobile, $optimization_type );
if ( ! is_object( $row_details ) ) {
$this->logger::debug( 'Url - ' . $url . ' not found for is_mobile - ' . (int) $is_mobile );
// Nothing in DB, bailout.
return;
}
Expand Down Expand Up @@ -227,8 +220,6 @@ public function check_job_status( string $url, bool $is_mobile, string $optimiza
* @return void
*/
public function process_on_submit_jobs() {
$this->logger::debug( 'Start processing on submit jobs for adding jobs to queue.' );

/**
* Fires at the start of the process on submit jobs.
*
Expand All @@ -242,8 +233,6 @@ public function process_on_submit_jobs() {
);

if ( ! $this->is_allowed() ) {
$this->logger::debug( 'Stop processing cron iteration for to-submit jobs.' );

return;
}

Expand Down Expand Up @@ -309,7 +298,6 @@ public function process_on_submit_jobs() {
);
}

$this->logger::debug( 'End processing on submit jobs for adding jobs to queue.' );
/**
* Fires at the end of the process pending jobs.
*
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/Common/Queue/RUCSSQueueRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected function do_batch( $size = 100, $context = '' ) {
$this->reset_group();
return $processed_actions;
} catch ( \Exception $exception ) {
Logger::debug( $exception->getMessage() );
Logger::error( $exception->getMessage() );
$this->reset_group();
return 0;
}
Expand Down
5 changes: 0 additions & 5 deletions inc/Engine/Media/ImageDimensions/ImageDimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ public function sanitize_option_value( array $input, Settings $settings ): array
* @return string Buffer Page HTML contents after inserting dimensions into images.
*/
public function specify_image_dimensions( $html ) {
Logger::debug( 'Start Specify Image Dimensions.' );

if ( ! $this->can_specify_dimensions_images() ) {
Logger::debug( 'Specify Image Dimensions failed because option is not enabled from admin or by filter (rocket_specify_image_dimensions).' );
return $html;
}

Expand Down Expand Up @@ -124,8 +121,6 @@ public function specify_image_dimensions( $html ) {
*/
$images = apply_filters( 'rocket_specify_dimension_images', $images_match[0] );

Logger::debug( 'Specify Image Dimensions found ( ' . count( $images ) . ' ).', $images );

foreach ( $images as $image ) {
$image_url = $this->can_specify_dimensions_one_image( $image );

Expand Down
66 changes: 5 additions & 61 deletions inc/Engine/Media/Lazyload/CSS/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,10 @@ public static function get_subscribed_events() {
* @return string
*/
public function maybe_replace_css_images( string $html ): string {

if ( ! $this->context->is_allowed() ) {
return $html;
}

$this->logger::debug(
'Starting lazyload',
$this->generate_log_context(
[
'data' => $html,
]
)
);

/**
* Generate lazyload CSS for the page.
*
Expand All @@ -187,26 +177,11 @@ public function maybe_replace_css_images( string $html ): string {
);

if ( ! key_exists( 'html', $output ) ) {
$this->logger::debug(
'Lazyload bailed out',
$this->generate_log_context(
[
'data' => $html,
]
)
);
$this->logger::debug( 'Lazyload CSS bailed out' );

return $html;
}

$this->logger::debug(
'Ending lazyload',
$this->generate_log_context(
[
'data' => $html,
]
)
);

$html = $this->add_meta_comment( 'lazyload_css_bg_img', $output['html'] );

return $html;
Expand All @@ -218,10 +193,6 @@ public function maybe_replace_css_images( string $html ): string {
* @return void
*/
public function clear_generated_css() {
$this->logger::debug(
'Clear lazy CSS',
$this->generate_log_context()
);
$this->cache->clear();
}

Expand Down Expand Up @@ -302,23 +273,18 @@ public function create_lazy_css_files( array $data ): array {

if ( $this->is_excluded( $url ) ) {
$this->logger::debug(
"Excluded lazy css files $url",
"Excluded lazy css file $url",
$this->generate_log_context()
);
continue;
}

$url_key = $this->format_url( $url );
if ( ! $this->cache->has( $url_key ) ) {
$this->logger::debug(
"Generate lazy css files $url",
$this->generate_log_context()
);

$file_mapping = $this->generate_css_file( $url );
if ( empty( $file_mapping ) ) {
$this->logger::debug(
"Create lazy css files $url bailed out",
"Create lazy css file $url bailed out",
$this->generate_log_context()
);
continue;
Expand All @@ -327,10 +293,6 @@ public function create_lazy_css_files( array $data ): array {
$mapping = array_merge( $mapping, $file_mapping );

} else {
$this->logger::debug(
"Load lazy css files $url",
$this->generate_log_context()
);
$mapping = array_merge( $mapping, $this->load_existing_mapping( $url ) );
}

Expand Down Expand Up @@ -364,7 +326,6 @@ public function create_lazy_css_files( array $data ): array {
* @return array
*/
public function add_lazy_tag( array $data ): array {

if ( ! key_exists( 'html', $data ) || ! key_exists( 'lazyloaded_images', $data ) ) {
$this->logger::debug(
'Add lazy tag bailed out',
Expand All @@ -387,15 +348,7 @@ public function add_lazy_tag( array $data ): array {
*/
$loaded = apply_filters( 'rocket_css_image_lazyload_images_load', [], $lazyload_images );

$tags = $this->tag_generator->generate( $lazyload_images, $loaded );
$this->logger::debug(
'Add lazy tag generated',
$this->generate_log_context(
[
'data' => $tags,
]
)
);
$tags = $this->tag_generator->generate( $lazyload_images, $loaded );
$data['html'] = str_replace( '</head>', "$tags</head>", $data['html'] );

return $data;
Expand Down Expand Up @@ -655,15 +608,6 @@ protected function generate_asset_url( string $url ): string {

$cached_url = $this->cache->generate_url( $this->format_url( $url ) );

$this->logger::debug(
"Generated url lazy css files $url",
$this->generate_log_context(
[
'data' => $cached_url,
]
)
);

return add_query_arg( $queries, $cached_url );
}

Expand Down
13 changes: 0 additions & 13 deletions inc/Engine/Optimization/Buffer/Optimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ class Optimization extends Abstract_Buffer {
*/
protected $tests;

/**
* Constructor.
*
* @since 3.3
*
* @param Tests $tests Tests instance.
*/
public function __construct( Tests $tests ) {
parent::__construct( $tests );

$this->log( 'OPTIMIZATION PROCESS STARTED.', [], 'info' );
}

/** ----------------------------------------------------------------------------------------- */
/** CACHE =================================================================================== */
/** ----------------------------------------------------------------------------------------- */
Expand Down
17 changes: 0 additions & 17 deletions inc/Engine/Optimization/GoogleFonts/Combine.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Combine extends AbstractGFOptimization {
*/
public function optimize( $html ): string {
$this->font_urls = [];
Logger::info( 'GOOGLE FONTS COMBINE PROCESS STARTED.', [ 'GF combine process' ] );

$html_nocomments = $this->hide_comments( $html );
$fonts = $this->find( '<link(?:\s+(?:(?!href\s*=\s*)[^>])+)?(?:\s+href\s*=\s*([\'"])(?<url>(?:https?:)?\/\/fonts\.googleapis\.com\/css[^\d](?:(?!\1).)+)\1)(?:\s+[^>]*)?>', $html_nocomments );
Expand All @@ -76,14 +75,6 @@ function ( $font ) use ( $exclusions ) {

$num_fonts = count( $filtered_fonts );

Logger::debug(
"Found {$num_fonts} Google Fonts after exclusions.",
[
'GF combine process',
'tags' => $filtered_fonts,
]
);

$this->parse( $filtered_fonts );

if ( empty( $this->fonts ) ) {
Expand All @@ -98,14 +89,6 @@ function ( $font ) use ( $exclusions ) {
$html = str_replace( $font[0], '', $html );
}

Logger::info(
'Google Fonts successfully combined.',
[
'GF combine process',
'url' => $this->fonts . $this->subsets,
]
);

return $html;
}

Expand Down
Loading
Loading