Changeset 5fed074 in github


Ignore:
Timestamp:
May 22, 2012 2:38:43 AM (13 months ago)
Author:
Aleksander Machniak <alec@…>
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)
Message:

Always use 1 step as a fallback (#1488490)

Location:
installer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • installer/index.php

    rb546b0d r5fed074  
    131131    exit; 
    132132  } 
    133    
     133 
    134134?> 
    135135 
     
    138138<ol id="progress"> 
    139139<?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 
    141150  foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { 
    142151    $j = $i + 1; 
     
    148157 
    149158<?php 
    150 $include_steps = array('', './check.php', './config.php', './test.php'); 
    151159 
    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 } 
     160include $include_steps[$RCI->step]; 
    159161 
    160162?> 
  • installer/rcube_install.php

    r2c4d0bc r5fed074  
    414414    if (!$this->configured) 
    415415      return false; 
    416      
     416 
    417417    $options = array( 
    418418      'use_transactions' => false, 
     
    424424      'portability' => true 
    425425    ); 
    426      
     426 
    427427    $dsnw = $this->config['db_dsnw']; 
    428428    $schema = MDB2_Schema::factory($dsnw, $options); 
    429429    $schema->db->supported['transactions'] = false; 
    430      
     430 
    431431    if (PEAR::isError($schema)) { 
    432432      $this->raise_error(array('code' => $schema->getCode(), 'message' => $schema->getMessage() . ' ' . $schema->getUserInfo())); 
     
    436436      $definition = $schema->getDefinitionFromDatabase(); 
    437437      $definition['charset'] = 'utf8'; 
    438        
     438 
    439439      if (PEAR::isError($definition)) { 
    440440        $this->raise_error(array('code' => $definition->getCode(), 'message' => $definition->getMessage() . ' ' . $definition->getUserInfo())); 
    441441        return false; 
    442442      } 
    443        
     443 
    444444      // load reference schema 
    445445      $dsn_arr = MDB2::parseDSN($this->config['db_dsnw']); 
    446446 
    447447      $ref_schema = INSTALL_PATH . 'SQL/' . $dsn_arr['phptype'] . '.schema.xml'; 
    448        
     448 
    449449      if (is_readable($ref_schema)) { 
    450450        $reference = $schema->parseDatabaseDefinition($ref_schema, false, array(), $schema->options['fail_on_invalid_names']); 
    451          
     451 
    452452        if (PEAR::isError($reference)) { 
    453453          $this->raise_error(array('code' => $reference->getCode(), 'message' => $reference->getMessage() . ' ' . $reference->getUserInfo())); 
     
    455455        else { 
    456456          $diff = $schema->compareDefinitions($reference, $definition); 
    457            
     457 
    458458          if (empty($diff)) { 
    459459            return true; 
     
    462462            // update database schema with the diff from the above check 
    463463            $success = $schema->alterDatabase($reference, $definition, $diff); 
    464              
     464 
    465465            if (PEAR::isError($success)) { 
    466466              $this->raise_error(array('code' => $success->getCode(), 'message' => $success->getMessage() . ' ' . $success->getUserInfo())); 
     
    477477        return false; 
    478478    } 
    479      
     479 
    480480    return false; 
    481481  } 
    482    
    483    
     482 
     483 
    484484  /** 
    485485   * Getter for the last error message 
     
    491491      return $this->last_error['message']; 
    492492  } 
    493    
    494    
     493 
     494 
    495495  /** 
    496496   * Return a list with all imap hosts configured 
     
    502502    $default_hosts = (array)$this->getprop('default_host'); 
    503503    $out = array(); 
    504      
     504 
    505505    foreach ($default_hosts as $key => $name) { 
    506506      if (!empty($name)) 
    507507        $out[] = rcube_parse_host(is_numeric($key) ? $name : $key); 
    508508    } 
    509      
     509 
    510510    return $out; 
    511511  } 
     
    525525        '0.6-beta', '0.6', 
    526526        '0.7-beta', '0.7', '0.7.1', '0.7.2', 
    527         '0.8-beta', 
     527        '0.8-beta', '0.8-rc', 
    528528    )); 
    529529    return $select; 
     
    544544    return $skins; 
    545545  } 
    546    
     546 
    547547  /** 
    548548   * Display OK status 
     
    556556    $this->_showhint($message); 
    557557  } 
    558    
    559    
     558 
     559 
    560560  /** 
    561561   * Display an error status and increase failure count 
     
    568568  { 
    569569    $this->failures++; 
    570      
     570 
    571571    echo Q($name) . ':&nbsp; <span class="fail">NOT OK</span>'; 
    572572    $this->_showhint($message, $url); 
     
    586586    $this->_showhint($message, $url); 
    587587  } 
    588    
    589    
     588 
     589 
    590590  /** 
    591591   * Display warning status 
     
    600600    $this->_showhint($message, $url); 
    601601  } 
    602    
    603    
     602 
     603 
    604604  function _showhint($message, $url = '') 
    605605  { 
    606606    $hint = Q($message); 
    607      
     607 
    608608    if ($url) 
    609609      $hint .= ($hint ? '; ' : '') . 'See <a href="' . Q($url) . '" target="_blank">' . Q($url) . '</a>'; 
    610        
     610 
    611611    if ($hint) 
    612612      echo '<span class="indent">(' . $hint . ')</span>'; 
    613613  } 
    614    
    615    
     614 
     615 
    616616  static function _clean_array($arr) 
    617617  { 
    618618    $out = array(); 
    619      
     619 
    620620    foreach (array_unique($arr) as $k => $val) { 
    621621      if (!empty($val)) { 
     
    626626      } 
    627627    } 
    628      
     628 
    629629    return $out; 
    630630  } 
    631    
    632    
     631 
     632 
    633633  static function _dump_var($var, $name=null) { 
    634634    // special values 
     
    659659          } 
    660660        } 
    661          
     661 
    662662        if ($isnum) 
    663663          return 'array(' . join(', ', array_map(array('rcube_install', '_dump_var'), $var)) . ')'; 
    664664      } 
    665665    } 
    666      
     666 
    667667    return var_export($var, true); 
    668668  } 
    669    
    670    
     669 
     670 
    671671  /** 
    672672   * Initialize the database with the according schema 
     
    678678  { 
    679679    $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; 
    680      
     680 
    681681    // read schema file from /SQL/* 
    682682    $fname = INSTALL_PATH . "SQL/$engine.initial.sql"; 
     
    688688      return false; 
    689689    } 
    690      
     690 
    691691    if ($err = $this->get_error()) { 
    692692      $this->fail('DB Schema', "Error creating database schema: $err"); 
     
    696696    return true; 
    697697  } 
    698    
    699    
     698 
     699 
    700700  /** 
    701701   * Update database with SQL statements from SQL/*.update.sql 
     
    709709    $version = strtolower($version); 
    710710    $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; 
    711      
     711 
    712712    // read schema file from /SQL/* 
    713713    $fname = INSTALL_PATH . "SQL/$engine.update.sql"; 
     
    724724          $sql .= $line. "\n"; 
    725725      } 
    726        
     726 
    727727      if ($sql) 
    728728        $this->exec_sql($sql, $DB); 
     
    732732      return false; 
    733733    } 
    734      
     734 
    735735    if ($err = $this->get_error()) { 
    736736      $this->fail('DB Schema', "Error updating database: $err"); 
     
    740740    return true; 
    741741  } 
    742    
    743    
     742 
     743 
    744744  /** 
    745745   * Execute the given SQL queries on the database connection 
     
    755755      if (preg_match('/^--/', $line) || trim($line) == '') 
    756756        continue; 
    757          
     757 
    758758      $buff .= $line . "\n"; 
    759759      if (preg_match('/(;|^GO)$/', trim($line))) { 
     
    764764      } 
    765765    } 
    766      
     766 
    767767    return !$DB->is_error(); 
    768768  } 
    769    
    770    
     769 
     770 
    771771  /** 
    772772   * Handler for Roundcube errors 
     
    776776      $this->last_error = $p; 
    777777  } 
    778    
    779    
     778 
     779 
    780780  /** 
    781781   * Generarte a ramdom string to be used as encryption key 
     
    789789    $alpha = 'ABCDEFGHIJKLMNOPQERSTUVXYZabcdefghijklmnopqrtsuvwxyz0123456789+*%&?!$-_='; 
    790790    $out = ''; 
    791      
     791 
    792792    for ($i=0; $i < $length; $i++) 
    793793      $out .= $alpha{rand(0, strlen($alpha)-1)}; 
    794      
     794 
    795795    return $out; 
    796796  } 
    797    
     797 
    798798} 
    799799 
Note: See TracChangeset for help on using the changeset viewer.