Exemple #1
0
/**
 * Advanced site settings, caching section.
 */
// simple cache
$is_simple_cache_on = (bool) elgg_get_config('simplecache_enabled');
$simple_cache_disabled_class = $is_simple_cache_on ? '' : 'elgg-state-disabled';
$params = array('label' => elgg_echo('installation:simplecache:label'), 'name' => 'simplecache_enabled', 'checked' => $is_simple_cache_on, 'switch' => true);
$simple_cache_warning = '<p class="elgg-text-help">' . elgg_echo('installation:simplecache:description') . '</p>';
if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
    $params['class'] = 'elgg-state-disabled';
    $params['label_class'] = 'elgg-state-disabled';
    $simple_cache_warning .= "<span class=\"elgg-text-help\">" . elgg_echo('admin:settings:in_settings_file') . "</span>";
}
$simple_cache_input = elgg_view("input/checkbox", $params);
$cache_symlinked = _elgg_is_cache_symlinked();
$params = array('label' => elgg_echo('installation:cache_symlink:label'), 'name' => 'cache_symlink_enabled', 'checked' => $cache_symlinked, 'class' => $simple_cache_disabled_class, 'label_class' => $simple_cache_disabled_class, 'switch' => true);
$symlink_warning = '<p class="elgg-text-help">' . elgg_echo('installation:cache_symlink:description') . '</p>';
if ($cache_symlinked) {
    $params['class'] = 'elgg-state-disabled';
    $params['label_class'] = 'elgg-state-disabled';
    $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], elgg_echo('installation:cache_symlink:warning'));
}
$symlink_input = elgg_view('input/checkbox', $params);
$symlink_source = elgg_get_root_path() . 'cache/';
$symlink_target = elgg_get_cache_path() . 'views_simplecache/';
$symlink_paths_help = elgg_echo('installation:cache_symlink:paths', [$symlink_source, $symlink_target]);
$symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], $symlink_paths_help);
// minify
$minify_description = elgg_echo('installation:minify:description');
$minify_js_input = elgg_view("input/checkbox", array('label' => elgg_echo('installation:minify_js:label'), 'name' => 'simplecache_minify_js', 'checked' => (bool) elgg_get_config('simplecache_minify_js'), 'label_class' => $simple_cache_disabled_class, 'switch' => true));
Exemple #2
0
        register_error($msg);
        forward(REFERER);
    }
}
elgg_save_config('dataroot', $dataroot);
if ('on' === get_input('simplecache_enabled')) {
    elgg_enable_simplecache();
} else {
    elgg_disable_simplecache();
}
$cache_symlinked = _elgg_is_cache_symlinked();
if ('on' === get_input('cache_symlink_enabled') && !$cache_symlinked) {
    if (!is_dir(elgg_get_root_path() . 'cache/')) {
        $cache_symlinked = symlink(elgg_get_cache_path() . 'views_simplecache/', elgg_get_root_path() . 'cache/');
    }
    if (!_elgg_is_cache_symlinked()) {
        unlink(elgg_get_root_path() . 'cache/');
        $cache_symlinked = false;
    }
    if (!$cache_symlinked) {
        register_error(elgg_echo('installation:cache_symlink:error'));
    }
}
elgg_save_config('simplecache_minify_js', 'on' === get_input('simplecache_minify_js'));
elgg_save_config('simplecache_minify_css', 'on' === get_input('simplecache_minify_css'));
if ('on' === get_input('system_cache_enabled')) {
    elgg_enable_system_cache();
} else {
    elgg_disable_system_cache();
}
elgg_save_config('default_access', (int) get_input('default_access', ACCESS_PRIVATE));