Make WordPress Core

Changeset 11750


Ignore:
Timestamp:
07/30/2009 02:55:07 PM (15 years ago)
Author:
azaozz
Message:

Trash status update, see #4529

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r11749 r11750  
    33533353    $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
    33543354
    3355     foreach ( $trash_meta['comments'] as $id => $meta ) {
     3355    foreach ( (array) $trash_meta['comments'] as $id => $meta ) {
    33563356        if ( $meta['time'] < $delete_timestamp ) {
    33573357            wp_delete_comment($id);
     
    33593359        }
    33603360    }
    3361     foreach ( $trash_meta['posts'] as $id => $meta ) {
     3361    foreach ( (array) $trash_meta['posts'] as $id => $meta ) {
    33623362        if ( $meta['time'] < $delete_timestamp ) {
    33633363            wp_delete_post($id);
    3364             unset($to_delete['posts'][$id]);
     3364            unset($trash_meta['posts'][$id]);
    33653365        }
    33663366    }
    33673367
    3368     update_option('wp_scheduled_delete', $to_delete);
    3369 }
     3368    update_option('wp_trash_meta', $trash_meta);
     3369}
  • trunk/wp-includes/post.php

    r11749 r11750  
    12501250
    12511251/**
    1252  * Removes a post or page from the Trash
     1252 * Restores a post or page from the Trash
    12531253 *
    12541254 * @since 2.9.0
     
    12601260 */
    12611261function wp_untrash_post($postid = 0) {
    1262     if (!$post = wp_get_single_post($postid, ARRAY_A))
     1262    if ( !$post = wp_get_single_post($postid, ARRAY_A) )
    12631263        return $post;
    12641264
    12651265    do_action('untrash_post', $postid);
    1266    
     1266
    12671267    $post['post_status'] = 'draft';
    1268    
     1268
    12691269    $trash_meta = get_option('wp_trash_meta');
    1270     if (is_array($trash_meta) && isset($trash_meta['posts'][$postid])) {
     1270    if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
    12711271        $post['post_status'] = $trash_meta['posts'][$postid]['status'];
    12721272        unset($trash_meta['posts'][$postid]);
    12731273        update_option('wp_trash_meta', $trash_meta);
    12741274    }
    1275    
     1275
    12761276    wp_insert_post($post);
    1277    
     1277
    12781278    do_action('untrashed_post', $postid);
    12791279
     
    26632663    if ( 'attachment' != $post->post_type )
    26642664        return false;
    2665    
     2665
    26662666    if ( 'trash' != $post->post_status )
    26672667        return wp_trash_post($postid);
Note: See TracChangeset for help on using the changeset viewer.