Changeset 1355 for trunk/wp-admin/import-b2.php
- Timestamp:
- 05/24/2004 08:22:18 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import-b2.php
r1117 r1355 83 83 84 84 while ($row = mysql_fetch_row($result)) { 85 if ($row[0] == $ tablelinks)85 if ($row[0] == $wpdb->links) 86 86 $got_links = true; 87 if ($row[0] == $ tablelinkcategories)87 if ($row[0] == $wpdb->linkcategories) 88 88 $got_cats = true; 89 89 //print "Table: $row[0]<br />\n"; 90 90 } 91 91 if (!$got_cats) { 92 echo "<p>Can't find table '$ tablelinkcategories', gonna create it...</p>\n";93 $sql = "CREATE TABLE $ tablelinkcategories ( " .92 echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n"; 93 $sql = "CREATE TABLE $wpdb->linkcategories ( " . 94 94 " cat_id int(11) NOT NULL auto_increment, " . 95 95 " cat_name tinytext NOT NULL, ". … … 97 97 " PRIMARY KEY (cat_id) ". 98 98 ") "; 99 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());99 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error()); 100 100 if ($result != false) { 101 echo "<p>Table '$ tablelinkcategories' created OK</p>\n";101 echo "<p>Table '$wpdb->linkcategories' created OK</p>\n"; 102 102 $got_cats = true; 103 103 } 104 104 } else { 105 echo "<p>Found table '$ tablelinkcategories', don't need to create it...</p>\n";105 echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n"; 106 106 $got_cats = true; 107 107 } 108 108 if (!$got_links) { 109 echo "<p>Can't find '$ tablelinks', gonna create it...</p>\n";110 $sql = "CREATE TABLE $ tablelinks ( " .109 echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n"; 110 $sql = "CREATE TABLE $wpdb->links ( " . 111 111 " link_id int(11) NOT NULL auto_increment, " . 112 112 " link_url varchar(255) NOT NULL default '', " . … … 124 124 " PRIMARY KEY (link_id) " . 125 125 ") "; 126 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());127 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");128 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");129 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");126 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error()); 127 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 128 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 129 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 130 130 131 131 if ($result != false) { 132 echo "<p>Table '$ tablelinks' created OK</p>\n";132 echo "<p>Table '$wpdb->links' created OK</p>\n"; 133 133 $got_links = true; 134 134 } 135 135 } else { 136 echo "<p>Found table '$ tablelinks', don't need to create it...</p>\n";136 echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n"; 137 137 echo "<p>... may need to update it though. Looking for column link_updated...</p>\n"; 138 $query = "SELECT link_updated FROM $ tablelinks LIMIT 1";138 $query = "SELECT link_updated FROM $wpdb->links LIMIT 1"; 139 139 $q = @mysql_query($query); 140 140 if ($q != false) { … … 143 143 } 144 144 } else { 145 $query = "ALTER TABLE $ tablelinks ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";145 $query = "ALTER TABLE $wpdb->links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"; 146 146 $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); 147 147 echo "<p>Added column link_updated...</p>\n"; 148 148 } 149 149 echo "<p>Looking for column link_rel...</p>\n"; 150 $query = "SELECT link_rel FROM $ tablelinks LIMIT 1";150 $query = "SELECT link_rel FROM $wpdb->links LIMIT 1"; 151 151 $q = @mysql_query($query); 152 152 if ($q != false) { … … 155 155 } 156 156 } else { 157 $query = "ALTER TABLE $ tablelinks ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' ";157 $query = "ALTER TABLE $wpdb->links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' "; 158 158 $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); 159 159 echo "<p>Added column link_rel...</p>\n"; … … 164 164 if ($got_links && $got_cats) { 165 165 echo "<p>Looking for category 1...</p>\n"; 166 $sql = "SELECT * FROM $ tablelinkcategories WHERE cat_id=1 ";167 $result = mysql_query($sql) or print ("Can't query '$ tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());166 $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; 167 $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error()); 168 168 if ($result != false) { 169 169 if ($row = mysql_fetch_object($result)) { … … 172 172 } else { 173 173 echo "<p>Gonna insert category 1...</p>\n"; 174 $sql = "INSERT INTO $ tablelinkcategories (cat_id, cat_name) VALUES (1, 'General')";174 $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'General')"; 175 175 $result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error()); 176 176 if ($result != false) { … … 197 197 <?php 198 198 199 $query = "ALTER TABLE $ tableposts ADD COLUMN post_excerpt text NOT NULL;";199 $query = "ALTER TABLE $wpdb->posts ADD COLUMN post_excerpt text NOT NULL;"; 200 200 $q = $wpdb->query($query); 201 201 // 0.71 mods 202 $query = "ALTER TABLE $ tableposts ADD post_status ENUM('publish','draft','private') NOT NULL,202 $query = "ALTER TABLE $wpdb->posts ADD post_status ENUM('publish','draft','private') NOT NULL, 203 203 ADD comment_status ENUM('open','closed') NOT NULL, 204 204 ADD ping_status ENUM('open','closed') NOT NULL, … … 210 210 211 211 <?php 212 $query = "ALTER TABLE $ tableposts DROP INDEX ID";212 $query = "ALTER TABLE $wpdb->posts DROP INDEX ID"; 213 213 214 214 $q = $wpdb->query($query); … … 218 218 <p>One down, two to go...</p> 219 219 220 <?php221 222 $query="ALTER TABLE $tablesettings DROP INDEX ID";223 $q = $wpdb->query($query);224 225 ?>226 220 227 221 <p>So far so good.</p> 228 222 <?php 229 223 230 $query="ALTER TABLE $ tableposts DROP post_karma";224 $query="ALTER TABLE $wpdb->posts DROP post_karma"; 231 225 $q = $wpdb->query($query); 232 226 flush(); … … 237 231 <?php 238 232 239 $query = "ALTER TABLE $ tableusers DROP INDEX ID";233 $query = "ALTER TABLE $wpdb->users DROP INDEX ID"; 240 234 241 235 $q = $wpdb->query($query);
Note: See TracChangeset
for help on using the changeset viewer.