install/includes/cli-core.php
changeset 1144 fcb2be1428e7
parent 1081 745200a9cc2a
child 1183 15957df91ea4
equal deleted inserted replaced
1143:e271ae801c62 1144:fcb2be1428e7
    27         <p>This script must be run from the command line.</p>';
    27         <p>This script must be run from the command line.</p>';
    28   $ui->show_footer();
    28   $ui->show_footer();
    29   exit;
    29   exit;
    30 }
    30 }
    31 
    31 
       
    32 require_once( ENANO_ROOT . '/install/includes/libenanoinstall.php' );
       
    33 
    32 if ( defined('ENANO_INSTALLED') )
    34 if ( defined('ENANO_INSTALLED') )
    33 {
    35 {
    34   // start up the API to let it error out if something's wrong
    36   // start up the API to let it error out if something's wrong
    35   require(ENANO_ROOT . '/includes/common.php');
    37   require(ENANO_ROOT . '/includes/common.php');
    36   
    38   
   106       $copyright = @$argv[++$i];
   108       $copyright = @$argv[++$i];
   107       break;
   109       break;
   108     case '--url-scheme':
   110     case '--url-scheme':
   109     case '-r':
   111     case '-r':
   110       $urlscheme_temp = @$argv[++$i];
   112       $urlscheme_temp = @$argv[++$i];
   111       if ( in_array($urlscheme_temp, array('standard', 'short', 'rewrite')) )
   113       if ( in_array($urlscheme_temp, array('standard', 'short', 'rewrite', 'tiny')) )
   112         $urlscheme = $urlscheme_temp;
   114         $urlscheme = $urlscheme_temp;
   113       break;
   115       break;
   114     case '--language':
   116     case '--language':
   115     case '-l':
   117     case '-l':
   116       $lang_id = @$argv[++$i];
   118       $lang_id = @$argv[++$i];
   439 {
   441 {
   440   if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n";
   442   if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n";
   441   $failed = true;
   443   $failed = true;
   442 }
   444 }
   443 
   445 
       
   446 // Test: crypto
       
   447 $crypto_backend = install_get_crypto_backend();
       
   448 if ( !$silent )
       
   449 {
       
   450   echo '  ' . $lang->get('sysreqs_req_crypto') . ': ';
       
   451   switch($crypto_backend)
       
   452   {
       
   453     case 'bcmath':
       
   454       echo parse_shellcolor_string($lang->get('cli_test_warn') . " [<c 0;33>" . $lang->get("sysreqs_req_{$crypto_backend}") . "</c>]") . "\n";
       
   455       $warnings[] = $lang->get('sysreqs_req_help_crypto_bcmath');
       
   456       break;
       
   457     case 'none':
       
   458       echo parse_shellcolor_string($lang->get('cli_test_warn') . " [<c 0;31>" . $lang->get("sysreqs_req_notfound") . "</c>]") . "\n";
       
   459       $warnings[] = $lang->get('sysreqs_req_help_crypto_none');
       
   460       break;
       
   461     default:
       
   462       echo parse_shellcolor_string($lang->get('cli_test_pass') . " [<c 0;32>" . $lang->get("sysreqs_req_{$crypto_backend}") . "</c>]") . "\n";
       
   463       break;
       
   464   }
       
   465 }
       
   466 
   444 // Write tests
   467 // Write tests
   445 $req_config_w = write_test('config.new.php');
   468 $req_config_w = write_test('config.new.php');
   446 $req_htaccess_w = write_test('.htaccess.new');
   469 $req_htaccess_w = write_test('.htaccess.new');
   447 $req_files_w = write_test('files');
   470 $req_files_w = write_test('files');
   448 $req_cache_w = write_test('cache');
   471 $req_cache_w = write_test('cache');
   469 $req_imagick = which('convert');
   492 $req_imagick = which('convert');
   470 if ( !$req_imagick )
   493 if ( !$req_imagick )
   471   $warnings[] = $lang->get('sysreqs_req_help_imagemagick');
   494   $warnings[] = $lang->get('sysreqs_req_help_imagemagick');
   472 
   495 
   473 if ( !$silent ) echo '  ' . $lang->get('sysreqs_req_imagemagick') . ': ' . parse_shellcolor_string($lang->get($req_imagick ? 'cli_test_pass' : 'cli_test_warn')) . "\n";
   496 if ( !$silent ) echo '  ' . $lang->get('sysreqs_req_imagemagick') . ': ' . parse_shellcolor_string($lang->get($req_imagick ? 'cli_test_pass' : 'cli_test_warn')) . "\n";
   474 
       
   475 // Extension test: GMP
       
   476 $req_gmp = function_exists('gmp_init');
       
   477 if ( !$req_gmp )
       
   478   $warnings[] = $lang->get('sysreqs_req_help_gmp');
       
   479 
       
   480 if ( !$silent ) echo '  ' . $lang->get('sysreqs_req_gmp') . ': ' . parse_shellcolor_string($lang->get($req_gmp ? 'cli_test_pass' : 'cli_test_warn')) . "\n";
       
   481 
       
   482 // Extension test: Big_Int
       
   483 $req_bigint = function_exists('bi_from_str');
       
   484 if ( !$req_bigint && !$req_gmp )
       
   485   $warnings[] = $lang->get('sysreqs_req_help_bigint');
       
   486 
       
   487 if ( !$silent ) echo '  ' . $lang->get('sysreqs_req_bigint') . ': ' . parse_shellcolor_string($lang->get($req_bigint ? 'cli_test_pass' : 'cli_test_warn')) . "\n";
       
   488 
       
   489 // Extension test: BCMath
       
   490 $req_bcmath = function_exists('bcadd');
       
   491 if ( !$req_bcmath && !$req_bigint && !$req_gmp )
       
   492   $warnings[] = $lang->get('sysreqs_req_help_bcmath');
       
   493 
       
   494 if ( !$silent ) echo '  ' . $lang->get('sysreqs_req_bcmath') . ': ' . parse_shellcolor_string($lang->get($req_bcmath ? 'cli_test_pass' : 'cli_test_warn')) . "\n";
       
   495 
   497 
   496 if ( !empty($warnings) && !$silent )
   498 if ( !empty($warnings) && !$silent )
   497 {
   499 {
   498   echo parse_shellcolor_string($lang->get('cli_msg_test_warnings')) . "\n";
   500   echo parse_shellcolor_string($lang->get('cli_msg_test_warnings')) . "\n";
   499   echo "  " . implode("\n  ", $warnings) . "\n";
   501   echo "  " . implode("\n  ", $warnings) . "\n";