? Failure

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
31 Mar 2016

Summary of Changes

This PR is for allowing to add script and stylesheet versioning with JHtml.

Testing Instructions

// Script with no version
JHtml::_('script', 'system/jquery.Jcrop.min.js', false, true);
// Script with auto version
JHtml::_('script', 'system/jquery.Jcrop.min.js', false, true, false, true, true, null);
// Script with custom version
JHtml::_('script', 'system/jquery.Jcrop.min.js', false, true, false, true, true, 'custom-version');

// Stylesheet with no version
JHtml::_('stylesheet', 'system/jquery.Jcrop.min.css', array(), true);
// Stylesheet with auto version
JHtml::_('stylesheet', 'system/jquery.Jcrop.min.css', array(), true, false, true, true, null);
// Stylesheet with custom version
JHtml::_('stylesheet', 'system/jquery.Jcrop.min.css', array(), true, false, true, true, 'custom-version');
  • Now go to any page in the admin panel
  • View the html source and check if this lines are in the html head section
<head>
[...]
<link rel="stylesheet" href="/media/system/css/jquery.Jcrop.min.css" type="text/css" />
<link rel="stylesheet" href="/media/system/css/jquery.Jcrop.min.css?<some-hash>" type="text/css" />
<link rel="stylesheet" href="/media/system/css/jquery.Jcrop.min.css?custom-version" type="text/css" />
[...]
<script src="/media/system/js/jquery.Jcrop.min.js" type="text/javascript"></script>
<script src="/media/system/js/jquery.Jcrop.min.js?<some-hash>" type="text/javascript"></script>
<script src="/media/system/js/jquery.Jcrop.min.js?custom-version" type="text/javascript"></script>
[...]
</head>
avatar andrepereiradasilva andrepereiradasilva - open - 31 Mar 2016
avatar andrepereiradasilva andrepereiradasilva - change - 31 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2016
Labels Added: ?
avatar mbabker
mbabker - comment - 31 Mar 2016

Deprecate MD5SUM if you're going to do this. Also, if you're going to do this, this needs to work in a way where both ways to add a query/version string don't collide.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

ok, will close this until i better understand how this whole thing works.

avatar andrepereiradasilva andrepereiradasilva - change - 31 Mar 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-03-31 22:43:51
Closed_By andrepereiradasilva
avatar andrepereiradasilva andrepereiradasilva - close - 31 Mar 2016
avatar andrepereiradasilva andrepereiradasilva - close - 31 Mar 2016
avatar mbabker
mbabker - comment - 31 Mar 2016

It'd be better if there was only one way to add versions. So if you're going to add support for the JDocument way to JHtml, the pre-existing way needs to be deprecated. And as long as the pre-existing way exists, it needs to not cause issues with the new way. Just by looking at this, I can tell right now I can put an MD5SUM file in a directory and end up with something like media/jui/js/bootstrap.min.js?md5sumfilecontentsstring?jdocumentgeneratedstring.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

i closed this one. i will investigate further and when i have a more complete solution i will make a PR.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

thanks for the help

avatar mbabker
mbabker - comment - 31 Mar 2016

Conceptually this isn't bad. Well, aside from the fact that both methods have excessively long signatures so specifying a version is somewhat inconvenient. But it has to account for the current API's behavior too (even if I might be the only person who knows what that behavior actually is because almost nothing in JHtml is actually documented) and as is it'll break.

Add a Comment

Login with GitHub to post a comment