К новейшей редакции | Содержимое файла | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
304 | alex-w | 1 | <?php |
2 | |||
3 | /** |
||
4 | * Smarty plugin |
||
5 | * |
||
6 | * @ignore |
||
7 | * @package Smarty |
||
8 | * @subpackage plugins |
||
9 | */ |
||
10 | |||
11 | function test($smarty) |
||
12 | { |
||
13 | echo "<PRE>\n"; |
||
14 | |||
15 | echo "Smarty Installation test...\n"; |
||
16 | |||
17 | echo "Testing template directory...\n"; |
||
18 | |||
19 | foreach((array)$smarty->template_dir as $template_dir) { |
||
20 | if (!is_dir($template_dir)) |
||
21 | echo "FAILED: $template_dir is not a directory.\n"; |
||
22 | elseif (!is_readable($template_dir)) |
||
23 | echo "FAILED: $template_dir is not readable.\n"; |
||
24 | else |
||
25 | echo "$template_dir is OK.\n"; |
||
26 | } |
||
27 | |||
28 | echo "Testing compile directory...\n"; |
||
29 | |||
30 | if (!is_dir($smarty->compile_dir)) |
||
31 | echo "FAILED: $smarty->compile_dir is not a directory.\n"; |
||
32 | elseif (!is_readable($smarty->compile_dir)) |
||
33 | echo "FAILED: $smarty->compile_dir is not readable.\n"; |
||
34 | elseif (!is_writable($smarty->compile_dir)) |
||
35 | echo "FAILED: $smarty->compile_dir is not writable.\n"; |
||
36 | else |
||
37 | echo "{$smarty->compile_dir} is OK.\n"; |
||
38 | |||
39 | echo "Testing plugins directory...\n"; |
||
40 | |||
41 | foreach((array)$smarty->plugins_dir as $plugin_dir) { |
||
42 | if (!is_dir($plugin_dir)) |
||
43 | echo "FAILED: $plugin_dir is not a directory.\n"; |
||
44 | elseif (!is_readable($plugin_dir)) |
||
45 | echo "FAILED: $plugin_dir is not readable.\n"; |
||
46 | else |
||
47 | echo "$plugin_dir is OK.\n"; |
||
48 | } |
||
49 | |||
50 | echo "Testing cache directory...\n"; |
||
51 | |||
52 | if (!is_dir($smarty->cache_dir)) |
||
53 | echo "FAILED: $smarty->cache_dir is not a directory.\n"; |
||
54 | elseif (!is_readable($smarty->cache_dir)) |
||
55 | echo "FAILED: $smarty->cache_dir is not readable.\n"; |
||
56 | elseif (!is_writable($smarty->cache_dir)) |
||
57 | echo "FAILED: $smarty->cache_dir is not writable.\n"; |
||
58 | else |
||
59 | echo "{$smarty->cache_dir} is OK.\n"; |
||
60 | |||
61 | echo "Testing configs directory...\n"; |
||
62 | |||
63 | if (!is_dir($smarty->config_dir)) |
||
64 | echo "FAILED: $smarty->config_dir is not a directory.\n"; |
||
65 | elseif (!is_readable($smarty->config_dir)) |
||
66 | echo "FAILED: $smarty->config_dir is not readable.\n"; |
||
67 | else |
||
68 | echo "{$smarty->config_dir} is OK.\n"; |
||
69 | |||
70 | echo "Tests complete.\n"; |
||
71 | |||
72 | echo "</PRE>\n"; |
||
73 | |||
74 | return true; |
||
75 | } |
||
76 | |||
77 | ?> |