Changeset 2188

Show
Ignore:
Timestamp:
09/09/10 04:54:54 (17 months ago)
Author:
shibuya246
Message:

[Branch 1.5] install-upgrade, add fix for alter table, post_title to text

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/install/install-upgrade.php

    r2146 r2188  
    677677            // Change post_title column from `post_title` varchar(255) NULL, to `post_title` text NULL, 
    678678            $exists = $h->db->column_exists('posts', 'post_title'); 
    679             if (!$exists) { 
     679            if ($exists) { 
    680680                    $sql = "ALTER TABLE " . TABLE_POSTS . " MODIFY post_title text NULL"; 
    681681                    $h->db->query($h->db->prepare($sql)); 
     
    716716                } 
    717717 
     718                // Change post_title column from `post_title` varchar(255) NULL, to `post_title` text NULL, 
     719                $exists = $h->db->column_exists('posts', 'post_title'); 
     720                if ($exists) { 
     721                        $sql = "ALTER TABLE " . TABLE_POSTS . " MODIFY post_title text NULL"; 
     722                        $h->db->query($h->db->prepare($sql)); 
     723                } 
     724 
    718725                // update "old version" for next set of upgrades 
    719726                //$old_version = "1.4.2"; 
     
    728735 
    729736 
    730 //      // loop through all sites to insert this setting into each one's SETTING TABLE 
    731 //      $sql = "SELECT site_id FROM " . TABLE_SITE; 
    732 //      $sites = $h->db->get_results($h->db->prepare($sql)); 
    733 // 
    734 //      $sql = "SELECT settings_siteid FROM " . TABLE_SETTINGS . " WHERE settings_name = %s"; 
    735 //      $result = $h->db->get_results($h->db->prepare($sql, 'MULTI_SITE'), ARRAY_N); 
    736 //      if (!$result) { $result = array(); } 
    737 //      //var_dump($result); 
    738 //      if ($sites) { 
    739 //          foreach ($sites as $site) { 
    740 //              if (in_array($site->site_id, $result)) { 
    741 //                  $sql = "UPDATE  " . TABLE_SETTINGS . " SET settings_value = %s WHERE settings_name = %s"; 
    742 //                  $h->db->query($h->db->prepare($sql, '', '')); 
    743 //              } else { 
    744 //                  $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    745 //                  $h->db->query($h->db->prepare($sql, '', '', '', '')); 
    746 //              } 
    747 //          } 
    748 //      } 
     737 
    749738 
    750739?>