[geeklog-cvs] Geeklog-1.x/public_html/admin/install index.php, 1.33, 1.34

Dirk Haun dhaun at qs1489.pair.com
Fri Mar 21 08:30:53 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install
In directory qs1489.pair.com:/tmp/cvs-serv36840

Modified Files:
	index.php 
Log Message:
Need to handle possible problems connecting to MySQL in mysql_v()


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install/index.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** index.php	16 Mar 2008 11:30:28 -0000	1.33
--- index.php	21 Mar 2008 12:30:51 -0000	1.34
***************
*** 75,84 ****
   * Returns the MySQL version
   *
!  * @return array the 3 separate parts of the MySQL version number
   *
   */
! function mysql_v ($_DB_host, $_DB_user, $_DB_pass)
  {
!     @mysql_connect ($_DB_host, $_DB_user, $_DB_pass);
      $mysqlv = '';
  
--- 75,86 ----
   * Returns the MySQL version
   *
!  * @return  mixed   array[0..2] of the parts of the version number or false
   *
   */
! function mysql_v($_DB_host, $_DB_user, $_DB_pass)
  {
!     if (@mysql_connect($_DB_host, $_DB_user, $_DB_pass) === false) {
!         return false;
!     }
      $mysqlv = '';
  
***************
*** 231,239 ****
              // If using MySQL check to make sure the version is supported
              $outdated_mysql = false;
              if ($db_type == 'mysql' || $db_type == 'mysql-innodb') {
                  $myv = mysql_v($db_host, $db_user, $db_pass);
!                 if (($myv[0] < 3) || (($myv[0] == 3) && ($myv[1] < 23)) ||
                          (($myv[0] == 3) && ($myv[1] == 23) && ($myv[2] < 2))) {
!                             $outdated_mysql = true;
                  }
              }
--- 233,244 ----
              // If using MySQL check to make sure the version is supported
              $outdated_mysql = false;
+             $failed_to_connect = false;
              if ($db_type == 'mysql' || $db_type == 'mysql-innodb') {
                  $myv = mysql_v($db_host, $db_user, $db_pass);
!                 if ($myv === false) {
!                     $failed_to_connect = true;
!                 } elseif (($myv[0] < 3) || (($myv[0] == 3) && ($myv[1] < 23)) ||
                          (($myv[0] == 3) && ($myv[1] == 23) && ($myv[2] < 2))) {
!                     $outdated_mysql = true;
                  }
              }
***************
*** 241,244 ****
--- 246,253 ----
                  $display .= '<h1>' . $LANG_INSTALL[51] . '</h1>' . LB;
                  $display .= '<p>' . $LANG_INSTALL[52] . $myv[0] . '.' . $myv[1] . '.' . $myv[2] . $LANG_INSTALL[53] . '</p>' . LB;
+             } elseif ($failed_to_connect) {
+                 $display .= '<h2>' . $LANG_INSTALL[54] . '</h2><p>'
+                          . $LANG_INSTALL[55] . '</p>'
+                          . INST_showReturnFormData($_POST) . LB;
              } else {
                  // Check if you can connect to database
***************
*** 263,268 ****
                  }
                  if ($invalid_db_auth) { // If we can't connect to the database server
!                     $display .= '<h2>' . $LANG_INSTALL['54'] . '</h2>
!                         <p>' . $LANG_INSTALL[55] . '</p>' . INST_showReturnFormData($_POST) . LB;
                  } else { // If we can connect
                      // Check if the database exists
--- 272,278 ----
                  }
                  if ($invalid_db_auth) { // If we can't connect to the database server
!                     $display .= '<h2>' . $LANG_INSTALL[54] . '</h2><p>'
!                              . $LANG_INSTALL[55] . '</p>'
!                              . INST_showReturnFormData($_POST) . LB;
                  } else { // If we can connect
                      // Check if the database exists




More information about the geeklog-cvs mailing list