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: http://svn.automattic.com/wordpress/trunk@3513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user