? ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
2 Apr 2022

Summary of Changes

Change getMediaVersion to use Infinity Cache instead of doing 1 useless DB query every time.

Reduce 1 db query for production installation, and 2 db query in debug mode.

Testing Instructions

Apply patch and make sure MediaVersion added to every script, and all works as before.

Go to "clear cache" page and remove _media_version group, then check MediaVersion in to every script again, it should be new now.

Documentation Changes Required

None

avatar Fedik Fedik - open - 2 Apr 2022
avatar Fedik Fedik - change - 2 Apr 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2022
Category Libraries
avatar dgrammatiko
dgrammatiko - comment - 2 Apr 2022

I have tested this item successfully on 7a03b55


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37457.

FWIW https://invalidate-cache.dgrammatiko.dev v0.0.10 supports this 4.2 feature

avatar dgrammatiko dgrammatiko - test_item - 2 Apr 2022 - Tested successfully
avatar laoneo
laoneo - comment - 2 Apr 2022

I don't think so that nowadays writing a cache file with our cache setup is faster than a db call. But I like the new possibility to regenerate the media version by clearing the cache.

avatar HLeithner
HLeithner - comment - 2 Apr 2022

having it cached instead in the database is much better, but what I think is that the thing is conceptional wrong isn't? I mean we still add the cms version to external libraries right?

avatar Fedik
Fedik - comment - 2 Apr 2022

we still add the cms version to external libraries right?

yes, and no, when WebAsset have a defined version, then it will be used instead of our MediaVersion.
Example this one (from media/vendor/joomla.asset.json):

{
      "name": "awesomplete",
      "type": "script",
      "uri": "vendor/awesomplete/awesomplete.min.js",
      "attributes": {
        "defer": true
      },
      "package": "awesomplete",
      "version": "1.1.5"
 },

Will be as media/vendor/awesomplete/js/awesomplete.min.js?1.1.5

avatar dgrammatiko
dgrammatiko - comment - 2 Apr 2022

@HLeithner just to add to what @Fedik said about the static version number:

The only exceptions, that still use the media version string are:

  • templates
  • any script or stylesheet that is added programmatically with WAM (eg without loading a relative joomla.asset.json file)
  • all the legacy HTMLHelper::script/stylesheet/etc that have an option for version
  • the legacy $doc->sddScriptVersion and $doc->addStylesheetVersion methods
  • almost anything 3rd PD

The templates in order to use a file content hash based version need some adjustment in the com_templates file editing view (didn't do that with child templates as it was getting to complicated for the testing)
The sporadic files (mainly in the plugins IIRC) just need a joomla.asset.json file and adjusting the way they are imported.

I hope this clears things up

avatar JonasAtZwetschke
JonasAtZwetschke - comment - 7 Apr 2022

I have tested this item successfully on 7a03b55


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37457.

avatar JonasAtZwetschke JonasAtZwetschke - test_item - 7 Apr 2022 - Tested successfully
avatar richard67 richard67 - change - 8 Apr 2022
Status Pending Ready to Commit
Labels Added: ?
avatar richard67
richard67 - comment - 8 Apr 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37457.

avatar laoneo laoneo - change - 8 Apr 2022
Labels Added: ?
avatar laoneo laoneo - close - 8 Apr 2022
avatar laoneo laoneo - merge - 8 Apr 2022
avatar laoneo laoneo - change - 8 Apr 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-04-08 12:15:44
Closed_By laoneo
avatar laoneo
laoneo - comment - 8 Apr 2022

Thanks!

Add a Comment

Login with GitHub to post a comment