function ModifyCacheSettings($return_config = false) { global $context, $scripturl, $txt, $modSettings; // Define the variables we want to edit. $config_vars = array(array('select', 'cache_enable', array($txt['cache_off'], $txt['cache_level1'], $txt['cache_level2'], $txt['cache_level3'])), array('text', 'cache_memcached')); if ($return_config) { return $config_vars; } // Saving again? if (isset($_GET['save'])) { saveDBSettings($config_vars); // We have to manually force the clearing of the cache otherwise the changed settings might not get noticed. $modSettings['cache_enable'] = 1; CacheAPI::putCache('modSettings', null, 90); redirectexit('action=admin;area=serversettings;sa=cache;' . $context['session_var'] . '=' . $context['session_id']); } $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cache;save'; $context['settings_title'] = $txt['caching_settings']; $context['settings_message'] = $txt['caching_information']; $detected = array(); // Detect an optimizer? if (function_exists('apc_store')) { $detected[] = 'APC'; } if (function_exists('output_cache_put')) { $detected[] = 'Zend'; } if (function_exists('memcache_set')) { $detected[] = 'Memcached'; } if (class_exists('Memcached')) { $detected[] = 'new_pecl_memcached'; } if (function_exists('xcache_set')) { $detected[] = 'XCache'; } if (0 == count($detected)) { $context['settings_message'] = sprintf($context['settings_message'], $txt['detected_no_caching']); } else { $msg = ''; foreach ($detected as $available) { $msg .= $txt['detected_' . $available] . '<br>'; } $context['settings_message'] = sprintf($context['settings_message'], $msg); } $engine = CacheAPI::getEngine(); $context['settings_message'] .= sprintf($txt['current_cache_engine'], $engine); // Prepare the template. prepareDBSettingContext($config_vars); }