OSDN Git Service

FIX:アップグレードスクリプトがNucleus3.6上で動作するように修正
[nucleus-jp/nucleus-next.git] / nucleus / upgrades / upgrade1.1.php
index 4c73869..f324ea2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
 <?php
 /*
  * 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
@@ -11,7 +11,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: upgrade1.1.php 1809 2012-05-01 14:48:30Z sakamocchi $
  */
 
  * @version $Id: upgrade1.1.php 1809 2012-05-01 14:48:30Z sakamocchi $
  */
 
@@ -71,9 +71,9 @@ function upgrade_do110() {
                // 4. add 'general' categories for all blogs, and update nucleus_item
                $catid = 1;     // generate catids ourself
                $query = 'SELECT bnumber FROM '.sql_table('blog');
                // 4. add 'general' categories for all blogs, and update nucleus_item
                $catid = 1;     // generate catids ourself
                $query = 'SELECT bnumber FROM '.sql_table('blog');
-               $res = DB::getResult($query);
-               foreach ( $res as $current ) {
-                       $blogid = $current['bnumber'];
+               $res = mysql_query($query);
+               while ($current = mysql_fetch_object($res)) {
+                       $blogid = $current->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);
                        
                        $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');
                
                // 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', '<ul><li><a href=\"<%blogurl%>\">All</a></li>');";
                        $query2 = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_LISTITEM', '<li><a href=\"<%catlink%>\"><%catname%></a></li>');";
                
                        $query = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_HEADER', '<ul><li><a href=\"<%blogurl%>\">All</a></li>');";
                        $query2 = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_LISTITEM', '<li><a href=\"<%catlink%>\"><%catname%></a></li>');";