Elgg  Version 4.3
caching.php
Go to the documentation of this file.
1 <?php
6 // simple cache
7 $is_simple_cache_on = (bool) elgg_get_config('simplecache_enabled');
8 
9 $params = [
10  '#type' => 'checkbox',
11  '#label' => elgg_echo('installation:simplecache:label'),
12  '#help' => elgg_echo('installation:simplecache:description'),
13  'name' => 'simplecache_enabled',
14  'switch' => true,
15 ];
16 
17 if (elgg()->config->hasInitialValue('simplecache_enabled')) {
18  $params['disabled'] = true;
19 
20  // set checked state based on value in settings.php
21  $is_simple_cache_on = (bool) elgg()->config->getInitialValue('simplecache_enabled');
22 
23  $params['#help'] .= ' ' . elgg_echo('admin:settings:in_settings_file');
24 }
25 
27 $simple_cache_disabled_class = $is_simple_cache_on ? '' : 'elgg-state-disabled';
28 
30 
32 
33 $help = elgg_echo('installation:cache_symlink:description');
34 $help .= elgg_echo('installation:cache_symlink:paths', [elgg_get_root_path() . 'cache/', elgg_get_asset_path()]);
35 if ($cache_symlinked) {
36  $help .= elgg_format_element('p', [], elgg_echo('installation:cache_symlink:warning'));
37 }
38 
40  '#type' => 'checkbox',
41  '#label' => elgg_echo('installation:cache_symlink:label'),
42  '#help' => $help,
43  'name' => 'cache_symlink_enabled',
44  'checked' => $cache_symlinked,
45  'disabled' => !$is_simple_cache_on,
46  'switch' => true,
47 ]);
48 
49 // minify
50 $minify_help = elgg_echo('installation:minify:description');
52  '#type' => 'checkbox',
53  '#label' => elgg_echo('installation:minify_js:label'),
54  '#help' => $minify_help,
55  'name' => 'simplecache_minify_js',
56  'checked' => (bool) elgg_get_config('simplecache_minify_js'),
57  'disabled' => !$is_simple_cache_on,
58  'label_class' => $simple_cache_disabled_class,
59  'switch' => true,
60 ]);
61 
63  '#type' => 'checkbox',
64  '#label' => elgg_echo('installation:minify_css:label'),
65  '#help' => $minify_help,
66  'name' => 'simplecache_minify_css',
67  'checked' => (bool) elgg_get_config('simplecache_minify_css'),
68  'disabled' => !$is_simple_cache_on,
69  'label_class' => $simple_cache_disabled_class,
70  'switch' => true,
71 ]);
72 
74  '#type' => 'checkbox',
75  '#label' => elgg_echo('installation:systemcache:label'),
76  '#help' => elgg_echo('installation:systemcache:description'),
77  '#class' => 'mtm',
78  'name' => 'system_cache_enabled',
79  'switch' => true,
80  'checked' => elgg_is_system_cache_enabled(),
81 ]);
82 
83 echo elgg_view_module('info', elgg_echo('admin:legend:caching'), $body, ['id' => 'elgg-settings-advanced-caching']);
$params
Definition: caching.php:9
_elgg_is_cache_symlinked()
Checks if /cache directory has been symlinked to views simplecache directory.
Definition: cache.php:226
elgg_get_asset_path()
Get the asset cache directory path for this installation, ending with slash.
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1143
$is_simple_cache_on
Advanced site settings, caching section.
Definition: caching.php:7
$help
Definition: caching.php:33
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
$simple_cache_disabled_class
Definition: caching.php:27
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:944
elgg_get_root_path()
Get the project path (where composer is installed), ending with slash.
$minify_help
Definition: caching.php:50
elgg_is_system_cache_enabled()
Is system cache enabled.
Definition: cache.php:66
$cache_symlinked
Definition: caching.php:31
elgg echo
Translates a string.
Definition: deprecated.js:530
$body
Definition: caching.php:29
var elgg
Definition: elgglib.js:4
elgg_get_config($name, $default=null)
Get an Elgg configuration value.