When you upgrade Joomla and some JS / CSS file have been updated
Is there a reason that we do not append to the URLs:
?v=somehashvalue
There have been several invalid reports here, because of browser cache serving older JS / CSS files after Joomla is upgraded
I see about Joomla CMS version number
Then we could append a hash value that is calculated on
?v=hashValue
Like I said, we already have two APIs which is supposed to support this:
JDocument::addScriptVersion() and JDocument::addStyleSheetVersion() within the JDocument API
JHtml::includeRelativeFiles() within the JHtml API (called via JHtml::script()
, JHtml::stylesheet()
, and JHtml::image()
)
If neither of those APIs are working, fix them. Don't add another way to do it. Please. We have too many duplicated APIs like this already.
sorry, i did not mean that they do not work,
i was asking why they are not used by Joomla CMS by default
Labels |
Added:
?
|
Category | ⇒ | Templates (admin) Templates (site) |
Actually JHtml::script()
JHtml::stylesheet()
JHtml::image()
dont allow to use query string in the $file
arg :/
I guess @mbabker means this: https://github.com/joomla/joomla-cms/blob/3.4.4/libraries/cms/html/html.php#L362-L496 with a MD5SUM file not adding a query string ;)
Exactly that. If there is a file named MD5SUM
in the folder where the resource being called via the JHtml helpers resides at, the contents of that file (which should be a calculated hash based on the contents of the directory and changed anytime something in that directory changes) will be appended as the query string.
As for why they are not used by default, why does every media file require a query string by default?
why does every media file require a query string by default?
Actually @ggppdk answered to this question in advance:
When you upgrade Joomla and some JS / CSS file have been updated
any users [...] will get the old versions of the files from the browser cache.
In my opinion, the query string should contain by default the timestamp of the resource.
For the cache purpose, it is equivalent to an hash, but it is faster than calculating an hash.
If anyone is looking on information how to use the MDSUM
file:
put such file in the assets folder and inside a md5 checksum of all assets contents.
About default behaviour
Using a string based on file's modification or creation time
and also all proxies since - 5 years versions support query strings in the CSS / JS resources URLs
The code to do this was created a long time ago #1618 if i am correct
On 18 December 2015 at 20:20, Georgios Papadakis notifications@github.com
wrote:
About default behaviour
Using a string based on file's modification or creation time
- will not give out any info,
- will cost almost nothing in time, since file will be read anyway by the server,
- while it will avoid stale CSS / JS after upgrades that this topic is about
and also all proxies since - 5 years versions support query strings in the
CSS / JS resources URLs—
Reply to this email directly or view it on GitHub
#8118 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Title |
|
Checking 3.5beta 2 I see that both template.css and template.js have a version type parameter
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-02-19 12:59:10 |
Closed_By | ⇒ | brianteeman |
1) We should not use the CMS version number as that string ever.
2) We have at least 2 APIs that are supposed to be doing this that depend
on different things being set up correctly (and ironically I'm pretty sure
neither are used right).
On Tuesday, October 20, 2015, Georgios Papadakis notifications@github.com
wrote: