This media version is used to append to Joomla core media in order to
think the files are renewed. The media version is renewed after Joomla
core update, install, discover_install and uninstallation.
The basic reason is that browsers cache CSS and JS files, so you could have the following situation:
- a user accesses a Joomla site, and the CSS and JS files are downloaded to the user's browser
- the Joomla instance is upgraded, which involves changing the content of several CSS and JS files, but the filenames remain the same
- the user accesses the newly-updated site, but the new CSS and JS files aren't reloaded because the user's browser uses the cached versions instead.
If the media version is used, then the
src attribute of the
<script> tag will be different after the upgrade, and the browser will load the new file.
So if you're developing an extension yourself it's worthwhile using this mechanism with your own CSS and JS files, by using the
array('version' => 'auto') option described in the question. This is because Joomla updates the media version when anything is installed or reinstalled on the instance, not just Joomla core.
As mentioned in the other answer, the media version is stored in the
extensions table, in the
params field of the record with
name LIB_JOOMLA. And a new media version is created upon every HTTP request if JDEBUG is enabled.
Looking at the code, the media version is generated from factors including the Joomla version, the Joomla instance
secret and the current date/time when the media version is generated.