X-Git-Url: http://git.osdn.net/view?p=nucleus-jp%2Fnucleus-next.git;a=blobdiff_plain;f=nucleus%2Fupgrades%2Fupgrade.functions.php;h=41d8d4f6c3b4853e2c730a435d906d8d19d1dd21;hp=0e2f667a5fa5232c9528f987fae4ccf0dc7ab7d4;hb=e547917b5297010bfdd2809d1e531a3758175f93;hpb=d9398defb8c30d137b0c2f5d00d5b4e274b71d49 diff --git a/nucleus/upgrades/upgrade.functions.php b/nucleus/upgrades/upgrade.functions.php index 0e2f667..41d8d4f 100644 --- a/nucleus/upgrades/upgrade.functions.php +++ b/nucleus/upgrades/upgrade.functions.php @@ -2,7 +2,7 @@ /** * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) - * Copyright (C) 2002-2009 The Nucleus Group + * Copyright (C) 2002-2012 The Nucleus Group * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -12,7 +12,7 @@ */ /** * @license http://nucleuscms.org/license.txt GNU General Public License - * @copyright Copyright (C) 2002-2009 The Nucleus Group + * @copyright Copyright (C) 2002-2012 The Nucleus Group * @version $Id: upgrade.functions.php 1889 2012-06-17 08:46:45Z sakamocchi $ */ @@ -147,9 +147,9 @@ break; } - $result = DB::getResult($query); - $installed = ( $result !== FALSE ) && ($result->rowCount() >= $minrows); - + $result = mysql_query($query); + $installed = ( $result != 0 ) && (mysql_num_rows($result) >= $minrows); + return $installed; } @@ -302,14 +302,13 @@ echo "
  • $friendly — "; # execute the query - $result = @DB::execute($query); + $result = @mysql_query($query); // begin if: error executing query if ( $result === FALSE ) { echo ' FAILED
    '; - $err = DB::getError(); - echo 'Error: ', $err[2], ''; + echo 'Error: ', mysql_error(), ''; $upgrade_failures++; } // else: query was successful @@ -365,19 +364,19 @@ $indices = array(); $query = 'SHOW INDEX FROM ' . sql_table($table); - $result = @DB::getResult($query); + $result = @mysql_query($query); // begin loop: each result object - foreach ( $result as $row ) + while ( $object = mysql_fetch_object($result) ) { // begin if: key has not been added to the indeces array yet - if ( !isset($indices[$row['Key_name']]) ) + if ( !isset($indices[$object->Key_name]) ) { - $indices[$row['Key_name']] = array(); + $indices[$object->Key_name] = array(); } // end if - array_push($indices[$row['Key_name']], $row['Column_name']); + array_push($indices[$object->Key_name], $object->Column_name); } // compare each index with parameter @@ -405,10 +404,10 @@ function upgrade_checkIfTableExists($table) { $query = 'SHOW TABLES LIKE ' . sql_table($table); - $result = DB::getResult($query); + $result = @mysql_query($query); // begin if: query executed successfully and one row was returned - if ( ($result !== FALSE) && ($result->rowCount() == 1) ) + if ( ($result !== FALSE) && (@mysql_num_rows($result) == 1) ) { return TRUE; } @@ -430,10 +429,10 @@ function upgrade_checkIfCVExists($value) { $query = 'SELECT name FROM ' . sql_table('config') . ' WHERE name = "' . $value . '"'; - $result = DB::getResult($query); + $result = @mysql_query($query); // begin if: query executed successfully and one row was returned - if ( ($result !== FALSE) && ($result->rowCount() == 1) ) + if ( ($result !== FALSE) && (@mysql_num_rows($result) == 1) ) { return TRUE; } @@ -456,10 +455,10 @@ function upgrade_checkIfColumnExists($table, $column) { $query = 'DESC ' . sql_table($table) . ' ' . $column; - $result = DB::getResult($query); + $result = @mysql_query($query); // begin if: query executed successfully and one row was returned - if ( ($result !== FALSE) && ($result->rowCount() == 1) ) + if ( ($result !== FALSE) && (@mysql_num_rows($result) == 1) ) { return TRUE; }