Add new page caps now that pages can be draft or publish. Brings page caps to parity with posts. Add delete caps for posts and pages. fixes #2382 #2336 #2301

git-svn-id: https://develop.svn.wordpress.org/trunk@3513 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-02-11 09:56:02 +00:00
parent cf622439d5
commit bde96bc025
8 changed files with 177 additions and 53 deletions
+20 -14
View File
@@ -33,7 +33,7 @@ function upgrade_all() {
if ( $wp_current_db_version < 3308 )
upgrade_160();
if ( $wp_current_db_version < 3506 )
if ( $wp_current_db_version < 3513 )
upgrade_210();
$wp_rewrite->flush_rules();
@@ -332,22 +332,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 ( $wp_current_db_version < 3506 ) {
// 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 ( ! 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';
}
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'");
$wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
}
}
if ( $wp_current_db_version < 3513 ) {
populate_roles_210();
}
}