Allow draft pages. Use post_type for object types. Reserve post_status strictly for status. fixes #1820

git-svn-id: https://develop.svn.wordpress.org/trunk@3510 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-02-09 10:03:48 +00:00
parent db5355013c
commit f961003343
21 changed files with 143 additions and 95 deletions
+25
View File
@@ -33,6 +33,9 @@ function upgrade_all() {
if ( $wp_current_db_version < 3308 )
upgrade_160();
if ( $wp_current_db_version < 3506 )
upgrade_210();
$wp_rewrite->flush_rules();
update_option('db_version', $wp_db_version);
@@ -326,6 +329,28 @@ function upgrade_160() {
}
}
function upgrade_210() {
global $wpdb, $table_prefix, $wp_current_db_version;
// Update status and type.
$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
if ( ! empty($posts) ) foreach ($posts as $post) {
$status = $post->post_status;
$type = 'post';
if ( 'static' == $status ) {
$status = 'publish';
$type = 'page';
} else if ( 'attachment' == $status ) {
$status = 'inherit';
$type = 'attachment';
}
$wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
}
}
// The functions we use to actually do stuff
// General