Skip to content

Commit 741af5d

Browse files
authored
release: small fixes
* Addressed an issue that caused slower performance for URLs not using the offloading feature.
2 parents 3b5ed99 + 13750d9 commit 741af5d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

inc/app_replacer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ abstract class Optml_App_Replacer {
5959
* @var Optml_Settings $settings
6060
*/
6161
public $settings = null;
62+
/**
63+
* Cached offloading status.
64+
*
65+
* @var null|bool Offload status.
66+
*/
67+
public static $offload_enabled = null;
6268
/**
6369
* Defines if the dimensions should be limited when images are served.
6470
*
@@ -356,6 +362,9 @@ function ( $strings = [] ) {
356362
},
357363
10
358364
);
365+
if ( self::$offload_enabled === null ) {
366+
self::$offload_enabled = ( new Optml_Settings() )->is_offload_enabled();
367+
}
359368
}
360369

361370

inc/url_replacer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ private function is_dam_url( $url ) {
383383
private function is_offloaded_url( $source_url ) {
384384
$attachment_id = 0;
385385

386+
if ( ! self::$offload_enabled ) {
387+
return 0;
388+
}
386389
if ( strpos( $source_url, Optml_Media_Offload::KEYS['not_processed_flag'] ) !== false ) {
387390
$attachment_id = (int) Optml_Media_Offload::get_attachment_id_from_url( $source_url );
388391
} else {

0 commit comments

Comments
 (0)