124 [-d database] [-a adminuser] [-w adminpass] [-e email] |
128 [-d database] [-a adminuser] [-w adminpass] [-e email] |
125 All arguments are optional; missing information will be prompted for. |
129 All arguments are optional; missing information will be prompted for. |
126 -q Quiet mode (minimal output) |
130 -q Quiet mode (minimal output) |
127 -b, --db-driver Database driver (mysql or postgresql) |
131 -b, --db-driver Database driver (mysql or postgresql) |
128 -h, --db-host Hostname of database server |
132 -h, --db-host Hostname of database server |
|
133 -o, --db-port TCP port on which to connect to database server |
129 -u, --db-user Username to use on database server |
134 -u, --db-user Username to use on database server |
130 -p, --db-pass Password to use on database server |
135 -p, --db-pass Password to use on database server |
131 -d, --db-name Name of database |
136 -d, --db-name Name of database |
132 -a, --admin-user Administrator username |
137 -a, --admin-user Administrator username |
133 -w, --admin-pass Administrator password |
138 -w, --admin-pass Administrator password |
247 'copyright' => $lang->get('cli_prompt_copyright'), |
254 'copyright' => $lang->get('cli_prompt_copyright'), |
248 'urlscheme' => $lang->get('cli_prompt_urlscheme'), |
255 'urlscheme' => $lang->get('cli_prompt_urlscheme'), |
249 'scriptpath'=> $lang->get('cli_prompt_scriptpath') |
256 'scriptpath'=> $lang->get('cli_prompt_scriptpath') |
250 ); |
257 ); |
251 |
258 |
252 foreach ( array('driver', 'dbhost', 'dbuser', 'dbpasswd', 'dbname', 'db_prefix', 'scriptpath', 'user', 'pass', 'email', 'sitename', 'sitedesc', 'copyright', 'urlscheme') as $var ) |
259 $defaults['dbport'] = ( strtolower($driver) == 'postgresql' ) ? 5432 : 3306; |
|
260 |
|
261 foreach ( array('driver', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'db_prefix', 'scriptpath', 'user', 'pass', 'email', 'sitename', 'sitedesc', 'copyright', 'urlscheme') as $var ) |
253 { |
262 { |
254 if ( empty($$var) ) |
263 if ( empty($$var) ) |
255 { |
264 { |
256 switch($var) |
265 switch($var) |
257 { |
266 { |
258 default: |
267 default: |
259 $$var = cli_prompt($terms[$var], $defaults[$var]); |
268 $$var = cli_prompt($terms[$var], $defaults[$var]); |
|
269 break; |
|
270 case 'driver': |
|
271 $$var = cli_prompt($terms[$var], $defaults[$var]); |
|
272 $defaults['dbport'] = ( strtolower($driver) == 'postgresql' ) ? 5432 : 3306; |
260 break; |
273 break; |
261 case 'pass': |
274 case 'pass': |
262 case 'dbpasswd': |
275 case 'dbpasswd': |
263 if ( @file_exists('/bin/stty') && @is_executable('/bin/stty') ) |
276 if ( @file_exists('/bin/stty') && @is_executable('/bin/stty') ) |
264 { |
277 { |
331 if ( !$silent ) |
352 if ( !$silent ) |
332 { |
353 { |
333 echo parse_shellcolor_string($lang->get('cli_stage_sysreqs')); |
354 echo parse_shellcolor_string($lang->get('cli_stage_sysreqs')); |
334 } |
355 } |
335 |
356 |
336 $test_failed = false; |
357 $failed = false; |
337 |
358 $warnings = array(); |
338 run_test('return version_compare(\'5.2.0\', PHP_VERSION, \'<=\');', $lang->get('sysreqs_req_php5'), $lang->get('sysreqs_req_desc_php5'), true); |
359 |
339 run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql'), true); |
360 // Test: PHP |
340 run_test('return function_exists(\'pg_connect\');', $lang->get('sysreqs_req_postgres'), $lang->get('sysreqs_req_desc_postgres'), true); |
361 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_php') . ': '; |
341 run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') ); |
362 if ( version_compare(PHP_VERSION, '5.2.0', '>=') ) |
342 run_test('return config_write_test();', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') ); |
363 { |
343 run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true); |
364 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
344 run_test('return is_writable(ENANO_ROOT.\'/cache/\');', $lang->get('sysreqs_req_cachewriteable'), $lang->get('sysreqs_req_desc_cachewriteable'), true); |
365 } |
345 run_test('return is_writable(ENANO_ROOT.\'/files/\');', $lang->get('sysreqs_req_fileswriteable'), $lang->get('sysreqs_req_desc_fileswriteable'), true); |
366 else if ( version_compare(PHP_VERSION, '5.0.0', '>=') ) |
|
367 { |
|
368 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_vwarn')) . "\n"; |
|
369 $warnings[] = $lang->get('sysreqs_req_help_php', array('php_version' => PHP_VERSION)); |
|
370 } |
|
371 else |
|
372 { |
|
373 $failed = true; |
|
374 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n"; |
|
375 } |
|
376 |
|
377 // Test: MySQL |
|
378 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_mysql') . ': '; |
|
379 $req_mysql = function_exists('mysql_connect'); |
|
380 if ( $req_mysql ) |
|
381 { |
|
382 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
|
383 $have_dbms = true; |
|
384 } |
|
385 else |
|
386 { |
|
387 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n"; |
|
388 } |
|
389 |
|
390 // Test: PostgreSQL |
|
391 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_postgresql') . ': '; |
|
392 $req_pgsql = function_exists('pg_connect'); |
|
393 if ( $req_pgsql ) |
|
394 { |
|
395 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
|
396 $have_dbms = true; |
|
397 } |
|
398 else |
|
399 { |
|
400 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n"; |
|
401 } |
|
402 |
|
403 if ( !$have_dbms ) |
|
404 $failed = true; |
|
405 |
|
406 // Test: Safe Mode |
|
407 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_safemode') . ': '; |
|
408 $req_safemode = !intval(@ini_get('safe_mode')); |
|
409 if ( !$req_safemode ) |
|
410 { |
|
411 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n"; |
|
412 $warnings[] = $lang->get('sysreqs_req_help_safemode'); |
|
413 $failed = true; |
|
414 } |
|
415 else |
|
416 { |
|
417 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
|
418 } |
|
419 |
|
420 // Test: File uploads |
|
421 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_uploads') . ': '; |
|
422 $req_uploads = intval(@ini_get('file_uploads')); |
|
423 if ( $req_uploads ) |
|
424 { |
|
425 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
|
426 } |
|
427 else |
|
428 { |
|
429 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_warn')) . "\n"; |
|
430 } |
|
431 |
|
432 // Test: ctype validation |
|
433 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_ctype') . ': '; |
|
434 $req_ctype = function_exists('ctype_digit'); |
|
435 if ( $req_ctype ) |
|
436 { |
|
437 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_pass')) . "\n"; |
|
438 } |
|
439 else |
|
440 { |
|
441 if ( !$silent ) echo parse_shellcolor_string($lang->get('cli_test_fail')) . "\n"; |
|
442 $failed = true; |
|
443 } |
|
444 |
|
445 // Write tests |
|
446 $req_config_w = write_test('config.new.php'); |
|
447 $req_htaccess_w = write_test('.htaccess.new'); |
|
448 $req_files_w = write_test('files'); |
|
449 $req_cache_w = write_test('cache'); |
|
450 |
|
451 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_config_writable') . ': ' . parse_shellcolor_string($lang->get($req_config_w ? 'cli_test_pass' : 'cli_test_fail')) . "\n"; |
|
452 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_htaccess_writable') . ': ' . parse_shellcolor_string($lang->get($req_htaccess_w ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
453 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_files_writable') . ': ' . parse_shellcolor_string($lang->get($req_files_w ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
454 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_cache_writable') . ': ' . parse_shellcolor_string($lang->get($req_cache_w ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
455 |
|
456 if ( !$req_config_w || !$req_htaccess_w || !$req_files_w || !$req_cache_w ) |
|
457 $warnings[] = $lang->get('sysreqs_req_help_writable'); |
|
458 |
|
459 if ( !$req_config_w ) |
|
460 $failed = true; |
|
461 |
|
462 // Extension test: GD |
|
463 $req_gd = function_exists('imagecreatefrompng') && function_exists('getimagesize') && function_exists('imagecreatetruecolor') && function_exists('imagecopyresampled'); |
|
464 if ( !$req_gd ) |
|
465 $warnings[] = $lang->get('sysreqs_req_help_gd2'); |
|
466 |
|
467 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_gd2') . ': ' . parse_shellcolor_string($lang->get($req_gd ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
468 |
|
469 // FS test: ImageMagick |
|
470 $req_imagick = which('convert'); |
|
471 if ( !$req_imagick ) |
|
472 $warnings[] = $lang->get('sysreqs_req_help_imagemagick'); |
|
473 |
|
474 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_imagemagick') . ': ' . parse_shellcolor_string($lang->get($req_imagick ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
475 |
|
476 // Extension test: GMP |
|
477 $req_gmp = function_exists('gmp_init'); |
|
478 if ( !$req_gmp ) |
|
479 $warnings[] = $lang->get('sysreqs_req_help_gmp'); |
|
480 |
|
481 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_gmp') . ': ' . parse_shellcolor_string($lang->get($req_gmp ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
482 |
|
483 // Extension test: Big_Int |
|
484 $req_bigint = function_exists('bi_from_str'); |
|
485 if ( !$req_bigint && !$req_gmp ) |
|
486 $warnings[] = $lang->get('sysreqs_req_help_bigint'); |
|
487 |
|
488 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_bigint') . ': ' . parse_shellcolor_string($lang->get($req_bigint ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
489 |
|
490 // Extension test: BCMath |
|
491 $req_bcmath = function_exists('bcadd'); |
|
492 if ( !$req_bcmath && !$req_bigint && !$req_gmp ) |
|
493 $warnings[] = $lang->get('sysreqs_req_help_bcmath'); |
|
494 |
|
495 if ( !$silent ) echo ' ' . $lang->get('sysreqs_req_bcmath') . ': ' . parse_shellcolor_string($lang->get($req_bcmath ? 'cli_test_pass' : 'cli_test_warn')) . "\n"; |
|
496 |
|
497 if ( !empty($warnings) && !$silent ) |
|
498 { |
|
499 echo parse_shellcolor_string($lang->get('cli_msg_test_warnings')) . "\n"; |
|
500 echo " " . implode("\n ", $warnings) . "\n"; |
|
501 } |
|
502 |
346 if ( !function_exists('mysql_connect') && !function_exists('pg_connect') ) |
503 if ( !function_exists('mysql_connect') && !function_exists('pg_connect') ) |
347 { |
504 { |
348 installer_fail($lang->get('cli_err_no_drivers')); |
505 installer_fail($lang->get('cli_err_no_drivers')); |
349 } |
506 } |
350 if ( $test_failed ) |
507 if ( $failed ) |
351 { |
508 { |
352 installer_fail($lang->get('cli_err_sysreqs_fail')); |
509 installer_fail($lang->get('cli_err_sysreqs_fail')); |
353 } |
510 } |
354 |
511 |
355 ## |
512 ## |