Skip to content

Commit

Permalink
poison assets with version
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriltata committed Jul 13, 2015
1 parent 5c0aee1 commit 7925715
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Model/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function create($options) {

public function render() {
global $js;
$js = (isset($js) ? $js : '') . '<script src="' . WEBROOT . 'assets/' . (DEBUG ? 'js' : 'minified') . '/survey.js"></script>';
$js = (isset($js) ? $js : '') . '<script src="' . WEBROOT . 'assets/' . (DEBUG ? 'js' : 'minified') . '/survey.js?v='.VERSION.'"></script>';

$ret = '
<div class="row study-' . $this->id . ' study-name-'. $this->name .'">
Expand Down
27 changes: 15 additions & 12 deletions View/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<link rel="stylesheet" type="text/css" href="<?= WEBROOT ?>assets/lib/bower<?=DEBUG?"":".min"?>.css" />
<link rel="stylesheet" type="text/css" href="<?= WEBROOT ?>assets/lib/bower<?= DEBUG ? "" : ".min" ?>.css?v=<?php echo VERSION; ?>" />

<?php echo isset($css) ? $css : '' ?>
<script type="text/javascript" src="<?= WEBROOT ?>assets/<?=DEBUG?"lib":"minified"?>/bower.js"></script>

<script type="text/javascript" src="<?= WEBROOT ?>assets/<?= DEBUG ? "lib" : "minified" ?>/bower.js?v=<?php echo VERSION; ?>"></script>
<?php echo isset($js) ? $js : '' ?>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-45924096-1']);
_gaq.push(['_trackPageview']);
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-45924096-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();

</script>
</head>
Expand Down
2 changes: 2 additions & 0 deletions config_default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Formr.org configuration
*/

$settings['version'] = 'v0.7.1';

// Database Settings
$settings['database'] = array(
'datasource' => 'Database/Mysql',
Expand Down
1 change: 1 addition & 0 deletions define_root.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ function define_webroot($settings = array()) {
define('SSL', $protocol === "https://");
define('RUNROOT', WEBROOT);
define('DEBUG', Config::get('display_errors'));
define('VERSION', Config::get('version'));
}
define_webroot($settings);

0 comments on commit 7925715

Please sign in to comment.