Ticket #336: configure-detection.patch
| File configure-detection.patch, 16.8 kB (added by anonymous, 4 years ago) |
|---|
-
.php
old new 98 98 define('OK', "ok"); 99 99 define('WARN', "warn"); 100 100 define('ERROR', "error"); 101 define('UNK_VER', "unk"); 101 102 define('UPDATE', "update"); 102 103 103 104 function print_row($left, $right, $err = OK) { … … 111 112 case UPDATE: 112 113 $color = "#DDDD00"; 113 114 break; 115 case UNK_VER: 116 $status = "<b>UNKNOW VERSION</b>"; 117 $color = "#9999FF"; 118 break; 114 119 case ERROR: 115 120 $color = "#FE899B"; 116 121 $status = "<b>FAILED</b>"; … … 132 137 133 138 $status = OK; 134 139 140 function check_pear_module($my_path, $my_function = '') { 141 $ret = @include_once $my_path; 142 // Test the user given function 143 if ($res && isset($my_function)) { 144 $func_ret = call_user_func($my_function); 145 if ($func_ret) { 146 $ret = false; 147 $msg = $func_ret; 148 } 149 } 150 return $ret; 151 } 152 135 153 //smarty compile dirs file permissions. 136 154 $smarty_base = "../themes"; // this assumes configtest.php is located in webroot/admin/ 137 155 $result = ""; … … 296 314 // PEAR::Mail_Mime 297 315 if ($have_pear) { 298 316 if (!in_array("mail_mime", $pear_list)) { 299 $result = "Not installed. This PHP extension is required to decode " . 300 "MIME-structured e-mail. Use <b>pear install Mail_Mime</b> to " . 301 "install this."; 302 $status = ERROR; 317 $installed = check_pear_module('Mail/mime.php'); 318 if (! $installed) { 319 $result = "Not installed. This PHP extension is required to decode " . 320 "MIME-structured e-mail. Use <b>pear install Mail_Mime</b> to " . 321 "install this."; 322 $status = ERROR; 323 } else { 324 $result = "Installed, but cannot determine version. Please check your " . 325 "system package manager. Versions of Mail_Mime below 1.3.0 " . 326 "are known to be buggy."; 327 $status = UNK_VER; 328 } 303 329 } else { 304 330 $info = $pear_reg->packageInfo("Mail_Mime"); 305 331 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 314 340 } 315 341 } 316 342 } else { 343 317 344 $result = "Requires PEAR"; 318 345 $status = WARN; 319 346 } … … 329 356 // PEAR::DB 330 357 if ($have_pear) { 331 358 if (!in_array("db", $pear_list)) { 359 $installed = check_pear_module('DB.php'); 360 if (! $installed) { 332 361 $result = "Not installed. This PHP extension is required in order to provide " . 333 362 "database abstraction. Use <b>pear install DB</b> to install this."; 334 363 $status = ERROR; 364 } else { 365 $result = "Installed, but cannot determine version. Please check your " . 366 "system package manager."; 367 include_once ("DB.php"); 368 $test_dbh = DB::connect($maia_sql_dsn); 369 if (DB::isError($test_dbh)) { 370 $result .= "Could not connect to database. Check the \$maia_sql_dsn setting in config.php."; 371 $status = ERROR; 372 } else { 373 $result .= "Database connexion test OK."; 374 $status = UNK_VER; 375 } 376 } 335 377 } else { 336 378 $db_info = $pear_reg->packageInfo("DB"); 337 379 $pathArray = explode( PATH_SEPARATOR, get_include_path() ); … … 363 405 // PEAR::Pager 364 406 if ($have_pear) { 365 407 if (!in_array("pager", $pear_list)) { 366 $result = "Not installed. This PHP extension is required in order to paginate " . 367 "the list of mail items in the quarantines and the ham cache. Use " . 368 "<b>pear install Pager</b> to install this."; 369 $status = ERROR; 408 $installed = check_pear_module('Pager/Pager.php'); 409 if (! $installed) { 410 $result = "Not installed. This PHP extension is required in order to paginate " . 411 "the list of mail items in the quarantines and the ham cache. Use " . 412 "<b>pear install Pager</b> to install this."; 413 $status = ERROR; 414 } else { 415 $result = "Installed, but cannot determine version. Please check your " . 416 "system package manager."; 417 $status = UNK_VER; 418 } 370 419 } else { 371 420 $pager_info = $pear_reg->packageInfo("Pager"); 372 421 $result = is_array($pager_info["version"])?$pager_info["version"]["release"]:$pager_info["version"]; … … 379 428 print_row("PEAR::Pager", $result, $status); 380 429 381 430 382 // PEAR::Net_Socket431 // PEAR::Net_Socket 383 432 if ($have_pear) { 384 433 if (!in_array("net_socket", $pear_list)) { 385 $result = "Not installed. This PHP extension is required for Net_SMTP to send mail when rescuing email"; 386 $status = ERROR; 434 $installed = check_pear_module('Net/Socket.php'); 435 if (! $installed) { 436 $result = "Not installed. This PHP extension is required for Net_SMTP to send mail when rescuing email"; 437 $status = ERROR; 438 } else { 439 $result = "Installed, but cannot determine version. Please check your " . 440 "system package manager."; 441 $status = UNK_VER; 442 } 387 443 } else { 388 444 $info = $pear_reg->packageInfo("Net_Socket"); 389 445 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 398 454 399 455 // PEAR::Net_SMTP 400 456 if ($have_pear) { 401 if (!in_array("net_smtp", $pear_list)) {402 $result = "Not installed. This PHP extension is required to send mail when rescuing email";403 $status = ERROR;404 } else {405 $info = $pear_reg->packageInfo("Net_SMTP");406 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];407 if (version_compare($result,"1.2.5") < 0) {408 $version = $result;409 $result = "Version $version installed. Need at least 1.2.5";410 $status = ERROR;457 if (!in_array("net_smtp", $pear_list)) { 458 $installed = check_pear_module('Net/SMTP.php'); 459 if (! $installed) { 460 $result = "Not installed. This PHP extension is required to send mail when rescuing email"; 461 $status = ERROR; 462 } else { 463 $result = "Installed, but cannot determine version. Please check your " . 464 "system package manager. Need at least version 1.2.5"; 465 $status = UNK_VER; 466 } 411 467 } else { 412 $status = OK; 468 $info = $pear_reg->packageInfo("Net_SMTP"); 469 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 470 if (version_compare($result,"1.2.5") < 0) { 471 $version = $result; 472 $result = "Version $version installed. Need at least 1.2.5"; 473 $status = ERROR; 474 } else { 475 $status = OK; 476 } 413 477 } 414 }415 478 } else { 416 $result ="Requires PEAR";417 $status = WARN;479 $result ="Requires PEAR"; 480 $status = WARN; 418 481 } 419 482 print_row("PEAR::Net_SMTP", $result, $status); 420 483 421 484 // PEAR::Auth_SASL 422 485 if ($have_pear) { 423 486 if (!in_array("auth_sasl", $pear_list)) { 424 $result = "Not installed. This module is required by PEAR::Net_SMTP in " . 425 "order to support the DIGEST-MD5 and CRAM-MD5 SMTP authentication methods."; 426 $status = ERROR; 487 $installed = check_pear_module('Auth/SASL.php'); 488 if (! $installed) { 489 $result = "Not installed. This module is required by PEAR::Net_SMTP in " . 490 "order to support the DIGEST-MD5 and CRAM-MD5 SMTP authentication methods."; 491 $status = ERROR; 492 } else { 493 $result = "Installed, but cannot determine version. Please check your " . 494 "system package manager."; 495 $status = UNK_VER; 496 } 427 497 } else { 428 498 $info = $pear_reg->packageInfo("Auth_SASL"); 429 499 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 438 508 // PEAR::Net_IMAP 439 509 if ($have_pear) { 440 510 if (!in_array("net_imap", $pear_list)) { 441 $result = "Not installed. This PHP extension is required to authenticate maia against IMAP."; 442 $status = WARN; 511 $installed = check_pear_module('Net/IMAP.php'); 512 if (! $installed) { 513 $result = "Not installed. This PHP extension is required to authenticate maia against IMAP."; 514 $status = WARN; 515 } else { 516 $result = "Installed, but cannot determine version. Please check your " . 517 "system package manager. A bug exists in Net_IMAP 1.0.3 when run under PHP 5, " . 518 " see <a href=\"https://secure.renaissoft.com/maia/ticket/266\">https://secure." . 519 "renaissoft.com/maia/ticket/266</a> for more details.";; 520 $status = UNK_VER; 521 } 443 522 } else { 444 523 $info = $pear_reg->packageInfo("Net_IMAP"); 445 524 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 446 525 if ($result == "1.0.3" && $php_version >= "5.0.0") { 447 $result = "A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see <a href=\"https://secure.renaissoft.com/maia/ticket/266\">https://secure.renaissoft.com/maia/ticket/266</a> for more details."; 526 $result = "A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see <a href=\"" . 527 "https://secure.renaissoft.com/maia/ticket/266\">https://secure." . 528 "renaissoft.com/maia/ticket/266</a> for more details."; 448 529 $status = WARN; 449 530 } else { 450 531 $status = OK; … … 459 540 // PEAR::Net_POP3 460 541 if ($have_pear) { 461 542 if (!in_array("net_pop3", $pear_list)) { 462 $result = "Not installed. This PHP extension is required to authenticate maia against POP3."; 463 $status = WARN; 543 $installed = check_pear_module('Net/POP3.php'); 544 if (! $installed) { 545 $result = "Not installed. This PHP extension is required to authenticate maia against POP3."; 546 $status = WARN; 547 } else { 548 $result = "Installed, but cannot determine version. Please check your " . 549 "system package manager."; 550 $status = UNK_VER; 551 } 464 552 } else { 465 553 $info = $pear_reg->packageInfo("Net_POP3"); 466 554 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 475 563 // PEAR::Log 476 564 if ($have_pear) { 477 565 if (!in_array("log", $pear_list)) { 478 $result = "Not installed, but only required if you want to be able to log user " . 479 "and administrator activity. Use <b>pear install Log</b> to install " . 480 "this PHP extension."; 481 $status = ERROR; 566 $installed = check_pear_module('Log.php'); 567 if (! $installed) { 568 $result = "Not installed, but only required if you want to be able to log user " . 569 "and administrator activity. Use <b>pear install Log</b> to install " . 570 "this PHP extension."; 571 $status = ERROR; 572 } else { 573 $result = "Installed, but cannot determine version. Please check your " . 574 "system package manager."; 575 $status = UNK_VER; 576 } 482 577 } else { 483 578 $log_info = $pear_reg->packageInfo("Log"); 484 579 $result = is_array($log_info["version"])?$log_info["version"]["release"]:$log_info["version"]; … … 493 588 // PEAR::Image_Color 494 589 if ($have_pear) { 495 590 if (!in_array("image_color", $pear_list)) { 496 $result = "Not installed. Optional package, required only if you wish " . 497 "to enable the graphical chart features."; 498 $status = WARN; 591 $installed = check_pear_module('Image/Color.php'); 592 if (! $installed) { 593 $result = "Not installed. Optional package, required only if you wish " . 594 "to enable the graphical chart features."; 595 $status = WARN; 596 } else { 597 $result = "Installed, but cannot determine version. Please check your " . 598 "system package manager."; 599 $status = UNK_VER; 600 } 499 601 } else { 500 602 $info = $pear_reg->packageInfo("Image_Color"); 501 603 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 510 612 // PEAR::Image_Canvas 511 613 if ($have_pear) { 512 614 if (!in_array("image_canvas", $pear_list)) { 513 $result = "Not installed. Optional package, required only if you wish " . 514 "to enable the graphical chart features."; 515 $status = WARN; 615 $installed = check_pear_module('Image/Canvas.php'); 616 if (! $installed) { 617 $result = "Not installed. Optional package, required only if you wish " . 618 "to enable the graphical chart features."; 619 $status = WARN; 620 } else { 621 $result = "Installed, but cannot determine version. Please check your " . 622 "system package manager."; 623 $status = UNK_VER; 624 } 516 625 } else { 517 626 $info = $pear_reg->packageInfo("Image_Canvas"); 518 627 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 527 636 // PEAR::Image_Graph 528 637 if ($have_pear) { 529 638 if (!in_array("image_graph", $pear_list)) { 530 $result = "Not installed. Optional package, required only if you wish " . 531 "to enable the graphical chart features."; 532 $status = WARN; 639 $installed = check_pear_module('Image/Graph.php'); 640 if (! $installed) { 641 $result = "Not installed. Optional package, required only if you wish " . 642 "to enable the graphical chart features."; 643 $status = WARN; 644 } else { 645 $result = "Installed, but cannot determine version. Please check your " . 646 "system package manager."; 647 $status = UNK_VER; 648 } 533 649 } else { 534 650 $info = $pear_reg->packageInfo("Image_Graph"); 535 651 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 544 660 // PEAR::Numbers_Roman 545 661 if ($have_pear) { 546 662 if (!in_array("numbers_roman", $pear_list)) { 547 $result = "Not installed. Optional package, required only if you wish " . 548 "to enable the graphical chart features."; 549 $status = WARN; 663 $installed = check_pear_module('Numbers/Roman.php'); 664 if (! $installed) { 665 $result = "Not installed. Optional package, required only if you wish " . 666 "to enable the graphical chart features."; 667 $status = WARN; 668 } else { 669 $result = "Installed, but cannot determine version. Please check your " . 670 "system package manager."; 671 $status = UNK_VER; 672 } 550 673 } else { 551 674 $info = $pear_reg->packageInfo("Numbers_Roman"); 552 675 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; … … 561 684 // PEAR::Numbers_Words 562 685 if ($have_pear) { 563 686 if (!in_array("numbers_words", $pear_list)) { 564 $result = "Not installed. Optional package, required only if you wish " . 565 "to enable the graphical chart features."; 566 $status = WARN; 687 $installed = check_pear_module('Numbers/Words.php'); 688 if (! $installed) { 689 $result = "Not installed. Optional package, required only if you wish " . 690 "to enable the graphical chart features."; 691 $status = WARN; 692 } else { 693 $result = "Installed, but cannot determine version. Please check your " . 694 "system package manager."; 695 $status = UNK_VER; 696 } 567 697 } else { 568 698 $info = $pear_reg->packageInfo("Numbers_Words"); 569 699 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"];

