Index: t3lib/config_default.php =================================================================== --- t3lib/config_default.php (revision 7247) +++ t3lib/config_default.php (working copy) @@ -257,6 +257,7 @@ 'flexformForceCDATA' => 0, // Boolean: If set, will add CDATA to Flexform XML. Some versions of libxml have a bug that causes HTML entities to be stripped from any XML content and this setting will avoid the bug by adding CDATA. 'explicitConfirmationOfTranslation' => FALSE, // If set, then the diff-data of localized records is not saved automatically when updated but requires that a translator clicks the special finish_translation/save/close button that becomes available. 'elementVersioningOnly' => FALSE, // If true, only element versioning is allowed in the backend. This is recommended for new installations of TYPO3 4.2+ since "page" and "branch" versioning types are known for the drawbacks of loosing ids and "element" type versions supports moving now. + 'useInfileVersionNumbering' => FALSE, // Boolean. If true, CSS and JS files will have filename modified to include the filemtime in the filename, ie. filename.1269312081.js - requires use of .htaccess rule. If false the filemtime will be appended as a query-string. 'AJAX' => array( // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information. 'SC_alt_db_navframe::expandCollapse' => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse', 'SC_alt_file_navframe::expandCollapse' => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse', @@ -337,6 +338,7 @@ 'eID_include' => array(), // Array of key/value pairs where key is "tx_[ext]_[optional suffix]" and value is relative filename of class to include. Key is used as "?eID=" for index_ts.php to include the code file which renders the page from that point. (Useful for functionality that requires a low initialization footprint, eg. frontend ajax applications) 'disableNoCacheParameter' => FALSE, // Boolean. If set, the no_cache request parameter will become ineffective. This is currently still an experimental feature and will require a website only with plugins that don't use this parameter. However, using "&no_cache=1" should be avoided anyway because there are better ways to disable caching for a certain part of the website (see COA_INT/USER_INT documentation in TSref). 'workspacePreviewLogoutTemplate' => '', // If set, points to an HTML file relative to the TYPO3_site root which will be read and outputted as template for this message. Example: fileadmin/templates/template_workspace_preview_logout.html. Inside you can put the marker %1$s to insert the URL to go back to. Use this in Go back... links + 'useInfileVersionNumbering' => FALSE, // Boolean. If true, CSS and JS files will have filename modified to include the filemtime in the filename, ie. filename.1269312081.js - requires use of .htaccess rule. If false the filemtime will be appended as a query-string. Not yet fully implemented. 'XCLASS' => array(), // See 'Inside TYPO3' document for more information. ), 'MODS' => array( // Backend Module Configuration (obsolete, make extension instead) Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 7247) +++ t3lib/class.t3lib_div.php (working copy) @@ -3343,6 +3343,53 @@ } + /** + * Function for static version numbers on files, based on the filemtime + * This will make the filename automatically change when a file is changed, and by that re-cached by the browser + * If the file does not exist physically the original file passed to the function is returned without the timestamp + * + * @param string $file Relative path to file + * @return Relative path with version filename including the timestamp + * @author Lars Houmark + */ + public static function createVersionNumberedFile($file) { + + // start by splitting up the querystring, the part after ? will break filemtime lookup / mainly done for scriptaculous + // it will be added back in the end... + $lookupFile = explode('?', $file); + $path = self::resolveBackPath(self::dirname(PATH_thisScript) .'/'. $lookupFile[0]); + + // if use of .htaccess rule is not configured, we use the default query-string method + if ($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['useInfileVersionNumbering'] != TRUE) { + + if ($lookupFile[1]) { + $separator = '&'; + } else { + $separator = '?'; + } + + $fullName = $file . $separator . filemtime($path); + + } else { + + $name = explode('.', $lookupFile[0]); + $extension = array_pop($name); + + if (file_exists($path)) { + array_push($name, filemtime($path), $extension); + $fullName = implode('.', $name); + // if there was a querystring in the filename, we need to append it to the current string + $fullName .= $lookupFile[1] ? '?'. $lookupFile[1] : ''; + + } else { + // file was not found on given location, we will return the path given to this function + $fullName = $file; + } + + } + + return $fullName; + } @@ -3352,7 +3399,6 @@ - /************************* * * DEBUG helper FUNCTIONS Index: t3lib/class.t3lib_pagerenderer.php =================================================================== --- t3lib/class.t3lib_pagerenderer.php (revision 7247) +++ t3lib/class.t3lib_pagerenderer.php (working copy) @@ -1001,6 +1001,9 @@ if (count($this->cssFiles)) { foreach ($this->cssFiles as $file => $properties) { $file = htmlspecialchars(t3lib_div::resolveBackPath($file)); + if (TYPO3_MODE == 'BE') { + $file = t3lib_div::createVersionNumberedFile($file); + } $tag = ''; if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) { $tag = str_replace('|', $tag, $properties['allWrap']); @@ -1031,6 +1034,9 @@ $properties['file'] = htmlspecialchars( t3lib_div::resolveBackPath($properties['file']) ); + if (TYPO3_MODE == 'BE') { + $properties['file'] = t3lib_div::createVersionNumberedFile($properties['file']); + } $tag = ''; if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) { $tag = str_replace('|', $tag, $properties['allWrap']); @@ -1055,6 +1061,9 @@ if (count($this->jsFiles)) { foreach ($this->jsFiles as $file => $properties) { $file = htmlspecialchars(t3lib_div::resolveBackPath($file)); + if (TYPO3_MODE == 'BE') { + $file = t3lib_div::createVersionNumberedFile($file); + } $tag = ''; if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) { $tag = str_replace('|', $tag, $properties['allWrap']); @@ -1162,7 +1171,7 @@ $out = ''; if ($this->addPrototype) { - $out .= '' . chr(10); + $out .= '' . chr(10); unset($this->jsFiles[$this->backPath . 'contrib/prototype/prototype.js']); } @@ -1181,22 +1190,21 @@ if (count($mods)) { $moduleLoadString = '?load=' . implode(',', $mods); } - - $out .= '' . chr(10); + $out .= '' . chr(10); unset($this->jsFiles[$this->backPath . 'contrib/scriptaculous/scriptaculous.js' . $moduleLoadString]); } // include extCore if ($this->addExtCore) { - $out .= '' . chr(10); + $out .= '' . chr(10); unset($this->jsFiles[$this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js']); } // include extJS if ($this->addExtJS) { // use the base adapter all the time - $out .= '' . chr(10); - $out .= '' . chr(10); + $out .= '' . chr(10); + $out .= '' . chr(10); // add extJS localization $localeMap = $this->csConvObj->isoArray; // load standard ISO mapping and modify for use with ExtJS @@ -1211,7 +1219,7 @@ // TODO autoconvert file from UTF8 to current BE charset if necessary!!!! $extJsLocaleFile = 'contrib/extjs/locale/ext-lang-' . $extJsLang . '.js'; if (file_exists(PATH_typo3 . $extJsLocaleFile)) { - $out .= '' . chr(10); + $out .= '' . chr(10); } Index: typo3/alt_main.php =================================================================== --- typo3/alt_main.php (revision 7247) +++ typo3/alt_main.php (working copy) @@ -498,8 +498,8 @@ $this->generateJScode(); $GLOBALS['TBE_TEMPLATE']->JScode= ' - - + + '; $GLOBALS['TBE_TEMPLATE']->JScode.=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->mainJScode); Index: typo3/backend.php =================================================================== --- typo3/backend.php (revision 7247) +++ typo3/backend.php (working copy) @@ -237,7 +237,7 @@ foreach($this->jsFilesAfterInline as $jsFile) { $GLOBALS['TBE_TEMPLATE']->JScode .= ' - '; + '; } Index: typo3/sysext/t3editor/classes/class.tx_t3editor.php =================================================================== --- typo3/sysext/t3editor/classes/class.tx_t3editor.php (revision 7247) +++ typo3/sysext/t3editor/classes/class.tx_t3editor.php (working copy) @@ -126,9 +126,9 @@ // include editor-css $content .= ''; // include editor-js-lib Index: typo3/sysext/cms/tslib/class.tslib_content.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_content.php (revision 7247) +++ typo3/sysext/cms/tslib/class.tslib_content.php (working copy) @@ -6989,7 +6989,7 @@ /*]]>*/ '; - $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']=''; + $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']=''; return $JSPart; } Index: typo3/sysext/cms/layout/db_layout.php =================================================================== --- typo3/sysext/cms/layout/db_layout.php (revision 7247) +++ typo3/sysext/cms/layout/db_layout.php (working copy) @@ -426,7 +426,7 @@ $this->doc->setModuleTemplate('templates/db_layout.html'); // JavaScript: - $this->doc->JScode = ''; + $this->doc->JScode = ''; $this->doc->JScode.= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).'; Index: typo3/sysext/recycler/mod1/index.php =================================================================== --- typo3/sysext/recycler/mod1/index.php (revision 7247) +++ typo3/sysext/recycler/mod1/index.php (working copy) @@ -158,7 +158,7 @@ */ protected function loadStylesheet($fileName) { $fileName = t3lib_div::resolveBackPath($this->doc->backPath . $fileName); - $this->doc->JScode.= "\t" . '' . "\n"; + $this->doc->JScode.= "\t" . '' . "\n"; } /** @@ -169,7 +169,7 @@ */ protected function loadJavaScript($fileName) { $fileName = t3lib_div::resolveBackPath($this->doc->backPath . $fileName); - $this->doc->JScode.= "\t" . '' . "\n"; + $this->doc->JScode.= "\t" . '' . "\n"; } /**