Update from beta to RC1
[fa-stable.git] / admin / system_diagnostics.php
index 8fba181051c23a9329cf89983e6cc5e732074832..665b6f02c701c5694bb90743bb7e44768da77a18 100644 (file)
@@ -34,22 +34,22 @@ $system_tests = array('tst_mysql', 'tst_php', 'tst_server', 'tst_system', 'tst_b
 
 function tst_mysql() 
 {
-       $test['descr'] = _('MySQL version'). ' >3.23.58';
+       $test['descr'] = _('MySQL version'). ' >=4.1';
        $test['type'] = 3;
        $test['test'] = mysql_get_server_info();
-       $test['result'] = $test['test']>'3.23.58';
-       $test['comments'] = _('Upgrade MySQL server to version at least 3.23.58');
+       $test['result'] = $test['test']>='4.1';
+       $test['comments'] = _('Upgrade MySQL server to version at least 4.1');
 
        return $test;
 }
 
 function tst_php() 
 {
-       $test['descr'] = _('PHP version').' >4.3.2';
+       $test['descr'] = _('PHP version').' >=4.3.3';
        $test['type'] = 3;
        $test['test'] = phpversion();
-       $test['result'] = $test['test']>'4.3.2';
-       $test['comments'] = _('Upgrade PHP to version at least 4.3.2');
+       $test['result'] = $test['test']>='4.3.3';
+       $test['comments'] = _('Upgrade PHP to version at least 4.3.3');
 
        return $test;
 }
@@ -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>0 in config.php file');
 
        return $test;
 }
@@ -227,29 +227,41 @@ function tst_langs()
        $test['result'] = true;
        $test['comments'] = array();
 
-       $old = setlocale(LC_MESSAGES, '0');
+       $fname =  $path_to_root.'/lang';
+       $test['test'][] = $fname;
+       if (!(is_dir($fname) && is_writable($fname))) {
+               $test['result'] = false;
+               $test['comments'][] = _("Languages folder should be writeable.");
+       }
        
+       $fname =  $path_to_root.'/lang/installed_languages.inc';
+       $test['test'][] = $fname;
+       if (!(is_file($fname) && is_writable($fname))) {
+               $test['result'] = false;
+               $test['comments'][] = _("Languages configuration file should be writeable.");
+       }
+
        $langs = array();
        
        foreach ($installed_languages as $lang) {
                $langs[] = $lang['code'];
                if ($lang['code'] == 'en_GB') continue; // native FA language
-               
+       
                $file = $path_to_root.'/lang/'.$lang['code'].'/LC_MESSAGES/'.$lang['code'];
-        $file .= function_exists('gettext') ? '.mo' : '.po';
+               if (@$lang['version'])
+                       $file .= '-'.$lang['version'];
+               $file .= function_exists('gettext') ? '.mo' : '.po';
 
                if (!is_file($file)) {
                        $test['result'] = false;
                        $test['comments'][] = sprintf( _('Missing %s translation file.'), $file);
                }
                if (!$_SESSION['get_text']->check_support($lang['code'], $lang['encoding']))
-        {
+               {
                        $test['result'] = false;
                        $test['comments'][] = sprintf(_('Missing system locale: %s'), $lang['code'].".".$lang['encoding']);
-        };
+               };
        }
-       
-       setlocale(LC_MESSAGES, $old);
 
        $test['test'] = $langs;
 
@@ -285,12 +297,12 @@ function tst_extconfig()
 {
        global $path_to_root, $db_connections;
 
-       $test['descr'] = _('Extensions configuration files');
+       $test['descr'] = _('Extensions system');
        $test['type'] = 3;
-       $test['test'] = $path_to_root.'/installed_extensions.php';
-       $test['result'] = is_file($test['test']) && is_writable($test['test']);
-       $test['test'] . ','.company_path().'/*/installed_extensions.php';
-       $test['comments'][] = sprintf(_("'%s' file should be writeable"), $test['test']);
+       $fname =  $path_to_root.'/installed_extensions.php';
+       $test['test'][] = $fname;
+       $test['result'] = is_file($fname) && is_writable($fname);
+       $test['test'][] = company_path().'/*/installed_extensions.php';
 
        foreach ($db_connections as $n => $comp) {
                $path = company_path($n);
@@ -303,6 +315,45 @@ function tst_extconfig()
                        continue;
                };
        }
+       $fname =  $path_to_root.'/modules';
+       $test['test'][] = $fname;
+       $test['result'] &= is_dir($fname) && is_writable($fname);
+       $fname =  $path_to_root.'/modules/_cache';
+
+       $test['test'][] = $fname;
+       $test['result'] &= is_dir($fname) && is_writable($fname);
+       $fname =  $path_to_root.'/themes';
+
+       $test['test'][] = $fname;
+       $test['result'] &= is_dir($fname) && is_writable($fname);
+       if(!$test['result'])
+               $test['comments'][] = _("Extensions configuration files and directories should be writeable");
+
+       $themedir = opendir($fname);
+       while (false !== ($fname = readdir($themedir)))
+       {
+               if ($fname!='.' && $fname!='..' && $fname!='CVS' && is_dir($path_to_root.'/themes/'.$fname)
+                       && !in_array($fname, array('aqua', 'cool', 'default')))
+               {
+                       $test['test'][] = $fname;
+                       $test['result'] = is_writable($path_to_root.'/themes/'.$fname);
+                       if (!$test['result']) {
+                               $test['comments'][] = 
+                                       sprintf(_("Non-standard theme directory '%s' is not writable"), $fname);
+                               break;
+                       }
+               }
+       }
+       closedir($themedir);
+
+       $test['test'][] = 'OpenSSL PHP extension';
+       if (!extension_loaded('openssl')) {
+               $test['result'] = false;
+               $test['comments'][] = _("OpenSSL PHP extension have to be enabled to use extension repository system.");
+       } elseif (!function_exists('openssl_verify')) {
+               $test['result'] = false;
+               $test['comments'][] = _("OpenSSL have to be available on your server to use extension repository system.");
+       }
        return $test;
 }
 //-------------------------------------------------------------------------------------------------