From e547917b5297010bfdd2809d1e531a3758175f93 Mon Sep 17 00:00:00 2001 From: reine Date: Sat, 23 Jun 2012 00:39:54 +0900 Subject: [PATCH] =?utf8?q?FIX:=E3=82=A2=E3=83=83=E3=83=97=E3=82=B0?= =?utf8?q?=E3=83=AC=E3=83=BC=E3=83=89=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97?= =?utf8?q?=E3=83=88=E3=81=8CNucleus3.6=E4=B8=8A=E3=81=A7=E5=8B=95=E4=BD=9C?= =?utf8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 全アップグレードスクリプトのデータベースハンドラの変更を元に戻した。 (完全にRevertとも言えないのでFIXとしています) --- nucleus/upgrades/index.php | 8 +-- nucleus/upgrades/upgrade.functions.php | 37 +++++++------ nucleus/upgrades/upgrade.php | 4 +- nucleus/upgrades/upgrade0.95.php | 4 +- nucleus/upgrades/upgrade0.96.php | 16 +++--- nucleus/upgrades/upgrade1.0.php | 14 ++--- nucleus/upgrades/upgrade1.1.php | 16 +++--- nucleus/upgrades/upgrade1.5.php | 42 +++++++-------- nucleus/upgrades/upgrade2.0.php | 4 +- nucleus/upgrades/upgrade2.5.php | 24 ++++----- nucleus/upgrades/upgrade3.0.php | 4 +- nucleus/upgrades/upgrade3.1.php | 4 +- nucleus/upgrades/upgrade3.2.php | 2 +- nucleus/upgrades/upgrade3.3.php | 10 ++-- nucleus/upgrades/upgrade3.4.php | 4 +- nucleus/upgrades/upgrade3.5.php | 4 +- nucleus/upgrades/upgrade3.6.php | 4 +- nucleus/upgrades/upgrade4.0.php | 98 +++++++++++++++++++++++++++++----- 18 files changed, 185 insertions(+), 114 deletions(-) diff --git a/nucleus/upgrades/index.php b/nucleus/upgrades/index.php index 74720cc..c806652 100644 --- a/nucleus/upgrades/index.php +++ b/nucleus/upgrades/index.php @@ -1,7 +1,7 @@ A manual addition needs to be made to config.php, in order to get the media functions to work. Here's what to add:

 	// path to media dir
-	$DIR_MEDIA = '';
+	$DIR_MEDIA = '';
 	

Also, it will be necessary to create that directory yourself. If you want to make file upload possible, you should set the permissions of the media/ directory to 777 (see the documentation/tips.html in Nucleus 0.96+ for a quick guide on setting permissions).

@@ -223,7 +223,7 @@

A manual addition needs to be made to config.php, in order to get imported skins to work correctly. Here's what to add:

 	// extra skin files for imported skins
-	$DIR_SKINS = '';
+	$DIR_SKINS = '';
 	

Also, it will be necessary to create this directory yourself. Downloaded skins can then be expanded into that directory and be imported from inside the Nucleus admin area.

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; } diff --git a/nucleus/upgrades/upgrade.php b/nucleus/upgrades/upgrade.php index 12d39bd..7713d6b 100644 --- a/nucleus/upgrades/upgrade.php +++ b/nucleus/upgrades/upgrade.php @@ -1,7 +1,7 @@ \r\n\r\n <%imagetext%>\r\n \r\n\r\n\r\n <%image%>\r\n\r\n');"; + $res = sql_query($query); + $obj = mysql_fetch_object($res); + $skinid = $obj->sdnumber; + $query = 'INSERT INTO '.sql_table('skin')." VALUES (" . $skinid . ", 'imagepopup', '\r\n\r\n <%imagetext%>\r\n \r\n\r\n\r\n <%image%>\r\n\r\n');"; upgrade_query("Adding 'imagepopup' skinparts",$query); // 7. add POPUP_CODE, MEDIA_CODE, IMAGE_CODE to ALL templates $query = 'SELECT tdnumber FROM '.sql_table('template_desc'); - $res = DB::getResult($query); // get all template ids - foreach ( $res as $row ) { - $tid = $row['tdnumber']; // template id + $res = sql_query($query); // get all template ids + while ($obj = mysql_fetch_object($res)) { + $tid = $obj->tdnumber; // template id $query = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'POPUP_CODE', '<%popuplink%>');"; $query2 = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'MEDIA_CODE', '<%media%>');"; diff --git a/nucleus/upgrades/upgrade1.0.php b/nucleus/upgrades/upgrade1.0.php index e38b1ac..5cb0b81 100644 --- a/nucleus/upgrades/upgrade1.0.php +++ b/nucleus/upgrades/upgrade1.0.php @@ -1,7 +1,7 @@ mpassword); + $updquery = 'UPDATE '.sql_table('member')." SET mpassword='$hashedpw' WHERE mnumber=" . $current->mnumber; + upgrade_query("Encrypting password for member " . $current->mnumber,$updquery); } } }else{ diff --git a/nucleus/upgrades/upgrade1.1.php b/nucleus/upgrades/upgrade1.1.php index 4c73869..f324ea2 100644 --- a/nucleus/upgrades/upgrade1.1.php +++ b/nucleus/upgrades/upgrade1.1.php @@ -1,7 +1,7 @@ bnumber; $query = 'INSERT INTO '.sql_table('category')." (catid, cblog, cname, cdesc) VALUES ($catid, $blogid, 'General', 'Items that do not fit in other categories')"; $r = upgrade_query("Adding category 'general' for blog " . $blogid, $query); @@ -92,9 +92,9 @@ function upgrade_do110() { // 5. add template parts for category lists to all templates $query = 'SELECT tdnumber FROM '.sql_table('template_desc'); - $res = DB::getResult($query); // get all template ids - foreach ( $res as $row ) { - $tid = $row['tdnumber']; // template id + $res = sql_query($query); // get all template ids + while ($obj = mysql_fetch_object($res)) { + $tid = $obj->tdnumber; // template id $query = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_HEADER', '