Cache clear doesn't affect logo or favicon

Created on 5 March 2013, almost 12 years ago
Updated 27 April 2024, 8 months ago

Recommend commit message:

Issue #1934508 by jwilson3, clemens.tolboom, wesleydv, matglas86, longwave, sidharthap, superspring, MegaChriz: Make cache clear affect logo and favicon.

Problem/Motivation

Drupal has a great piece of functionality for front-end developers to force browsers to reload css and javascript. However, this same courtesy is not extended to the favicon and the logo image.

Developers using a git/svn based deployment process cannot overwrite the logo.png or favicon.ico files in a theme, deploy into a production environment, and expect the site to display the updated files because browsers that have already visited the site will pull these files from their cache.

From a front-end developer perspective, theme_get_setting does not provide any clean method to alter the data in order to add a cache-busting query string from a custom module or theme, thus the only way to ensure all browsers get a new version of these files is to either specify a separate path to a different logo or favicon file or upload a file with a different name. This can be done only via the Appearance page in the Drupal administrative user interface or by writing an update script in a custom module.

Proposed resolution

The proposed solution here appends the standard Drupal browser cache-busting string (css_js_query_string) to the logo and favicon URLs generated in theme_get_setting.

Remaining tasks

None.

User interface changes

No visible changes out of the box. But, because we've added query strings to the logo and to the favicon URLs, a net positive effect on rendering will occur when a site administrator updates the favicon or logo files on the server. A subsequent cache clear will guarantee all visitors will see the new file instead of the old file from cache.

API changes

The Drupal CSS/JS query-string internal variable has been renamed from css_js_query_string to drupal_asset_query_string, and the internal function _drupal_flush_css_js() to _drupal_flush_assets(), because both affect not only CSS and JS anymore.

โœจ Feature request
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Themeย  โ†’

Last updated about 19 hours ago

Created by

๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024