Added asset_helper file and cache busting token config.

This commit is contained in:
alext 2017-11-08 15:22:30 +01:00
parent e0f49c1d54
commit 3bc482adf4
2 changed files with 41 additions and 0 deletions

View file

@ -262,6 +262,18 @@ $config['log_date_format'] = 'Y-m-d H:i:s';
*/
$config['cache_path'] = __DIR__ . '/../../storage/cache/';
/*
|--------------------------------------------------------------------------
| Cache Busting Token
|--------------------------------------------------------------------------
|
| This token will be appending to asset URLs in order to invalidate the browser
| cache and enforce end clients to fetch new files. Update the token with each
| new release.
|
*/
$config['cache_busting_token'] = 'dfsg8s09df8g098';
/*
|--------------------------------------------------------------------------
| Encryption Key

View file

@ -0,0 +1,29 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2017, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.3.0
* ---------------------------------------------------------------------------- */
/**
* Assets URL helper function.
*
* This function will create an asset file URL that includes a cache busting parameter in order
* to invalidate the browser cache in case of an update.
*
* @param string $uri Relative URI (just like the one used in the base_url helper).
* @param string|null $protocol Valid URI protocol.
*
* @return string Returns the final asset URL.
*/
function asset_url($uri = '', $protocol = NULL) {
$ci =& get_instance();
return base_url($uri . '?' . $ci->config->item('cache_busting_token'), $protocol);
}