OSDN Git Service

FIX:アップグレードスクリプトがNucleus3.6上で動作するように修正
[nucleus-jp/nucleus-next.git] / nucleus / upgrades / upgrade.functions.php
index 0e2f667..41d8d4f 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
 
 /**
  * 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
  *
  * 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
  */
 /**
  * @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 $
  */
 
  * @version $Id: upgrade.functions.php 1889 2012-06-17 08:46:45Z sakamocchi $
  */
 
                        break;
                }
 
                        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;
        }
 
                return $installed;
        }
 
                echo "<li> $friendly &mdash; ";
 
                # execute the query
                echo "<li> $friendly &mdash; ";
 
                # execute the query
-               $result = @DB::execute($query);
+               $result = @mysql_query($query);
 
                // begin if: error executing query
                if ( $result === FALSE )
                {
                        echo '<span class="warning"> FAILED </span> <br />';
 
                // begin if: error executing query
                if ( $result === FALSE )
                {
                        echo '<span class="warning"> FAILED </span> <br />';
-                       $err = DB::getError();
-                       echo 'Error: <code>', $err[2], '</code>';
+                       echo 'Error: <code>', mysql_error(), '</code>';
                        $upgrade_failures++;
                }
                // else: query was successful
                        $upgrade_failures++;
                }
                // else: query was successful
                $indices = array();
 
                $query = 'SHOW INDEX FROM ' . sql_table($table);
                $indices = array();
 
                $query = 'SHOW INDEX FROM ' . sql_table($table);
-               $result = @DB::getResult($query);
+               $result = @mysql_query($query);
 
                // begin loop: each result object
 
                // 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
                {
 
                        // 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
 
                        } // 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
                }
 
                // compare each index with parameter
        function upgrade_checkIfTableExists($table)
        {
                $query = 'SHOW TABLES LIKE ' . sql_table($table);
        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
 
                // 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;
                }
                {
                        return TRUE;
                }
        function upgrade_checkIfCVExists($value)
        {
                $query = 'SELECT name FROM ' . sql_table('config') . ' WHERE name = "' . $value . '"';
        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
 
                // 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;
                }
                {
                        return TRUE;
                }
        function upgrade_checkIfColumnExists($table, $column)
        {
                $query = 'DESC ' . sql_table($table) . ' ' . $column;
        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
 
                // 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;
                }
                {
                        return TRUE;
                }