Renaming. object and subpost are now attachment. post_type is post_mime_type.

git-svn-id: https://develop.svn.wordpress.org/trunk@3092 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2005-11-15 22:55:24 +00:00
parent 06d61e1f7a
commit 1a012b8b49
11 changed files with 125 additions and 89 deletions

View File

@@ -30,7 +30,7 @@ function upgrade_all() {
upgrade_130();
}
if ( $wp_current_db_version < 3091 )
if ( $wp_current_db_version < 3092 )
upgrade_160();
save_mod_rewrite_rules();
@@ -240,8 +240,8 @@ function upgrade_130() {
}
function upgrade_160() {
global $wpdb, $table_prefix;
global $wpdb, $table_prefix, $wp_current_db_version;
populate_roles_160();
$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
@@ -300,6 +300,23 @@ function upgrade_160() {
$wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'");
}
}
// Some alpha versions used a post status of object instead of attachment and put
// the mime type in post_type instead of post_mime_type.
if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
foreach ($objects as $object) {
$wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment',
post_mime_type = '$object->post_type',
post_type = '',
guid = '$guid'
WHERE ID = $object->ID");
$meta = get_post_meta($postid, 'imagedata', true);
if ( ! empty($meta['file']) )
add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
}
}
}
// The functions we use to actually do stuff