auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -304,7 +304,8 @@ class Image_Helper {
*/
public function get_attachment_by_url( $url, $use_link_table = true ) {
// Don't try to do this for external URLs.
if ( $this->url_helper->get_link_type( $url ) === SEO_Links::TYPE_EXTERNAL ) {
$parsed_url = \wp_parse_url( $url );
if ( $this->url_helper->get_link_type( $parsed_url ) === SEO_Links::TYPE_EXTERNAL ) {
return 0;
}
@@ -332,8 +333,15 @@ class Image_Helper {
if ( ! $use_link_table ) {
return WPSEO_Image_Utils::get_attachment_by_url( $url );
}
$cache_key = 'attachment_seo_link_object_' . \md5( $url );
$link = $this->seo_links_repository->find_one_by_url( $url );
$found = false;
$link = \wp_cache_get( $cache_key, 'yoast-seo-attachment-link', false, $found );
if ( $found === false ) {
$link = $this->seo_links_repository->find_one_by_url( $url );
\wp_cache_set( $cache_key, $link, 'yoast-seo-attachment-link', \MINUTE_IN_SECONDS );
}
if ( ! \is_a( $link, SEO_Links::class ) ) {
return WPSEO_Image_Utils::get_attachment_by_url( $url );
}