X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fsystem_diagnostics.php;h=e1d8961863077e6b74df8a78e7025b11485d0216;hb=bd8f3d60c65d47e9cf86c4cf39bf48b8d3091153;hp=3b2bfbb834ac89baa2ca3e91e5b5f48c056817ab;hpb=6785915cf06bc5a4c4869b649a5e7a6d46bdac04;p=fa-stable.git diff --git a/admin/system_diagnostics.php b/admin/system_diagnostics.php index 3b2bfbb8..e1d89618 100644 --- a/admin/system_diagnostics.php +++ b/admin/system_diagnostics.php @@ -114,7 +114,7 @@ function tst_debug() $test['type'] = 0; $test['test'] = $go_debug ? _("Yes") : _("No"); $test['result'] = $go_debug != 0; - $test['comments'] = _('To switch debugging on set $go_debug=1 in config.php file'); + $test['comments'] = _('To switch debugging on set $go_debug>1 in config.php file'); return $test; } @@ -160,25 +160,26 @@ function tst_dbversion() function tst_subdirs() { - global $db_connections, $comp_path; + global $db_connections; $comp_subdirs = array('images', 'pdf_files', 'backup','js_cache'); $test['descr'] = _('Company subdirectories consistency'); $test['type'] = 3; - $test['test'] = array($comp_path.'/*'); + $test['test'] = array(company_path().'/*'); foreach($comp_subdirs as $sub) { - $test['test'][] = $comp_path.'/*/'.$sub; + $test['test'][] = company_path().'/*/'.$sub; } $test['result'] = true; - + + $comp_path = company_path(); if (!is_dir($comp_path) || !is_writable($comp_path) ) { $test['result'] = false; $test['comments'][] = sprintf(_("'%s' is not writeable"), $comp_path); return $test; }; foreach ($db_connections as $n => $comp) { - $path = "$comp_path/$n"; + $path = company_path($n); if (!is_dir($path) || !is_writable($path) ) { $test['result'] = false; $test['comments'][] = sprintf(_("'%s' is not writeable"), $path); @@ -189,6 +190,16 @@ function tst_subdirs() if (!is_dir($spath) || !is_writable($spath) ) { $test['result'] = false; $test['comments'][] = sprintf(_("'%s' is not writeable"), $spath); + } else { + $dir = opendir($spath); + while (false !== ($fname = readdir($dir))) { + // check only *.js files. Manually installed package can contain other + // non-writable files which are non-crucial for normal operations + if (preg_match('/.*(\.js)/', $fname) && !is_writable("$spath/$fname")) { + $test['result'] = false; + $test['comments'][] = sprintf(_("'%s' is not writeable"), "$spath/$fname"); + } + } } } } @@ -272,17 +283,17 @@ function tst_dbconfig() function tst_extconfig() { - global $path_to_root, $db_connections, $comp_path; + global $path_to_root, $db_connections; $test['descr'] = _('Extensions configuration files'); $test['type'] = 3; $test['test'] = $path_to_root.'/installed_extensions.php'; $test['result'] = is_file($test['test']) && is_writable($test['test']); - $test['test'] . ','.$comp_path.'/*/installed_extensions.php'; + $test['test'] . ','.company_path().'/*/installed_extensions.php'; $test['comments'][] = sprintf(_("'%s' file should be writeable"), $test['test']); foreach ($db_connections as $n => $comp) { - $path = "$comp_path/$n"; + $path = company_path($n); if (!is_dir($path)) continue; $path .= "/installed_extensions.php"; @@ -296,7 +307,7 @@ function tst_extconfig() } //------------------------------------------------------------------------------------------------- -start_table("$table_style width=80%"); +start_table(TABLESTYLE, "width=80%"); $th = array(_("Test"), _('Test type'), _("Value"), _("Comments")); table_header($th); @@ -315,7 +326,11 @@ foreach ($system_tests as $test) $comm = is_array(@$result['comments']) ? implode('
', $result['comments']) : @$result['comments']; - label_cell($result['result'] ? _('Ok') : ''.$comm.''); + $color = ($result['result'] ? 'green': + ($result['type']==3 ? 'red' : + ($result['type']==2 ? 'orange' : 'green'))); + label_cell("". + ($result['result'] ? _('Ok') : ''.$comm.'').''); end_row(); }