if ($cache_dir !== false && is_writable($cache->cache_dir)) { $file_class = 'full'; $results = testCache($cache); if ($results['error'] > 0) { $file_class = 'none'; $text['file'][$file_class] = sprintf($text['file'][$file_class], $cache_dir); throw new WurflCloud_Client_Exception("Although the cache directory is writable, some of the cache tests failed."); } $text['file'][$file_class] = sprintf($text['file'][$file_class], $cache_dir, $results['write_avg'], $results['read_avg']); $file_code_sample = sprintf($code_sample, '$cache = new WurflCloud_Cache_File();'); } else { $tmp_dir = WurflCloud_Cache_File::getSystemTempDir(); if ($tmp_dir !== null && is_writable($tmp_dir)) { $file_class = 'partial'; $cache->cache_dir = $tmp_dir; $results = testCache($cache); if ($results['error'] > 0) { $file_class = 'none'; $text['file'][$file_class] = sprintf($text['file'][$file_class], $cache->cache_dir); throw new WurflCloud_Client_Exception("Although the temp cache directory is writable, some of the cache tests failed."); } $text['file'][$file_class] = sprintf($text['file'][$file_class], $cache_dir, $tmp_dir, $results['write_avg'], $results['read_avg']); $file_code_sample = sprintf($code_sample, "\$cache = new WurflCloud_Cache_File();\n\$cache->cache_dir = WurflCloud_Cache_File::getSystemTempDir();"); } else { $file_class = 'none'; $text['file'][$file_class] = sprintf($text['file'][$file_class], $cache_dir); } $user = function_exists('posix_getpwuid') ? @posix_getpwuid(posix_geteuid()) : null; if (DIRECTORY_SEPARATOR == '/' && is_array($user) && isset($user['name'])) { $text['file'][$file_class] .= "<br/><br/>You can fix this problem by changing the owner of this directory to <span class=\"icode\">{$user['name']}</span>:<br/>\r\n\t\t\t\t<span class=\"icode\">chown -R {$user['name']} {$cache_dir}</span>"; }
assertFormatterOption('maxHeight', -1); assertFormatterOption('lineNumbers', false); assertFormatterOption('lineNumbers', true); assertFormatterOption('autoLink', false); assertFormatterOption('autoLink', true); assertFormatterOption('htmlStrict', true); assertFormatterOption('htmlStrict', false); } } $sqlExecuted = false; function sql($query) { global $sqlExecuted; $sqlExecuted = true; return false; } // tests that setting the SQL function results in the SQL backend being used function testCache() { global $sqlExecuted; $sqlExecuted = false; Luminous::set('sql_function', 'sql'); // this will throw a cache not creatable warning which we don't really care // about @Luminous::highlight('plain', '123', true); assert($sqlExecuted); } testSet(); testFormatterOptions(); testCache();