Index: branches/5.2.x/core/install/install_toolkit.php =================================================================== diff -u -N -r14771 -r14842 --- branches/5.2.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 14771) +++ branches/5.2.x/core/install/install_toolkit.php (.../install_toolkit.php) (revision 14842) @@ -1,6 +1,6 @@ systemConfig) ) { - return false; + return $default; } if ( !array_key_exists($key, $this->systemConfig[$section]) ) { - return false; + return $default; } - return $this->systemConfig[$section][$key] ? $this->systemConfig[$section][$key] : false; + return $this->systemConfig[$section][$key] ? $this->systemConfig[$section][$key] : $default; } /** @@ -1070,4 +1071,71 @@ // return output in case of errors return $output; } + + /** + * Returns cache handlers, that are working + * + * @param string $current + * @return Array + */ + public function getWorkingCacheHandlers($current = null) + { + if ( !isset($current) ) { + $current = $this->getSystemConfig('Misc', 'CacheHandler'); + } + + $cache_handlers = Array ( + 'Fake' => 'None', 'Memcache' => 'Memcached', 'XCache' => 'XCache', 'Apc' => 'Alternative PHP Cache' + ); + + foreach ($cache_handlers AS $class_prefix => $title) { + $handler_class = $class_prefix . 'CacheHandler'; + + if ( !class_exists($handler_class) ) { + unset($cache_handlers[$class_prefix]); + } + else { + $handler = new $handler_class('localhost:11211'); + /* @var $handler FakeCacheHandler */ + + if ( !$handler->isWorking() ) { + if ( $current == $class_prefix ) { + $cache_handlers[$class_prefix] .= ' (offline)'; + } + else { + unset($cache_handlers[$class_prefix]); + } + } + } + } + + return $cache_handlers; + } + + /** + * Returns compression engines, that are working + * + * @param string $current + * @return Array + */ + public function getWorkingCompressionEngines($current = null) + { + if ( !isset($current) ) { + $current = $this->getSystemConfig('Misc', 'CompressionEngine'); + } + + $output = shell_exec('java -version'); + $compression_engines = Array ('' => 'None', 'yui' => 'YUICompressor (Java)', 'php' => 'PHP-based'); + + if ( strpos($output, 'Java Version') === false ) { + if ( $current == 'yui' ) { + $compression_engines['yui'] .= ' (offline)'; + } + else { + unset($compression_engines['yui']); + } + } + + return $compression_engines; + } } \ No newline at end of file