'debug_enabled' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
'backtrace' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
'fatalErrorHandler' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
+ 'assetCache' => CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME,
);
/**
*/
class AssetBuilder {
+ /**
+ * @return array
+ * Array(string $value => string $label).
+ */
+ public static function getCacheModes() {
+ return array(
+ '0' => ts('Disable'),
+ '1' => ts('Enable'),
+ 'auto' => ts('Auto'),
+ );
+ }
+
protected $cacheEnabled;
/**
*/
public function __construct($cacheEnabled = NULL) {
if ($cacheEnabled === NULL) {
- $cacheEnabled = !\CRM_Core_Config::singleton()->debug;
+ $cacheEnabled = \Civi::settings()->get('assetCache');
+ if ($cacheEnabled === 'auto') {
+ $cacheEnabled = !\CRM_Core_Config::singleton()->debug;
+ }
+ $cacheEnabled = (bool) $cacheEnabled;
}
$this->cacheEnabled = $cacheEnabled;
}
*/
return array(
+ 'assetCache' => array(
+ 'group_name' => 'Developer Preferences',
+ 'group' => 'developer',
+ 'name' => 'assetCache',
+ 'type' => 'String',
+ 'quick_form_type' => 'Select',
+ 'html_type' => 'Select',
+ 'html_attributes' => array(
+ //'class' => 'crm-select2',
+ ),
+ 'default' => 'auto',
+ 'add' => '4.7',
+ 'title' => 'Asset Caching',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'Store computed JS/CSS content in cache files? (Note: In "Auto" mode, the "Debug" setting will determine whether to activate the cache.)',
+ 'help_text' => NULL,
+ 'pseudoconstant' => array(
+ 'callback' => '\Civi\Core\AssetBuilder::getCacheModes',
+ ),
+ ),
'userFrameworkLogging' => array(
'group_name' => 'Developer Preferences',
'group' => 'developer',
<td>{$form.fatalErrorHandler.html}<br />
<span class="description">{ts}Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.{/ts}</span></td>
</tr>
+ <tr class="crm-debugging-form-block-assetCache">
+ <td class="label">{$form.assetCache.label}</td>
+ <td>{$form.assetCache.html}<br />
+ <span class="description">{ts}Store computed JS/CSS content in cache files? (Note: In "Auto" mode, the "Debug" setting will determine whether to activate the cache.){/ts}</span></td>
+ </tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
<div class="spacer"></div>