Trash status update, see #4529
git-svn-id: https://develop.svn.wordpress.org/trunk@11750 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d9f8c67f2f
commit
16241293d3
|
@ -3352,18 +3352,18 @@ function wp_scheduled_delete() {
|
||||||
|
|
||||||
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
||||||
|
|
||||||
foreach ( $trash_meta['comments'] as $id => $meta ) {
|
foreach ( (array) $trash_meta['comments'] as $id => $meta ) {
|
||||||
if ( $meta['time'] < $delete_timestamp ) {
|
if ( $meta['time'] < $delete_timestamp ) {
|
||||||
wp_delete_comment($id);
|
wp_delete_comment($id);
|
||||||
unset($trash_meta['comments'][$id]);
|
unset($trash_meta['comments'][$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ( $trash_meta['posts'] as $id => $meta ) {
|
foreach ( (array) $trash_meta['posts'] as $id => $meta ) {
|
||||||
if ( $meta['time'] < $delete_timestamp ) {
|
if ( $meta['time'] < $delete_timestamp ) {
|
||||||
wp_delete_post($id);
|
wp_delete_post($id);
|
||||||
unset($to_delete['posts'][$id]);
|
unset($trash_meta['posts'][$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_option('wp_scheduled_delete', $to_delete);
|
update_option('wp_trash_meta', $trash_meta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1249,7 +1249,7 @@ function wp_trash_post($postid = 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a post or page from the Trash
|
* Restores a post or page from the Trash
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
* @uses do_action() on 'untrash_post' before undeletion
|
* @uses do_action() on 'untrash_post' before undeletion
|
||||||
|
@ -1259,7 +1259,7 @@ function wp_trash_post($postid = 0) {
|
||||||
* @return mixed False on failure
|
* @return mixed False on failure
|
||||||
*/
|
*/
|
||||||
function wp_untrash_post($postid = 0) {
|
function wp_untrash_post($postid = 0) {
|
||||||
if (!$post = wp_get_single_post($postid, ARRAY_A))
|
if ( !$post = wp_get_single_post($postid, ARRAY_A) )
|
||||||
return $post;
|
return $post;
|
||||||
|
|
||||||
do_action('untrash_post', $postid);
|
do_action('untrash_post', $postid);
|
||||||
|
@ -1267,7 +1267,7 @@ function wp_untrash_post($postid = 0) {
|
||||||
$post['post_status'] = 'draft';
|
$post['post_status'] = 'draft';
|
||||||
|
|
||||||
$trash_meta = get_option('wp_trash_meta');
|
$trash_meta = get_option('wp_trash_meta');
|
||||||
if (is_array($trash_meta) && isset($trash_meta['posts'][$postid])) {
|
if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
|
||||||
$post['post_status'] = $trash_meta['posts'][$postid]['status'];
|
$post['post_status'] = $trash_meta['posts'][$postid]['status'];
|
||||||
unset($trash_meta['posts'][$postid]);
|
unset($trash_meta['posts'][$postid]);
|
||||||
update_option('wp_trash_meta', $trash_meta);
|
update_option('wp_trash_meta', $trash_meta);
|
||||||
|
|
Loading…
Reference in New Issue