├── .gitignore ├── LICENSE.txt ├── README.md ├── composer.json ├── modman └── src └── app ├── code └── community │ └── Guidance │ └── Cachebuster │ ├── Helper │ └── Data.php │ ├── Model │ ├── Observer.php │ ├── Parser.php │ └── Source │ │ └── Urlmap.php │ └── etc │ ├── config.xml │ └── system.xml └── etc └── modules └── Guidance_Cachebuster.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # common ignores 2 | .DS_Store 3 | .buildpath 4 | .project 5 | .settings 6 | .idea 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Magento Cachebuster 2 | =================== 3 | 4 | Cachebuster is a Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community. 5 | 6 | See section "Filename-based cache busting" in: 7 | https://github.com/h5bp/server-configs-apache/blob/2.14.0/dist/.htaccess#L968 8 | 9 | URLs affected: 10 | 11 | * /js/ 12 | * /media/ 13 | * /skin/ 14 | 15 | ## Overview 16 | 17 | The module provides cachebusting by automatically altering the URI created by Magento for static files by adding the timestamp of the file to the filename: 18 | 19 | * Before: http://www.example.com/js/varien/js.js 20 | * After: http://www.example.com/js/varien/js.1324429472.js 21 | 22 | ## Example uses 23 | 24 | * Automatically invalidating cache when using Cloudfront CDN (see http://www.aschroder.com/2011/05/magento-and-amazons-cloudfront-cdn-the-easy-way/ for a great how-to) 25 | * Amazon's Cloudfront CDN can be configured to use an origin server but by it's nature will not refresh your updated file until it's cache time expires or you send an invalidation request using their API. 26 | * No more browser cache issues (ie. Them: "Where's that CSS change I requested?". You: "Oh, did you hit refresh?") 27 | * Magento's default .htaccess file uses far-future expires headers, which is good for reducing the number of requests to your server, but also means that even without a CDN you have probably experienced browser cache causing a waste of time on what turns out to be a non-issues. 28 | 29 | ## Installation 30 | 31 | * Copy module files into your application 32 | * Configure apache with the mod_rewrite rules necessary for resolving the new filenames 33 | * Enable the module in the Magento configuration 34 | 35 | ## Configuration 36 | 37 | This module is configured via the "System" configuration section: 38 | 39 | System -> Configuration -> Advanced -> System -> Cachebuster Settings 40 | 41 | * **Enable cachebuster** 42 | * Enables the module behavior which rewrites URLs on the frontend. It is important that your mod_rewrite rules are configured before enabling this setting. 43 | * **File extensions** 44 | * Comma-separated list of file extensions which will be rewritten with timestamp applied. Extensions configured here must be defined in your rewrite rule. 45 | 46 | **Note:** Behavior only takes affect on the frontend, admin area static file urls are not processed 47 | 48 | ## mod_rewrite configuration 49 | 50 | The following mod_rewrite rules need to be enabled for your store when using this module, potentially via `.htaccess` file or Virtualhost definition. 51 | 52 | 53 | 54 | ############################################ 55 | ## rewrite files for magento cachebuster 56 | 57 | RewriteCond %{REQUEST_FILENAME} !-f 58 | RewriteCond %{REQUEST_FILENAME} !-d 59 | RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpeg|jpg|gif)$ $1.$3 [L] 60 | 61 | 62 | 63 | If you are using the default media `.htaccess` file which routes missing URLs through Magento's `get.php` for downloadable products you will also need to add these rules to your `.htaccess` file in the `/media/` directory. 64 | 65 | **Note:** This rewrite condition in the media directory will break the protection provided by downloadable products for the extensions listed. If your store sells downloadable products with one of the above extensions you will likely need to tweak these conditions. 66 | 67 | ## nginx configuration 68 | 69 | For nginx you will need to add a rule like the following to your site definition. 70 | 71 | location ~* (.+)\.(\d+)\.(js|css|png|jpg|jpeg|gif)$ { 72 | try_files $uri $1.$3; 73 | } 74 | 75 | ## License 76 | 77 | Licensed under the Apache License, Version 2.0 78 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "guidance/cachebuster", 3 | "type": "magento-module", 4 | "license": "Apache-2.0", 5 | "description": "A Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.", 6 | "authors": [ 7 | { 8 | "name": "Gordon Knoppe", 9 | "email": "gordon@knoppe.net" 10 | } 11 | ], 12 | "require": { 13 | "magento-hackathon/magento-composer-installer": "*" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | # Guidance_Cachebuster 2 | src/app/etc/modules/Guidance_Cachebuster.xml app/etc/modules/Guidance_Cachebuster.xml 3 | src/app/code/community/Guidance/Cachebuster app/code/community/Guidance/Cachebuster 4 | -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/Helper/Data.php: -------------------------------------------------------------------------------- 1 | _fileExtensions)) { 68 | $config = Mage::getStoreConfig(self::XML_PATH_FILE_EXTENSIONS); 69 | $this->_fileExtensions = array_map('trim', explode(',', $config)); 70 | } 71 | return $this->_fileExtensions; 72 | } 73 | 74 | /** 75 | * Get configured string parser instance 76 | * 77 | * @return Guidance_Cachebuster_Model_Parser 78 | */ 79 | public function getParser() 80 | { 81 | $urlKeys= $this->_getUrlKeys(); 82 | $urlMap = array(); 83 | 84 | if (!empty($urlKeys)) { 85 | 86 | $urlKeys = explode(',', $urlKeys); 87 | 88 | foreach ($urlKeys as $urlKey) { 89 | $urlMap[Mage::getBaseUrl($urlKey)] = Mage::getBaseDir() . '/' . $urlKey . '/'; 90 | } 91 | } 92 | 93 | /** @var Guidance_Cachebuster_Model_Parser $parser */ 94 | $config = array( 95 | 'urlMap' => $urlMap, 96 | 'fileExtensions' => $this->enabledFileExtensions() 97 | ); 98 | $parser = Mage::getModel('guidance_cachebuster/parser', $config); 99 | return $parser; 100 | } 101 | 102 | /** 103 | * Get configured URL keys 104 | * 105 | * @return mixed 106 | */ 107 | protected function _getUrlKeys() 108 | { 109 | $urls = Mage::getStoreConfig(self::XML_PATH_FILE_URL_KEYS); 110 | return $urls; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/Model/Observer.php: -------------------------------------------------------------------------------- 1 | isEnabled()) { 38 | return; 39 | } 40 | $parser = $helper->getParser(); 41 | $response = $observer->getControllerAction()->getResponse(); 42 | $body = $parser->parseHtml($response->getBody()); 43 | $response->setBody($body); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/Model/Parser.php: -------------------------------------------------------------------------------- 1 | 4 | * @category Guidance 5 | * @package Cachebuster 6 | * @copyright Copyright (c) 2015 Gordon Knoppe 7 | */ 8 | 9 | class Guidance_Cachebuster_Model_Parser 10 | { 11 | /** 12 | * URL maps cache 13 | * 14 | * @var array */ 15 | protected $_maps = array(); 16 | 17 | /** 18 | * File extensions cache 19 | * 20 | * @var array 21 | */ 22 | protected $_fileExtensions = array(); 23 | 24 | /** 25 | * Guidance_Cachebuster_Model_Parser constructor. 26 | * 27 | * @param array $config 28 | */ 29 | public function __construct($config = array()) 30 | { 31 | if (isset($config['urlMap'])) { 32 | $this->setMaps($config['urlMap']); 33 | } 34 | if (isset($config['fileExtensions'])) { 35 | $this->setFileExtensions($config['fileExtensions']); 36 | } 37 | } 38 | 39 | /** 40 | * Parse given html 41 | * 42 | * @param string $html 43 | * @return mixed|string 44 | */ 45 | public function parseHtml($html = '') 46 | { 47 | $find = $processed = array(); 48 | 49 | // Get urls to add timestamps to by map type 50 | $urls = $this->_parseUrls($html); 51 | 52 | foreach ($urls as $urlKey => $foundUrls) { 53 | 54 | // File system path for urlKey 55 | $path = $this->getPathByUrl($urlKey); 56 | 57 | foreach ($foundUrls as $url) { 58 | // Skip this url if it has already been processed 59 | if (isset($processed[$url])) { 60 | continue; 61 | } 62 | 63 | $timeStampedUrl = $this->_addTimestampToUrl($url, $urlKey, $path); 64 | 65 | if ($url != $timeStampedUrl) { 66 | $find[$url] = $timeStampedUrl; 67 | $processed[$url] = true; 68 | } 69 | } 70 | } 71 | 72 | // Search and replace html 73 | if (count($find)) { 74 | $html = str_replace(array_keys($find), array_values($find), $html); 75 | } 76 | 77 | // Return html 78 | return $html; 79 | } 80 | 81 | /** 82 | * Add timestamp to the filename portion of URL using $basePath to determine timestamp for URL 83 | * 84 | * @param $url 85 | * @param $baseUrl 86 | * @param $basePath 87 | * @return mixed|string 88 | */ 89 | protected function _addTimestampToUrl($url, $baseUrl, $basePath) 90 | { 91 | $url = $this->_sanitizeUrl($url); 92 | $baseUrl = $this->_sanitizeUrl($baseUrl); 93 | 94 | $path = str_replace($baseUrl, $basePath, $url); 95 | $pathinfo = pathinfo($path); 96 | 97 | if (empty($pathinfo['extension']) || empty($pathinfo['filename']) || empty($pathinfo['basename']) 98 | || !in_array($pathinfo['extension'], $this->getFileExtensions()) 99 | || !file_exists($path) 100 | ) { 101 | return $url; 102 | } 103 | 104 | $timestamp = filemtime($path); 105 | 106 | $final = array( 107 | $pathinfo['filename'], 108 | $timestamp, 109 | $pathinfo['extension'], 110 | ); 111 | 112 | return str_replace($pathinfo['basename'], implode('.', $final), $url); 113 | } 114 | 115 | /** 116 | * Sanitize URL by removing query, fragment, user, or pass if found 117 | * 118 | * @param $url 119 | * @return string 120 | */ 121 | protected function _sanitizeUrl($url) 122 | { 123 | $url = parse_url($url); 124 | $scheme = isset($url['scheme']) ? $url['scheme'] . '://' : ''; 125 | $host = isset($url['host']) ? $url['host'] : ''; 126 | $port = isset($url['port']) ? ':' . $url['port'] : ''; 127 | $path = isset($url['path']) ? $url['path'] : ''; 128 | return "$scheme$host$port$path"; 129 | } 130 | 131 | /** 132 | * Parse URLs in given string 133 | * 134 | * @param string $html 135 | * @return array 136 | */ 137 | protected function _parseUrls($html) 138 | { 139 | // Urls extracted from html by map type 140 | $urls = array(); 141 | 142 | foreach (array_keys($this->getMaps()) as $url) { 143 | $matches = array(); 144 | $regex = "|${url}[^\"\'\s]*|"; 145 | 146 | preg_match_all($regex, $html, $matches); 147 | 148 | if (isset($matches[0]) && is_array($matches[0]) && count($matches[0])) { 149 | $urls[$url] = $matches[0]; 150 | } 151 | } 152 | return $urls; 153 | } 154 | 155 | /** 156 | * Add URL and path mapping 157 | * 158 | * @param $url 159 | * @param $path 160 | * @return $this 161 | */ 162 | public function addMap($url, $path) 163 | { 164 | $this->validate($url, $path); 165 | $this->_maps[$url] = $path; 166 | return $this; 167 | } 168 | 169 | /** 170 | * Get configured URL and path mappings 171 | * 172 | * @return array 173 | */ 174 | public function getMaps() 175 | { 176 | return $this->_maps; 177 | } 178 | 179 | /** 180 | * Get file path from URL based on mapping 181 | * 182 | * @param string $url 183 | * @return string 184 | */ 185 | public function getPathByUrl($url) 186 | { 187 | return $this->_maps[$url]; 188 | } 189 | 190 | /** 191 | * Set URL maps 192 | * 193 | * @param array $maps 194 | * @return $this 195 | */ 196 | public function setMaps($maps = array()) 197 | { 198 | if (!is_array($maps) || empty($maps)) { 199 | throw new InvalidArgumentException('Maps must be an array of type "url" => "path"'); 200 | } 201 | foreach ($maps as $url => $path) { 202 | $this->validate($url, $path); 203 | } 204 | $this->_maps = $maps; 205 | return $this; 206 | } 207 | 208 | /** 209 | * Set file extensions for parsing 210 | * 211 | * @param array $extensions 212 | * @return $this 213 | */ 214 | public function setFileExtensions($extensions = array()) 215 | { 216 | if (!is_array($extensions) || empty($extensions)) { 217 | throw new InvalidArgumentException('Extensions must be a non empty array'); 218 | } 219 | $this->_fileExtensions = $extensions; 220 | return $this; 221 | } 222 | 223 | /** 224 | * Get file extensions configured for parsing 225 | * 226 | * @return array 227 | */ 228 | public function getFileExtensions() 229 | { 230 | return $this->_fileExtensions; 231 | } 232 | 233 | /** 234 | * Validate given URL and path for processing 235 | * 236 | * @param string $url 237 | * @param string $path 238 | * @return $this 239 | * @throws InvalidArgumentException 240 | */ 241 | protected function validate($url, $path) 242 | { 243 | if (!filter_var($url, FILTER_VALIDATE_URL)) { 244 | throw new InvalidArgumentException('url must be a valid url, given: ' . $url); 245 | } 246 | if (!file_exists($path)) { 247 | throw new InvalidArgumentException('path must be a valid path which exists: ' . $path . ' not found'); 248 | } 249 | return $this; 250 | } 251 | } -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/Model/Source/Urlmap.php: -------------------------------------------------------------------------------- 1 | Mage_Core_Model_Store::URL_TYPE_JS, 'label' => '/js/'), 37 | array('value' => Mage_Core_Model_Store::URL_TYPE_MEDIA, 'label' => '/media/'), 38 | array('value' => Mage_Core_Model_Store::URL_TYPE_SKIN, 'label' => '/skin/'), 39 | ); 40 | 41 | return $options; 42 | } 43 | } -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 1.0.1 31 | 32 | 33 | 34 | 35 | 36 | Guidance_Cachebuster_Helper 37 | 38 | 39 | 40 | 41 | Guidance_Cachebuster_Model 42 | 43 | 44 | 45 | 46 | 47 | 48 | 0 49 | js,media,skin 50 | js,css,png,jpeg,jpg,gif 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | singleton 60 | guidance_cachebuster/observer 61 | controller_action_postdispatch 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/app/code/community/Guidance/Cachebuster/etc/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 1 34 | 1 35 | 1 36 | 800 37 | 38 | 39 | 40 | select 41 | adminhtml/system_config_source_yesno 42 | adminhtml/system_config_backend_cache 43 | 5 44 | 1 45 | 1 46 | 1 47 | 48 | 49 | 50 | multiselect 51 | guidance_cachebuster/source_urlmap 52 | 10 53 | 1 54 | 1 55 | 1 56 | 57 | 58 | 59 | text 60 | 20 61 | 1 62 | 1 63 | 1 64 | List of file extensions to add cachebusting timestamps to, comma-separated 65 | (ex: js,css,png,jpg,gif). This should match the file extensions declared in your .htaccess file 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/app/etc/modules/Guidance_Cachebuster.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | true 31 | community 32 | 33 | 34 | --------------------------------------------------------------------------------