- update testinstall()

This commit is contained in:
uwetews
2015-10-26 01:27:06 +01:00
parent 6e3d94c13e
commit 862b23fe52

View File

@@ -7,6 +7,7 @@
* @subpackage Utilities * @subpackage Utilities
* @author Uwe Tews * @author Uwe Tews
*/ */
/** /**
* TestInstall class * TestInstall class
* *
@@ -19,7 +20,7 @@ class Smarty_Internal_TestInstall
* diagnose Smarty setup * diagnose Smarty setup
* If $errors is secified, the diagnostic report will be appended to the array, rather than being output. * If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
* *
* @param array $errors array to push results into rather than outputting them * @param array $errors array to push results into rather than outputting them
* *
* @return bool status, true if everything is fine, false else * @return bool status, true if everything is fine, false else
*/ */
@@ -57,7 +58,8 @@ class Smarty_Internal_TestInstall
continue; continue;
} else { } else {
$status = false; $status = false;
$message = "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)"; $message =
"FAILED: $_template_dir does not exist (and couldn't be found in include_path either)";
if ($errors === null) { if ($errors === null) {
echo $message . ".\n"; echo $message . ".\n";
} else { } else {
@@ -356,103 +358,165 @@ class Smarty_Internal_TestInstall
// test if sysplugins are available // test if sysplugins are available
$source = SMARTY_SYSPLUGINS_DIR; $source = SMARTY_SYSPLUGINS_DIR;
if (is_dir($source)) { if (is_dir($source)) {
$expected = array( $expectedSysplugins = array('smartycompilerexception.php' => true,
"smarty_cacheresource.php" => true, 'smartyexception.php' => true,
"smarty_cacheresource_custom.php" => true, 'smarty_cacheresource.php' => true,
"smarty_cacheresource_keyvaluestore.php" => true, 'smarty_cacheresource_custom.php' => true,
"smarty_data.php" => true, 'smarty_cacheresource_keyvaluestore.php' => true,
"smarty_internal_cacheresource_file.php" => true, 'smarty_data.php' => true,
"smarty_internal_compile_append.php" => true, 'smarty_internal_cacheresource_file.php' => true,
"smarty_internal_compile_assign.php" => true, 'smarty_internal_compilebase.php' => true,
"smarty_internal_compile_block.php" => true, 'smarty_internal_compile_append.php' => true,
"smarty_internal_compile_break.php" => true, 'smarty_internal_compile_assign.php' => true,
"smarty_internal_compile_call.php" => true, 'smarty_internal_compile_block.php' => true,
"smarty_internal_compile_capture.php" => true, 'smarty_internal_compile_break.php' => true,
"smarty_internal_compile_config_load.php" => true, 'smarty_internal_compile_call.php' => true,
"smarty_internal_compile_continue.php" => true, 'smarty_internal_compile_capture.php' => true,
"smarty_internal_compile_debug.php" => true, 'smarty_internal_compile_config_load.php' => true,
"smarty_internal_compile_eval.php" => true, 'smarty_internal_compile_continue.php' => true,
"smarty_internal_compile_extends.php" => true, 'smarty_internal_compile_debug.php' => true,
"smarty_internal_compile_for.php" => true, 'smarty_internal_compile_eval.php' => true,
"smarty_internal_compile_foreach.php" => true, 'smarty_internal_compile_extends.php' => true,
"smarty_internal_compile_function.php" => true, 'smarty_internal_compile_for.php' => true,
"smarty_internal_compile_if.php" => true, 'smarty_internal_compile_foreach.php' => true,
"smarty_internal_compile_include.php" => true, 'smarty_internal_compile_function.php' => true,
"smarty_internal_compile_include_php.php" => true, 'smarty_internal_compile_if.php' => true,
"smarty_internal_compile_insert.php" => true, 'smarty_internal_compile_include.php' => true,
"smarty_internal_compile_ldelim.php" => true, 'smarty_internal_compile_include_php.php' => true,
"smarty_internal_compile_nocache.php" => true, 'smarty_internal_compile_insert.php' => true,
"smarty_internal_compile_private_block_plugin.php" => true, 'smarty_internal_compile_ldelim.php' => true,
"smarty_internal_compile_private_function_plugin.php" => true, 'smarty_internal_compile_nocache.php' => true,
"smarty_internal_compile_private_modifier.php" => true, 'smarty_internal_compile_private_block_plugin.php' => true,
"smarty_internal_compile_private_object_block_function.php" => true, 'smarty_internal_compile_private_foreachsection.php' => true,
"smarty_internal_compile_private_object_function.php" => true, 'smarty_internal_compile_private_function_plugin.php' => true,
"smarty_internal_compile_private_print_expression.php" => true, 'smarty_internal_compile_private_modifier.php' => true,
"smarty_internal_compile_private_registered_block.php" => true, 'smarty_internal_compile_private_object_block_function.php' => true,
"smarty_internal_compile_private_registered_function.php" => true, 'smarty_internal_compile_private_object_function.php' => true,
"smarty_internal_compile_private_special_variable.php" => true, 'smarty_internal_compile_private_php.php' => true,
"smarty_internal_compile_rdelim.php" => true, 'smarty_internal_compile_private_print_expression.php' => true,
"smarty_internal_compile_section.php" => true, 'smarty_internal_compile_private_registered_block.php' => true,
"smarty_internal_compile_setfilter.php" => true, 'smarty_internal_compile_private_registered_function.php' => true,
"smarty_internal_compile_while.php" => true, 'smarty_internal_compile_private_special_variable.php' => true,
"smarty_internal_compilebase.php" => true, 'smarty_internal_compile_rdelim.php' => true,
"smarty_internal_config_file_compiler.php" => true, 'smarty_internal_compile_section.php' => true,
"smarty_internal_configfilelexer.php" => true, 'smarty_internal_compile_setfilter.php' => true,
"smarty_internal_configfileparser.php" => true, 'smarty_internal_compile_shared_inheritance.php' => true,
"smarty_internal_data.php" => true, 'smarty_internal_compile_while.php' => true,
"smarty_internal_debug.php" => true, 'smarty_internal_configfilelexer.php' => true,
"smarty_internal_extension_codeframe.php" => true, 'smarty_internal_configfileparser.php' => true,
"smarty_internal_filter_handler.php" => true, 'smarty_internal_config_file_compiler.php' => true,
"smarty_internal_function_call_handler.php" => true, 'smarty_internal_data.php' => true,
"smarty_internal_get_include_path.php" => true, 'smarty_internal_debug.php' => true,
"smarty_internal_nocache_insert.php" => true, 'smarty_internal_extension_clear.php' => true,
"smarty_internal_parsetree.php" => true, 'smarty_internal_extension_handler.php' => true,
"smarty_internal_parsetree_code.php" => true, 'smarty_internal_method_addautoloadfilters.php' => true,
"smarty_internal_parsetree_dq.php" => true, 'smarty_internal_method_adddefaultmodifiers.php' => true,
"smarty_internal_parsetree_dqcontent.php" => true, 'smarty_internal_method_append.php' => true,
"smarty_internal_parsetree_tag.php" => true, 'smarty_internal_method_appendbyref.php' => true,
"smarty_internal_parsetree_template.php" => true, 'smarty_internal_method_assignbyref.php' => true,
"smarty_internal_parsetree_text.php" => true, 'smarty_internal_method_assignglobal.php' => true,
"smarty_internal_resource_eval.php" => true, 'smarty_internal_method_clearallassign.php' => true,
"smarty_internal_resource_extends.php" => true, 'smarty_internal_method_clearallcache.php' => true,
"smarty_internal_resource_file.php" => true, 'smarty_internal_method_clearassign.php' => true,
"smarty_internal_resource_php.php" => true, 'smarty_internal_method_clearcache.php' => true,
"smarty_internal_resource_registered.php" => true, 'smarty_internal_method_clearcompiledtemplate.php' => true,
"smarty_internal_resource_stream.php" => true, 'smarty_internal_method_clearconfig.php' => true,
"smarty_internal_resource_string.php" => true, 'smarty_internal_method_compileallconfig.php' => true,
"smarty_internal_smartytemplatecompiler.php" => true, 'smarty_internal_method_compilealltemplates.php' => true,
"smarty_internal_template.php" => true, 'smarty_internal_method_configload.php' => true,
"smarty_internal_templatebase.php" => true, 'smarty_internal_method_createdata.php' => true,
"smarty_internal_templatecompilerbase.php" => true, 'smarty_internal_method_getautoloadfilters.php' => true,
"smarty_internal_templatelexer.php" => true, 'smarty_internal_method_getconfigvars.php' => true,
"smarty_internal_templateparser.php" => true, 'smarty_internal_method_getdebugtemplate.php' => true,
"smarty_internal_write_file.php" => true, 'smarty_internal_method_getdefaultmodifiers.php' => true,
"smarty_resource.php" => true, 'smarty_internal_method_getregisteredobject.php' => true,
"smarty_resource_custom.php" => true, 'smarty_internal_method_getstreamvariable.php' => true,
"smarty_resource_recompiled.php" => true, 'smarty_internal_method_gettags.php' => true,
"smarty_resource_uncompiled.php" => true, 'smarty_internal_method_gettemplatevars.php' => true,
"smarty_security.php" => true, 'smarty_internal_method_loadfilter.php' => true,
"smarty_template_cached.php" => true, 'smarty_internal_method_loadplugin.php' => true,
"smarty_template_compiled.php" => true, 'smarty_internal_method_mustcompile.php' => true,
"smarty_template_config.php" => true, 'smarty_internal_method_registercacheresource.php' => true,
"smarty_template_source.php" => true, 'smarty_internal_method_registerclass.php' => true,
"smarty_undefined_variable.php" => true, 'smarty_internal_method_registerdefaultconfighandler.php' => true,
"smarty_variable.php" => true, 'smarty_internal_method_registerdefaultpluginhandler.php' => true,
"smartycompilerexception.php" => true, 'smarty_internal_method_registerdefaulttemplatehandler.php' => true,
"smartyexception.php" => true, 'smarty_internal_method_registerfilter.php' => true,
); 'smarty_internal_method_registerobject.php' => true,
'smarty_internal_method_registerplugin.php' => true,
'smarty_internal_method_registerresource.php' => true,
'smarty_internal_method_setautoloadfilters.php' => true,
'smarty_internal_method_setdebugtemplate.php' => true,
'smarty_internal_method_setdefaultmodifiers.php' => true,
'smarty_internal_method_unloadfilter.php' => true,
'smarty_internal_method_unregistercacheresource.php' => true,
'smarty_internal_method_unregisterfilter.php' => true,
'smarty_internal_method_unregisterobject.php' => true,
'smarty_internal_method_unregisterplugin.php' => true,
'smarty_internal_method_unregisterresource.php' => true,
'smarty_internal_nocache_insert.php' => true,
'smarty_internal_parsetree.php' => true,
'smarty_internal_parsetree_code.php' => true,
'smarty_internal_parsetree_dq.php' => true,
'smarty_internal_parsetree_dqcontent.php' => true,
'smarty_internal_parsetree_tag.php' => true,
'smarty_internal_parsetree_template.php' => true,
'smarty_internal_parsetree_text.php' => true,
'smarty_internal_resource_eval.php' => true,
'smarty_internal_resource_extends.php' => true,
'smarty_internal_resource_file.php' => true,
'smarty_internal_resource_php.php' => true,
'smarty_internal_resource_registered.php' => true,
'smarty_internal_resource_stream.php' => true,
'smarty_internal_resource_string.php' => true,
'smarty_internal_runtime_cachemodify.php' => true,
'smarty_internal_runtime_codeframe.php' => true,
'smarty_internal_runtime_config.php' => true,
'smarty_internal_runtime_filterhandler.php' => true,
'smarty_internal_runtime_foreach.php' => true,
'smarty_internal_runtime_getincludepath.php' => true,
'smarty_internal_runtime_hhvm.php' => true,
'smarty_internal_runtime_inheritance.php' => true,
'smarty_internal_runtime_inline.php' => true,
'smarty_internal_runtime_iscached.php' => true,
'smarty_internal_runtime_subtemplate.php' => true,
'smarty_internal_runtime_tplfunction.php' => true,
'smarty_internal_runtime_updatecache.php' => true,
'smarty_internal_runtime_validatecompiled.php' => true,
'smarty_internal_runtime_var.php' => true,
'smarty_internal_runtime_writefile.php' => true,
'smarty_internal_smartytemplatecompiler.php' => true,
'smarty_internal_template.php' => true,
'smarty_internal_templatebase.php' => true,
'smarty_internal_templatecompilerbase.php' => true,
'smarty_internal_templatelexer.php' => true,
'smarty_internal_templateparser.php' => true,
'smarty_internal_testinstall.php' => true,
'smarty_internal_undefined.php' => true,
'smarty_resource.php' => true,
'smarty_resource_custom.php' => true,
'smarty_resource_recompiled.php' => true,
'smarty_resource_uncompiled.php' => true,
'smarty_security.php' => true,
'smarty_template_cached.php' => true,
'smarty_template_compiled.php' => true,
'smarty_template_config.php' => true,
'smarty_template_resource_base.php' => true,
'smarty_template_source.php' => true,
'smarty_undefined_variable.php' => true,
'smarty_variable.php' => true,);
$iterator = new DirectoryIterator($source); $iterator = new DirectoryIterator($source);
foreach ($iterator as $file) { foreach ($iterator as $file) {
if (!$file->isDot()) { if (!$file->isDot()) {
$filename = $file->getFilename(); $filename = $file->getFilename();
if (isset($expected[$filename])) { if (isset($expectedSysplugins[$filename])) {
unset($expected[$filename]); unset($expectedSysplugins[$filename]);
} }
} }
} }
if ($expected) { if ($expectedSysplugins) {
$status = false; $status = false;
$message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expected)); $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expectedSysplugins));
if ($errors === null) { if ($errors === null) {
echo $message . ".\n"; echo $message . ".\n";
} else { } else {
@@ -477,67 +541,43 @@ class Smarty_Internal_TestInstall
// test if core plugins are available // test if core plugins are available
$source = SMARTY_PLUGINS_DIR; $source = SMARTY_PLUGINS_DIR;
if (is_dir($source)) { if (is_dir($source)) {
$expected = array( $expectedPlugins =
"block.textformat.php" => true, array('block.textformat.php' => true, 'function.counter.php' => true,
"function.counter.php" => true, 'function.cycle.php' => true, 'function.fetch.php' => true,
"function.cycle.php" => true, 'function.html_checkboxes.php' => true, 'function.html_image.php' => true,
"function.fetch.php" => true, 'function.html_options.php' => true, 'function.html_radios.php' => true,
"function.html_checkboxes.php" => true, 'function.html_select_date.php' => true, 'function.html_select_time.php' => true,
"function.html_image.php" => true, 'function.html_table.php' => true, 'function.mailto.php' => true,
"function.html_options.php" => true, 'function.math.php' => true, 'modifier.capitalize.php' => true,
"function.html_radios.php" => true, 'modifier.date_format.php' => true, 'modifier.debug_print_var.php' => true,
"function.html_select_date.php" => true, 'modifier.escape.php' => true, 'modifier.regex_replace.php' => true,
"function.html_select_time.php" => true, 'modifier.replace.php' => true, 'modifier.spacify.php' => true,
"function.html_table.php" => true, 'modifier.truncate.php' => true, 'modifiercompiler.cat.php' => true,
"function.mailto.php" => true, 'modifiercompiler.count_characters.php' => true, 'modifiercompiler.count_paragraphs.php' => true,
"function.math.php" => true, 'modifiercompiler.count_sentences.php' => true, 'modifiercompiler.count_words.php' => true,
"modifier.capitalize.php" => true, 'modifiercompiler.default.php' => true, 'modifiercompiler.escape.php' => true,
"modifier.date_format.php" => true, 'modifiercompiler.from_charset.php' => true, 'modifiercompiler.indent.php' => true,
"modifier.debug_print_var.php" => true, 'modifiercompiler.lower.php' => true, 'modifiercompiler.noprint.php' => true,
"modifier.escape.php" => true, 'modifiercompiler.string_format.php' => true, 'modifiercompiler.strip.php' => true,
"modifier.regex_replace.php" => true, 'modifiercompiler.strip_tags.php' => true, 'modifiercompiler.to_charset.php' => true,
"modifier.replace.php" => true, 'modifiercompiler.unescape.php' => true, 'modifiercompiler.upper.php' => true,
"modifier.spacify.php" => true, 'modifiercompiler.wordwrap.php' => true, 'outputfilter.trimwhitespace.php' => true,
"modifier.truncate.php" => true, 'shared.escape_special_chars.php' => true, 'shared.literal_compiler_param.php' => true,
"modifiercompiler.cat.php" => true, 'shared.make_timestamp.php' => true, 'shared.mb_str_replace.php' => true,
"modifiercompiler.count_characters.php" => true, 'shared.mb_unicode.php' => true, 'shared.mb_wordwrap.php' => true,
"modifiercompiler.count_paragraphs.php" => true, 'variablefilter.htmlspecialchars.php' => true,);
"modifiercompiler.count_sentences.php" => true,
"modifiercompiler.count_words.php" => true,
"modifiercompiler.default.php" => true,
"modifiercompiler.escape.php" => true,
"modifiercompiler.from_charset.php" => true,
"modifiercompiler.indent.php" => true,
"modifiercompiler.lower.php" => true,
"modifiercompiler.noprint.php" => true,
"modifiercompiler.string_format.php" => true,
"modifiercompiler.strip.php" => true,
"modifiercompiler.strip_tags.php" => true,
"modifiercompiler.to_charset.php" => true,
"modifiercompiler.unescape.php" => true,
"modifiercompiler.upper.php" => true,
"modifiercompiler.wordwrap.php" => true,
"outputfilter.trimwhitespace.php" => true,
"shared.escape_special_chars.php" => true,
"shared.literal_compiler_param.php" => true,
"shared.make_timestamp.php" => true,
"shared.mb_str_replace.php" => true,
"shared.mb_unicode.php" => true,
"shared.mb_wordwrap.php" => true,
"variablefilter.htmlspecialchars.php" => true,
);
$iterator = new DirectoryIterator($source); $iterator = new DirectoryIterator($source);
foreach ($iterator as $file) { foreach ($iterator as $file) {
if (!$file->isDot()) { if (!$file->isDot()) {
$filename = $file->getFilename(); $filename = $file->getFilename();
if (isset($expected[$filename])) { if (isset($expectedPlugins[$filename])) {
unset($expected[$filename]); unset($expectedPlugins[$filename]);
} }
} }
} }
if ($expected) { if ($expectedPlugins) {
$status = false; $status = false;
$message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expected)); $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expectedPlugins));
if ($errors === null) { if ($errors === null) {
echo $message . ".\n"; echo $message . ".\n";
} else { } else {