summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes/upgrade.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-23 18:28:40 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-23 18:28:40 +0000
commit87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch)
tree6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-admin/includes/upgrade.php
parent0cbda3349a2571904ea063fdd73e018299919589 (diff)
downloadwordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz
wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz
wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes/upgrade.php')
-rw-r--r--wp-admin/includes/upgrade.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 71e6399..b30daef 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -541,6 +541,7 @@ function upgrade_230() {
// Convert categories to terms.
$tt_ids = array();
+ $have_tags = false;
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
foreach ($categories as $category) {
$term_id = (int) $category->cat_ID;
@@ -587,6 +588,7 @@ function upgrade_230() {
}
if ( !empty($category->tag_count) ) {
+ $have_tags = true;
$count = (int) $category->tag_count;
$taxonomy = 'post_tag';
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
@@ -601,7 +603,11 @@ function upgrade_230() {
}
}
- $posts = $wpdb->get_results("SELECT * FROM $wpdb->post2cat");
+ $select = 'post_id, category_id';
+ if ( $have_tags )
+ $select .= ', rel_type';
+
+ $posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id");
foreach ( $posts as $post ) {
$post_id = (int) $post->post_id;
$term_id = (int) $post->category_id;
@@ -666,7 +672,7 @@ function upgrade_230() {
// Set default to the last category we grabbed during the upgrade loop.
update_option('default_link_category', $default_link_cat);
} else {
- $links = $wpdb->get_results("SELECT * FROM $wpdb->link2cat");
+ $links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id");
foreach ( $links as $link ) {
$link_id = (int) $link->link_id;
$term_id = (int) $link->category_id;
@@ -1010,7 +1016,6 @@ function dbDelta($queries, $execute = true) {
}
// Add the column list to the index create string
$index_string .= ' ('.$index_columns.')';
- error_log("Index string: $index_string", 0);
if(!(($aindex = array_search($index_string, $indices)) === false)) {
unset($indices[$aindex]);
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
@@ -1248,12 +1253,10 @@ function translate_level_to_role($level) {
}
function wp_check_mysql_version() {
- global $wp_version;
-
- // Make sure the server has MySQL 4.0
- $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
- if ( version_compare($mysql_version, '4.0.0', '<') )
- die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
+ global $wpdb;
+ $result = $wpdb->check_database_version();
+ if ( is_wp_error( $result ) )
+ die( $result->get_error_message() );
}
function maybe_disable_automattic_widgets() {