PageRenderTime 27ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/Smarty/sysplugins/smarty_internal_testinstall.php

https://gitlab.com/dleonov/my-framework-two
PHP | 603 lines | 559 code | 16 blank | 28 comment | 58 complexity | ca143b61832f5118aa3bf0d494af7786 MD5 | raw file
  1. <?php
  2. /**
  3. * Smarty Internal TestInstall
  4. * Test Smarty installation
  5. *
  6. * @package Smarty
  7. * @subpackage Utilities
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * TestInstall class
  12. *
  13. * @package Smarty
  14. * @subpackage Utilities
  15. */
  16. class Smarty_Internal_TestInstall
  17. {
  18. /**
  19. * diagnose Smarty setup
  20. * If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
  21. *
  22. * @param \Smarty $smarty
  23. * @param array $errors array to push results into rather than outputting them
  24. *
  25. * @return bool status, true if everything is fine, false else
  26. */
  27. public static function testInstall(Smarty $smarty, &$errors = null)
  28. {
  29. $status = true;
  30. if ($errors === null) {
  31. echo "<PRE>\n";
  32. echo "Smarty Installation test...\n";
  33. echo "Testing template directory...\n";
  34. }
  35. $_stream_resolve_include_path = function_exists('stream_resolve_include_path');
  36. // test if all registered template_dir are accessible
  37. foreach ($smarty->getTemplateDir() as $template_dir) {
  38. $_template_dir = $template_dir;
  39. $template_dir = realpath($template_dir);
  40. // resolve include_path or fail existence
  41. if (!$template_dir) {
  42. if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) {
  43. // try PHP include_path
  44. if ($_stream_resolve_include_path) {
  45. $template_dir = stream_resolve_include_path($_template_dir);
  46. } else {
  47. $template_dir = $smarty->ext->_getIncludePath->getIncludePath($_template_dir, null, $smarty);
  48. }
  49. if ($template_dir !== false) {
  50. if ($errors === null) {
  51. echo "$template_dir is OK.\n";
  52. }
  53. continue;
  54. } else {
  55. $status = false;
  56. $message =
  57. "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)";
  58. if ($errors === null) {
  59. echo $message . ".\n";
  60. } else {
  61. $errors[ 'template_dir' ] = $message;
  62. }
  63. continue;
  64. }
  65. } else {
  66. $status = false;
  67. $message = "FAILED: $_template_dir does not exist";
  68. if ($errors === null) {
  69. echo $message . ".\n";
  70. } else {
  71. $errors[ 'template_dir' ] = $message;
  72. }
  73. continue;
  74. }
  75. }
  76. if (!is_dir($template_dir)) {
  77. $status = false;
  78. $message = "FAILED: $template_dir is not a directory";
  79. if ($errors === null) {
  80. echo $message . ".\n";
  81. } else {
  82. $errors[ 'template_dir' ] = $message;
  83. }
  84. } elseif (!is_readable($template_dir)) {
  85. $status = false;
  86. $message = "FAILED: $template_dir is not readable";
  87. if ($errors === null) {
  88. echo $message . ".\n";
  89. } else {
  90. $errors[ 'template_dir' ] = $message;
  91. }
  92. } else {
  93. if ($errors === null) {
  94. echo "$template_dir is OK.\n";
  95. }
  96. }
  97. }
  98. if ($errors === null) {
  99. echo "Testing compile directory...\n";
  100. }
  101. // test if registered compile_dir is accessible
  102. $__compile_dir = $smarty->getCompileDir();
  103. $_compile_dir = realpath($__compile_dir);
  104. if (!$_compile_dir) {
  105. $status = false;
  106. $message = "FAILED: {$__compile_dir} does not exist";
  107. if ($errors === null) {
  108. echo $message . ".\n";
  109. } else {
  110. $errors[ 'compile_dir' ] = $message;
  111. }
  112. } elseif (!is_dir($_compile_dir)) {
  113. $status = false;
  114. $message = "FAILED: {$_compile_dir} is not a directory";
  115. if ($errors === null) {
  116. echo $message . ".\n";
  117. } else {
  118. $errors[ 'compile_dir' ] = $message;
  119. }
  120. } elseif (!is_readable($_compile_dir)) {
  121. $status = false;
  122. $message = "FAILED: {$_compile_dir} is not readable";
  123. if ($errors === null) {
  124. echo $message . ".\n";
  125. } else {
  126. $errors[ 'compile_dir' ] = $message;
  127. }
  128. } elseif (!is_writable($_compile_dir)) {
  129. $status = false;
  130. $message = "FAILED: {$_compile_dir} is not writable";
  131. if ($errors === null) {
  132. echo $message . ".\n";
  133. } else {
  134. $errors[ 'compile_dir' ] = $message;
  135. }
  136. } else {
  137. if ($errors === null) {
  138. echo "{$_compile_dir} is OK.\n";
  139. }
  140. }
  141. if ($errors === null) {
  142. echo "Testing plugins directory...\n";
  143. }
  144. // test if all registered plugins_dir are accessible
  145. // and if core plugins directory is still registered
  146. $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins');
  147. $_core_plugins_available = false;
  148. foreach ($smarty->getPluginsDir() as $plugin_dir) {
  149. $_plugin_dir = $plugin_dir;
  150. $plugin_dir = realpath($plugin_dir);
  151. // resolve include_path or fail existence
  152. if (!$plugin_dir) {
  153. if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
  154. // try PHP include_path
  155. if ($_stream_resolve_include_path) {
  156. $plugin_dir = stream_resolve_include_path($_plugin_dir);
  157. } else {
  158. $plugin_dir = $smarty->ext->_getIncludePath->getIncludePath($_plugin_dir, null, $smarty);
  159. }
  160. if ($plugin_dir !== false) {
  161. if ($errors === null) {
  162. echo "$plugin_dir is OK.\n";
  163. }
  164. continue;
  165. } else {
  166. $status = false;
  167. $message = "FAILED: $_plugin_dir does not exist (and couldn't be found in include_path either)";
  168. if ($errors === null) {
  169. echo $message . ".\n";
  170. } else {
  171. $errors[ 'plugins_dir' ] = $message;
  172. }
  173. continue;
  174. }
  175. } else {
  176. $status = false;
  177. $message = "FAILED: $_plugin_dir does not exist";
  178. if ($errors === null) {
  179. echo $message . ".\n";
  180. } else {
  181. $errors[ 'plugins_dir' ] = $message;
  182. }
  183. continue;
  184. }
  185. }
  186. if (!is_dir($plugin_dir)) {
  187. $status = false;
  188. $message = "FAILED: $plugin_dir is not a directory";
  189. if ($errors === null) {
  190. echo $message . ".\n";
  191. } else {
  192. $errors[ 'plugins_dir' ] = $message;
  193. }
  194. } elseif (!is_readable($plugin_dir)) {
  195. $status = false;
  196. $message = "FAILED: $plugin_dir is not readable";
  197. if ($errors === null) {
  198. echo $message . ".\n";
  199. } else {
  200. $errors[ 'plugins_dir' ] = $message;
  201. }
  202. } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) {
  203. $_core_plugins_available = true;
  204. if ($errors === null) {
  205. echo "$plugin_dir is OK.\n";
  206. }
  207. } else {
  208. if ($errors === null) {
  209. echo "$plugin_dir is OK.\n";
  210. }
  211. }
  212. }
  213. if (!$_core_plugins_available) {
  214. $status = false;
  215. $message = "WARNING: Smarty's own libs/plugins is not available";
  216. if ($errors === null) {
  217. echo $message . ".\n";
  218. } elseif (!isset($errors[ 'plugins_dir' ])) {
  219. $errors[ 'plugins_dir' ] = $message;
  220. }
  221. }
  222. if ($errors === null) {
  223. echo "Testing cache directory...\n";
  224. }
  225. // test if all registered cache_dir is accessible
  226. $__cache_dir = $smarty->getCacheDir();
  227. $_cache_dir = realpath($__cache_dir);
  228. if (!$_cache_dir) {
  229. $status = false;
  230. $message = "FAILED: {$__cache_dir} does not exist";
  231. if ($errors === null) {
  232. echo $message . ".\n";
  233. } else {
  234. $errors[ 'cache_dir' ] = $message;
  235. }
  236. } elseif (!is_dir($_cache_dir)) {
  237. $status = false;
  238. $message = "FAILED: {$_cache_dir} is not a directory";
  239. if ($errors === null) {
  240. echo $message . ".\n";
  241. } else {
  242. $errors[ 'cache_dir' ] = $message;
  243. }
  244. } elseif (!is_readable($_cache_dir)) {
  245. $status = false;
  246. $message = "FAILED: {$_cache_dir} is not readable";
  247. if ($errors === null) {
  248. echo $message . ".\n";
  249. } else {
  250. $errors[ 'cache_dir' ] = $message;
  251. }
  252. } elseif (!is_writable($_cache_dir)) {
  253. $status = false;
  254. $message = "FAILED: {$_cache_dir} is not writable";
  255. if ($errors === null) {
  256. echo $message . ".\n";
  257. } else {
  258. $errors[ 'cache_dir' ] = $message;
  259. }
  260. } else {
  261. if ($errors === null) {
  262. echo "{$_cache_dir} is OK.\n";
  263. }
  264. }
  265. if ($errors === null) {
  266. echo "Testing configs directory...\n";
  267. }
  268. // test if all registered config_dir are accessible
  269. foreach ($smarty->getConfigDir() as $config_dir) {
  270. $_config_dir = $config_dir;
  271. // resolve include_path or fail existence
  272. if (!$config_dir) {
  273. if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) {
  274. // try PHP include_path
  275. if ($_stream_resolve_include_path) {
  276. $config_dir = stream_resolve_include_path($_config_dir);
  277. } else {
  278. $config_dir = $smarty->ext->_getIncludePath->getIncludePath($_config_dir, null, $smarty);
  279. }
  280. if ($config_dir !== false) {
  281. if ($errors === null) {
  282. echo "$config_dir is OK.\n";
  283. }
  284. continue;
  285. } else {
  286. $status = false;
  287. $message = "FAILED: $_config_dir does not exist (and couldn't be found in include_path either)";
  288. if ($errors === null) {
  289. echo $message . ".\n";
  290. } else {
  291. $errors[ 'config_dir' ] = $message;
  292. }
  293. continue;
  294. }
  295. } else {
  296. $status = false;
  297. $message = "FAILED: $_config_dir does not exist";
  298. if ($errors === null) {
  299. echo $message . ".\n";
  300. } else {
  301. $errors[ 'config_dir' ] = $message;
  302. }
  303. continue;
  304. }
  305. }
  306. if (!is_dir($config_dir)) {
  307. $status = false;
  308. $message = "FAILED: $config_dir is not a directory";
  309. if ($errors === null) {
  310. echo $message . ".\n";
  311. } else {
  312. $errors[ 'config_dir' ] = $message;
  313. }
  314. } elseif (!is_readable($config_dir)) {
  315. $status = false;
  316. $message = "FAILED: $config_dir is not readable";
  317. if ($errors === null) {
  318. echo $message . ".\n";
  319. } else {
  320. $errors[ 'config_dir' ] = $message;
  321. }
  322. } else {
  323. if ($errors === null) {
  324. echo "$config_dir is OK.\n";
  325. }
  326. }
  327. }
  328. if ($errors === null) {
  329. echo "Testing sysplugin files...\n";
  330. }
  331. // test if sysplugins are available
  332. $source = SMARTY_SYSPLUGINS_DIR;
  333. if (is_dir($source)) {
  334. $expectedSysplugins = array('smartycompilerexception.php' => true,
  335. 'smartyexception.php' => true,
  336. 'smarty_cacheresource.php' => true,
  337. 'smarty_cacheresource_custom.php' => true,
  338. 'smarty_cacheresource_keyvaluestore.php' => true,
  339. 'smarty_data.php' => true,
  340. 'smarty_internal_block.php' => true,
  341. 'smarty_internal_cacheresource_file.php' => true,
  342. 'smarty_internal_compilebase.php' => true,
  343. 'smarty_internal_compile_append.php' => true,
  344. 'smarty_internal_compile_assign.php' => true,
  345. 'smarty_internal_compile_block.php' => true,
  346. 'smarty_internal_compile_break.php' => true,
  347. 'smarty_internal_compile_call.php' => true,
  348. 'smarty_internal_compile_capture.php' => true,
  349. 'smarty_internal_compile_config_load.php' => true,
  350. 'smarty_internal_compile_continue.php' => true,
  351. 'smarty_internal_compile_debug.php' => true,
  352. 'smarty_internal_compile_eval.php' => true,
  353. 'smarty_internal_compile_extends.php' => true,
  354. 'smarty_internal_compile_for.php' => true,
  355. 'smarty_internal_compile_foreach.php' => true,
  356. 'smarty_internal_compile_function.php' => true,
  357. 'smarty_internal_compile_if.php' => true,
  358. 'smarty_internal_compile_include.php' => true,
  359. 'smarty_internal_compile_include_php.php' => true,
  360. 'smarty_internal_compile_insert.php' => true,
  361. 'smarty_internal_compile_ldelim.php' => true,
  362. 'smarty_internal_compile_nocache.php' => true,
  363. 'smarty_internal_compile_private_block_plugin.php' => true,
  364. 'smarty_internal_compile_private_foreachsection.php' => true,
  365. 'smarty_internal_compile_private_function_plugin.php' => true,
  366. 'smarty_internal_compile_private_modifier.php' => true,
  367. 'smarty_internal_compile_private_object_block_function.php' => true,
  368. 'smarty_internal_compile_private_object_function.php' => true,
  369. 'smarty_internal_compile_private_php.php' => true,
  370. 'smarty_internal_compile_private_print_expression.php' => true,
  371. 'smarty_internal_compile_private_registered_block.php' => true,
  372. 'smarty_internal_compile_private_registered_function.php' => true,
  373. 'smarty_internal_compile_private_special_variable.php' => true,
  374. 'smarty_internal_compile_rdelim.php' => true,
  375. 'smarty_internal_compile_section.php' => true,
  376. 'smarty_internal_compile_setfilter.php' => true,
  377. 'smarty_internal_compile_shared_inheritance.php' => true,
  378. 'smarty_internal_compile_while.php' => true,
  379. 'smarty_internal_configfilelexer.php' => true,
  380. 'smarty_internal_configfileparser.php' => true,
  381. 'smarty_internal_config_file_compiler.php' => true,
  382. 'smarty_internal_data.php' => true,
  383. 'smarty_internal_debug.php' => true,
  384. 'smarty_internal_extension_clear.php' => true,
  385. 'smarty_internal_extension_handler.php' => true,
  386. 'smarty_internal_method_addautoloadfilters.php' => true,
  387. 'smarty_internal_method_adddefaultmodifiers.php' => true,
  388. 'smarty_internal_method_append.php' => true,
  389. 'smarty_internal_method_appendbyref.php' => true,
  390. 'smarty_internal_method_assignbyref.php' => true,
  391. 'smarty_internal_method_assignglobal.php' => true,
  392. 'smarty_internal_method_clearallassign.php' => true,
  393. 'smarty_internal_method_clearallcache.php' => true,
  394. 'smarty_internal_method_clearassign.php' => true,
  395. 'smarty_internal_method_clearcache.php' => true,
  396. 'smarty_internal_method_clearcompiledtemplate.php' => true,
  397. 'smarty_internal_method_clearconfig.php' => true,
  398. 'smarty_internal_method_compileallconfig.php' => true,
  399. 'smarty_internal_method_compilealltemplates.php' => true,
  400. 'smarty_internal_method_configload.php' => true,
  401. 'smarty_internal_method_createdata.php' => true,
  402. 'smarty_internal_method_getautoloadfilters.php' => true,
  403. 'smarty_internal_method_getconfigvars.php' => true,
  404. 'smarty_internal_method_getdebugtemplate.php' => true,
  405. 'smarty_internal_method_getdefaultmodifiers.php' => true,
  406. 'smarty_internal_method_getglobal.php' => true,
  407. 'smarty_internal_method_getregisteredobject.php' => true,
  408. 'smarty_internal_method_getstreamvariable.php' => true,
  409. 'smarty_internal_method_gettags.php' => true,
  410. 'smarty_internal_method_gettemplatevars.php' => true,
  411. 'smarty_internal_method_loadfilter.php' => true,
  412. 'smarty_internal_method_loadplugin.php' => true,
  413. 'smarty_internal_method_mustcompile.php' => true,
  414. 'smarty_internal_method_registercacheresource.php' => true,
  415. 'smarty_internal_method_registerclass.php' => true,
  416. 'smarty_internal_method_registerdefaultconfighandler.php' => true,
  417. 'smarty_internal_method_registerdefaultpluginhandler.php' => true,
  418. 'smarty_internal_method_registerdefaulttemplatehandler.php' => true,
  419. 'smarty_internal_method_registerfilter.php' => true,
  420. 'smarty_internal_method_registerobject.php' => true,
  421. 'smarty_internal_method_registerplugin.php' => true,
  422. 'smarty_internal_method_registerresource.php' => true,
  423. 'smarty_internal_method_setautoloadfilters.php' => true,
  424. 'smarty_internal_method_setdebugtemplate.php' => true,
  425. 'smarty_internal_method_setdefaultmodifiers.php' => true,
  426. 'smarty_internal_method_unloadfilter.php' => true,
  427. 'smarty_internal_method_unregistercacheresource.php' => true,
  428. 'smarty_internal_method_unregisterfilter.php' => true,
  429. 'smarty_internal_method_unregisterobject.php' => true,
  430. 'smarty_internal_method_unregisterplugin.php' => true,
  431. 'smarty_internal_method_unregisterresource.php' => true,
  432. 'smarty_internal_nocache_insert.php' => true,
  433. 'smarty_internal_parsetree.php' => true,
  434. 'smarty_internal_parsetree_code.php' => true,
  435. 'smarty_internal_parsetree_dq.php' => true,
  436. 'smarty_internal_parsetree_dqcontent.php' => true,
  437. 'smarty_internal_parsetree_tag.php' => true,
  438. 'smarty_internal_parsetree_template.php' => true,
  439. 'smarty_internal_parsetree_text.php' => true,
  440. 'smarty_internal_resource_eval.php' => true,
  441. 'smarty_internal_resource_extends.php' => true,
  442. 'smarty_internal_resource_file.php' => true,
  443. 'smarty_internal_resource_php.php' => true,
  444. 'smarty_internal_resource_registered.php' => true,
  445. 'smarty_internal_resource_stream.php' => true,
  446. 'smarty_internal_resource_string.php' => true,
  447. 'smarty_internal_runtime_cachemodify.php' => true,
  448. 'smarty_internal_runtime_codeframe.php' => true,
  449. 'smarty_internal_runtime_filterhandler.php' => true,
  450. 'smarty_internal_runtime_foreach.php' => true,
  451. 'smarty_internal_runtime_getincludepath.php' => true,
  452. 'smarty_internal_runtime_inheritance.php' => true,
  453. 'smarty_internal_runtime_tplfunction.php' => true,
  454. 'smarty_internal_runtime_updatecache.php' => true,
  455. 'smarty_internal_runtime_updatescope.php' => true,
  456. 'smarty_internal_runtime_writefile.php' => true,
  457. 'smarty_internal_smartytemplatecompiler.php' => true,
  458. 'smarty_internal_template.php' => true,
  459. 'smarty_internal_templatebase.php' => true,
  460. 'smarty_internal_templatecompilerbase.php' => true,
  461. 'smarty_internal_templatelexer.php' => true,
  462. 'smarty_internal_templateparser.php' => true,
  463. 'smarty_internal_testinstall.php' => true,
  464. 'smarty_internal_undefined.php' => true,
  465. 'smarty_resource.php' => true,
  466. 'smarty_resource_custom.php' => true,
  467. 'smarty_resource_recompiled.php' => true,
  468. 'smarty_resource_uncompiled.php' => true,
  469. 'smarty_security.php' => true,
  470. 'smarty_template_cached.php' => true,
  471. 'smarty_template_compiled.php' => true,
  472. 'smarty_template_config.php' => true,
  473. 'smarty_template_resource_base.php' => true,
  474. 'smarty_template_source.php' => true,
  475. 'smarty_undefined_variable.php' => true,
  476. 'smarty_variable.php' => true,);
  477. $iterator = new DirectoryIterator($source);
  478. foreach ($iterator as $file) {
  479. if (!$file->isDot()) {
  480. $filename = $file->getFilename();
  481. if (isset($expectedSysplugins[ $filename ])) {
  482. unset($expectedSysplugins[ $filename ]);
  483. }
  484. }
  485. }
  486. if ($expectedSysplugins) {
  487. $status = false;
  488. $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expectedSysplugins));
  489. if ($errors === null) {
  490. echo $message . ".\n";
  491. } else {
  492. $errors[ 'sysplugins' ] = $message;
  493. }
  494. } elseif ($errors === null) {
  495. echo "... OK\n";
  496. }
  497. } else {
  498. $status = false;
  499. $message = "FAILED: " . SMARTY_SYSPLUGINS_DIR . ' is not a directory';
  500. if ($errors === null) {
  501. echo $message . ".\n";
  502. } else {
  503. $errors[ 'sysplugins_dir_constant' ] = $message;
  504. }
  505. }
  506. if ($errors === null) {
  507. echo "Testing plugin files...\n";
  508. }
  509. // test if core plugins are available
  510. $source = SMARTY_PLUGINS_DIR;
  511. if (is_dir($source)) {
  512. $expectedPlugins =
  513. array('block.textformat.php' => true, 'function.counter.php' => true,
  514. 'function.cycle.php' => true, 'function.fetch.php' => true,
  515. 'function.html_checkboxes.php' => true, 'function.html_image.php' => true,
  516. 'function.html_options.php' => true, 'function.html_radios.php' => true,
  517. 'function.html_select_date.php' => true, 'function.html_select_time.php' => true,
  518. 'function.html_table.php' => true, 'function.mailto.php' => true,
  519. 'function.math.php' => true, 'modifier.capitalize.php' => true,
  520. 'modifier.date_format.php' => true, 'modifier.debug_print_var.php' => true,
  521. 'modifier.escape.php' => true, 'modifier.regex_replace.php' => true,
  522. 'modifier.replace.php' => true, 'modifier.spacify.php' => true,
  523. 'modifier.truncate.php' => true, 'modifiercompiler.cat.php' => true,
  524. 'modifiercompiler.count_characters.php' => true, 'modifiercompiler.count_paragraphs.php' => true,
  525. 'modifiercompiler.count_sentences.php' => true, 'modifiercompiler.count_words.php' => true,
  526. 'modifiercompiler.default.php' => true, 'modifiercompiler.escape.php' => true,
  527. 'modifiercompiler.from_charset.php' => true, 'modifiercompiler.indent.php' => true,
  528. 'modifiercompiler.lower.php' => true, 'modifiercompiler.noprint.php' => true,
  529. 'modifiercompiler.string_format.php' => true, 'modifiercompiler.strip.php' => true,
  530. 'modifiercompiler.strip_tags.php' => true, 'modifiercompiler.to_charset.php' => true,
  531. 'modifiercompiler.unescape.php' => true, 'modifiercompiler.upper.php' => true,
  532. 'modifiercompiler.wordwrap.php' => true, 'outputfilter.trimwhitespace.php' => true,
  533. 'shared.escape_special_chars.php' => true, 'shared.literal_compiler_param.php' => true,
  534. 'shared.make_timestamp.php' => true, 'shared.mb_str_replace.php' => true,
  535. 'shared.mb_unicode.php' => true, 'shared.mb_wordwrap.php' => true,
  536. 'variablefilter.htmlspecialchars.php' => true,);
  537. $iterator = new DirectoryIterator($source);
  538. foreach ($iterator as $file) {
  539. if (!$file->isDot()) {
  540. $filename = $file->getFilename();
  541. if (isset($expectedPlugins[ $filename ])) {
  542. unset($expectedPlugins[ $filename ]);
  543. }
  544. }
  545. }
  546. if ($expectedPlugins) {
  547. $status = false;
  548. $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expectedPlugins));
  549. if ($errors === null) {
  550. echo $message . ".\n";
  551. } else {
  552. $errors[ 'plugins' ] = $message;
  553. }
  554. } elseif ($errors === null) {
  555. echo "... OK\n";
  556. }
  557. } else {
  558. $status = false;
  559. $message = "FAILED: " . SMARTY_PLUGINS_DIR . ' is not a directory';
  560. if ($errors === null) {
  561. echo $message . ".\n";
  562. } else {
  563. $errors[ 'plugins_dir_constant' ] = $message;
  564. }
  565. }
  566. if ($errors === null) {
  567. echo "Tests complete.\n";
  568. echo "</PRE>\n";
  569. }
  570. return $status;
  571. }
  572. }