Make WordPress Core


Ignore:
Timestamp:
02/11/2006 09:56:02 AM (19 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r3510 r3513  
    3434        upgrade_160();
    3535
    36     if ( $wp_current_db_version < 3506 )
     36    if ( $wp_current_db_version < 3513 )
    3737        upgrade_210();
    3838
     
    333333    global $wpdb, $table_prefix, $wp_current_db_version;
    334334
    335     // Update status and type.
    336     $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
    337    
    338     if ( ! empty($posts) ) foreach ($posts as $post) {
    339         $status = $post->post_status;
    340         $type = 'post';
    341 
    342         if ( 'static' == $status ) {
    343             $status = 'publish';
    344             $type = 'page';
    345         } else if ( 'attachment' == $status ) {
    346             $status = 'inherit';
    347             $type = 'attachment';   
    348         }
     335    if ( $wp_current_db_version < 3506 ) {
     336        // Update status and type.
     337        $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
     338   
     339        if ( ! empty($posts) ) foreach ($posts as $post) {
     340            $status = $post->post_status;
     341            $type = 'post';
     342
     343            if ( 'static' == $status ) {
     344                $status = 'publish';
     345                $type = 'page';
     346            } else if ( 'attachment' == $status ) {
     347                $status = 'inherit';
     348                $type = 'attachment';   
     349            }
    349350       
    350         $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
     351            $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
     352        }
     353    }
     354   
     355    if ( $wp_current_db_version < 3513 ) {
     356        populate_roles_210();   
    351357    }
    352358}
Note: See TracChangeset for help on using the changeset viewer.