Rework wp_publish_post(). Should avoid running filters when changing from future to publish.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-07-22 04:17:41 +00:00
parent f423760531
commit 15b1452d54
1 changed files with 22 additions and 18 deletions

View File

@ -652,22 +652,7 @@ function wp_insert_post($postarr = array()) {
}
if ($post_status == 'publish' && $post_type == 'post') {
do_action('publish_post', $post_ID);
if ( !defined('WP_IMPORTING') ) {
if ( $post_pingback )
$result = $wpdb->query("
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value)
VALUES ('$post_ID','_pingme','1')
");
$result = $wpdb->query("
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value)
VALUES ('$post_ID','_encloseme','1')
");
wp_schedule_single_event(time(), 'do_pings');
}
wp_publish_post($post_ID);
} else if ($post_type == 'page') {
wp_cache_delete('all_page_ids', 'pages');
$wp_rewrite->flush_rules();
@ -736,10 +721,29 @@ function wp_publish_post($post_id) {
if ( empty($post) )
return;
if ( 'publish' == $post->post_status )
if ( 'publish' != $post->post_status )
$wpdb->query("UPDATE IGNORE $wpdb->posts SET post_status = 'publish' WHERE ID = $post_id");
do_action('publish_post', $post_id);
if ( defined('WP_IMPORTING') )
return;
return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));
$post_pingback = get_option('default_pingback_flag');
if ( $post_pingback )
$result = $wpdb->query("
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value)
VALUES ('$post_ID','_pingme','1')
");
$result = $wpdb->query("
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value)
VALUES ('$post_ID','_encloseme','1')
");
wp_schedule_single_event(time(), 'do_pings');
}
function wp_set_post_categories($post_ID = 0, $post_categories = array()) {