[wp-cvs] wordpress wp-mail.php,1.22,1.23

Michel Valdrighi michelvaldrighi at users.sourceforge.net
Mon Jan 31 19:00:29 GMT 2005


Update of /cvsroot/cafelog/wordpress
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22140

Modified Files:
	wp-mail.php 
Log Message:
moving the pop3->delete call to the end of the loop so that emails are deleted if and only if a post is made successfully

Index: wp-mail.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-mail.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** wp-mail.php	31 Jan 2005 17:19:56 -0000	1.22
--- wp-mail.php	31 Jan 2005 19:00:25 -0000	1.23
***************
*** 25,36 ****
  	$message = $pop3->get($i);
  
- 	if(!$pop3->delete($i)) {
- 		echo '<p>Oops '.$pop3->ERROR.'</p></div>';
- 		$pop3->reset();
- 		exit;
- 	} else {
- 		echo "<p>Mission complete, message <strong>$i</strong> deleted.</p>";
- 	}
- 
  	$content = '';
  	$content_type = '';
--- 25,28 ----
***************
*** 145,148 ****
--- 137,145 ----
  	$post_ID = wp_insert_post($post_data);
  
+ 	if (!$post_ID) {
+ 		// we couldn't post, for whatever reason. better move forward to the next email
+ 		continue;
+ 	}
+ 
  	do_action('publish_phone', $post_ID);
  
***************
*** 153,170 ****
  	if (!$post_categories) $post_categories[] = 1;
  	foreach ($post_categories as $post_category) :
! 	$post_category = intval($post_category);
  
! 	// Double check it's not there already
! 	$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
  
! 	 if (!$exists && $result) { 
! 		$wpdb->query("
! 		INSERT INTO $wpdb->post2cat
! 		(post_id, category_id)
! 		VALUES
! 		($post_ID, $post_category)
! 		");
  	}
- endforeach;
  
  endfor;
--- 150,175 ----
  	if (!$post_categories) $post_categories[] = 1;
  	foreach ($post_categories as $post_category) :
! 		$post_category = intval($post_category);
  
! 		// Double check it's not there already
! 		$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
  
! 		if (!$exists && $result) { 
! 			$wpdb->query("
! 			INSERT INTO $wpdb->post2cat
! 			(post_id, category_id)
! 			VALUES
! 			($post_ID, $post_category)
! 			");
! 		}
! 	endforeach;
! 
! 	if(!$pop3->delete($i)) {
! 		echo '<p>Oops '.$pop3->ERROR.'</p></div>';
! 		$pop3->reset();
! 		exit;
! 	} else {
! 		echo "<p>Mission complete, message <strong>$i</strong> deleted.</p>";
  	}
  
  endfor;



More information about the cvs mailing list