Changeset 5fed074 in github
- Timestamp:
- May 22, 2012 2:38:43 AM (13 months ago)
- Branches:
- master, HEAD, dev-browser-capabilities, pdo
- Children:
- 5c7e54b
- Parents:
- 38184e9
- git-author:
- Aleksander Machniak <alec@…> (05/22/12 02:37:08)
- git-committer:
- Aleksander Machniak <alec@…> (05/22/12 02:38:43)
- Location:
- installer
- Files:
-
- 2 edited
-
index.php (modified) (3 diffs)
-
rcube_install.php (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
installer/index.php
rb546b0d r5fed074 131 131 exit; 132 132 } 133 133 134 134 ?> 135 135 … … 138 138 <ol id="progress"> 139 139 <?php 140 140 $include_steps = array( 141 1 => './check.php', 142 2 => './config.php', 143 3 => './test.php', 144 ); 145 146 if (!in_array($RCI->step, array_keys($include_steps))) { 147 $RCI->step = 1; 148 } 149 141 150 foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { 142 151 $j = $i + 1; … … 148 157 149 158 <?php 150 $include_steps = array('', './check.php', './config.php', './test.php');151 159 152 if ($include_steps[$RCI->step]) { 153 include $include_steps[$RCI->step]; 154 } 155 else { 156 header("HTTP/1.0 404 Not Found"); 157 echo '<h2 class="error">Invalid step</h2>'; 158 } 160 include $include_steps[$RCI->step]; 159 161 160 162 ?> -
installer/rcube_install.php
r2c4d0bc r5fed074 414 414 if (!$this->configured) 415 415 return false; 416 416 417 417 $options = array( 418 418 'use_transactions' => false, … … 424 424 'portability' => true 425 425 ); 426 426 427 427 $dsnw = $this->config['db_dsnw']; 428 428 $schema = MDB2_Schema::factory($dsnw, $options); 429 429 $schema->db->supported['transactions'] = false; 430 430 431 431 if (PEAR::isError($schema)) { 432 432 $this->raise_error(array('code' => $schema->getCode(), 'message' => $schema->getMessage() . ' ' . $schema->getUserInfo())); … … 436 436 $definition = $schema->getDefinitionFromDatabase(); 437 437 $definition['charset'] = 'utf8'; 438 438 439 439 if (PEAR::isError($definition)) { 440 440 $this->raise_error(array('code' => $definition->getCode(), 'message' => $definition->getMessage() . ' ' . $definition->getUserInfo())); 441 441 return false; 442 442 } 443 443 444 444 // load reference schema 445 445 $dsn_arr = MDB2::parseDSN($this->config['db_dsnw']); 446 446 447 447 $ref_schema = INSTALL_PATH . 'SQL/' . $dsn_arr['phptype'] . '.schema.xml'; 448 448 449 449 if (is_readable($ref_schema)) { 450 450 $reference = $schema->parseDatabaseDefinition($ref_schema, false, array(), $schema->options['fail_on_invalid_names']); 451 451 452 452 if (PEAR::isError($reference)) { 453 453 $this->raise_error(array('code' => $reference->getCode(), 'message' => $reference->getMessage() . ' ' . $reference->getUserInfo())); … … 455 455 else { 456 456 $diff = $schema->compareDefinitions($reference, $definition); 457 457 458 458 if (empty($diff)) { 459 459 return true; … … 462 462 // update database schema with the diff from the above check 463 463 $success = $schema->alterDatabase($reference, $definition, $diff); 464 464 465 465 if (PEAR::isError($success)) { 466 466 $this->raise_error(array('code' => $success->getCode(), 'message' => $success->getMessage() . ' ' . $success->getUserInfo())); … … 477 477 return false; 478 478 } 479 479 480 480 return false; 481 481 } 482 483 482 483 484 484 /** 485 485 * Getter for the last error message … … 491 491 return $this->last_error['message']; 492 492 } 493 494 493 494 495 495 /** 496 496 * Return a list with all imap hosts configured … … 502 502 $default_hosts = (array)$this->getprop('default_host'); 503 503 $out = array(); 504 504 505 505 foreach ($default_hosts as $key => $name) { 506 506 if (!empty($name)) 507 507 $out[] = rcube_parse_host(is_numeric($key) ? $name : $key); 508 508 } 509 509 510 510 return $out; 511 511 } … … 525 525 '0.6-beta', '0.6', 526 526 '0.7-beta', '0.7', '0.7.1', '0.7.2', 527 '0.8-beta', 527 '0.8-beta', '0.8-rc', 528 528 )); 529 529 return $select; … … 544 544 return $skins; 545 545 } 546 546 547 547 /** 548 548 * Display OK status … … 556 556 $this->_showhint($message); 557 557 } 558 559 558 559 560 560 /** 561 561 * Display an error status and increase failure count … … 568 568 { 569 569 $this->failures++; 570 570 571 571 echo Q($name) . ': <span class="fail">NOT OK</span>'; 572 572 $this->_showhint($message, $url); … … 586 586 $this->_showhint($message, $url); 587 587 } 588 589 588 589 590 590 /** 591 591 * Display warning status … … 600 600 $this->_showhint($message, $url); 601 601 } 602 603 602 603 604 604 function _showhint($message, $url = '') 605 605 { 606 606 $hint = Q($message); 607 607 608 608 if ($url) 609 609 $hint .= ($hint ? '; ' : '') . 'See <a href="' . Q($url) . '" target="_blank">' . Q($url) . '</a>'; 610 610 611 611 if ($hint) 612 612 echo '<span class="indent">(' . $hint . ')</span>'; 613 613 } 614 615 614 615 616 616 static function _clean_array($arr) 617 617 { 618 618 $out = array(); 619 619 620 620 foreach (array_unique($arr) as $k => $val) { 621 621 if (!empty($val)) { … … 626 626 } 627 627 } 628 628 629 629 return $out; 630 630 } 631 632 631 632 633 633 static function _dump_var($var, $name=null) { 634 634 // special values … … 659 659 } 660 660 } 661 661 662 662 if ($isnum) 663 663 return 'array(' . join(', ', array_map(array('rcube_install', '_dump_var'), $var)) . ')'; 664 664 } 665 665 } 666 666 667 667 return var_export($var, true); 668 668 } 669 670 669 670 671 671 /** 672 672 * Initialize the database with the according schema … … 678 678 { 679 679 $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; 680 680 681 681 // read schema file from /SQL/* 682 682 $fname = INSTALL_PATH . "SQL/$engine.initial.sql"; … … 688 688 return false; 689 689 } 690 690 691 691 if ($err = $this->get_error()) { 692 692 $this->fail('DB Schema', "Error creating database schema: $err"); … … 696 696 return true; 697 697 } 698 699 698 699 700 700 /** 701 701 * Update database with SQL statements from SQL/*.update.sql … … 709 709 $version = strtolower($version); 710 710 $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; 711 711 712 712 // read schema file from /SQL/* 713 713 $fname = INSTALL_PATH . "SQL/$engine.update.sql"; … … 724 724 $sql .= $line. "\n"; 725 725 } 726 726 727 727 if ($sql) 728 728 $this->exec_sql($sql, $DB); … … 732 732 return false; 733 733 } 734 734 735 735 if ($err = $this->get_error()) { 736 736 $this->fail('DB Schema', "Error updating database: $err"); … … 740 740 return true; 741 741 } 742 743 742 743 744 744 /** 745 745 * Execute the given SQL queries on the database connection … … 755 755 if (preg_match('/^--/', $line) || trim($line) == '') 756 756 continue; 757 757 758 758 $buff .= $line . "\n"; 759 759 if (preg_match('/(;|^GO)$/', trim($line))) { … … 764 764 } 765 765 } 766 766 767 767 return !$DB->is_error(); 768 768 } 769 770 769 770 771 771 /** 772 772 * Handler for Roundcube errors … … 776 776 $this->last_error = $p; 777 777 } 778 779 778 779 780 780 /** 781 781 * Generarte a ramdom string to be used as encryption key … … 789 789 $alpha = 'ABCDEFGHIJKLMNOPQERSTUVXYZabcdefghijklmnopqrtsuvwxyz0123456789+*%&?!$-_='; 790 790 $out = ''; 791 791 792 792 for ($i=0; $i < $length; $i++) 793 793 $out .= $alpha{rand(0, strlen($alpha)-1)}; 794 794 795 795 return $out; 796 796 } 797 797 798 798 } 799 799
Note: See TracChangeset
for help on using the changeset viewer.
