Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions admin-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ function _s( $n = 0, $plural = 's', $singular = '' ) {
function fwp_update_set_results_message( $delta, $joiner = ';' ) {

$mesg = array();
if (isset($delta['new'])) : $mesg[] = ' '.$delta['new'].' new posts were syndicated'; endif;
if (isset($delta['updated']) and ($delta['updated'] != 0)) : $mesg[] = ' '.$delta['updated'].' existing posts were updated'; endif;
if (isset($delta['stored']) and ($delta['stored'] != 0)) : $mesg[] = ' '.$delta['stored'].' alternate versions of existing posts were stored for reference'; endif;
if (isset($delta['failed']) and ($delta['failed'] != 0)) : $mesg[] = ' Failed to import '.$delta['failed'].' post' . ($delta['failed'] != 1 ? 's' : ''); endif;

$delta = wp_parse_args(
$delta,
Expand Down
2 changes: 1 addition & 1 deletion feedwordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ public function update( $uri = null, $crash_ts = null ) {
// If at least one feed was hit for updating...
if ( $pinged_that and is_null( $delta ) ) :
// ... don't return error condition
$delta = array( 'new' => 0, 'updated' => 0, 'stored' => 0 );
$delta = array('new' => 0, 'updated' => 0, 'stored' => 0, 'failed' => 0);
endif;

if ( $pinged_that and $timely ) :
Expand Down
6 changes: 4 additions & 2 deletions syndicatedlink.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function poll ($crash_ts = NULL) {
// Success; clear out error setting, if any.
$this->update_setting('update/error', NULL);

$new_count = array('new' => 0, 'updated' => 0, 'stored' => 0);
$new_count = array('new' => 0, 'updated' => 0, 'stored' => 0, 'failed' => 0);

# -- Update Link metadata live from feed
$channel = $this->magpie->channel;
Expand Down Expand Up @@ -269,7 +269,9 @@ public function poll ($crash_ts = NULL) {
$processed[] = $post->guid();
if ( ! $post->filtered()) :
$new = $post->store();
if ( $new !== false ) $new_count[$new]++;
if ( $new !== false ) {
$new_count[$new]++;
}
endif;

if ( !is_null($crash_ts) and (time() > $crash_ts)) :
Expand Down
11 changes: 10 additions & 1 deletion syndicatedpost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,11 @@ public function store () {
FeedWordPress::diagnostic('syndicated_posts', $diag);
endif;

$this->insert_post(/*update=*/ $this->fresh_content_is_update(), $this->freshness());
$post_id = $this->insert_post(/*update=*/ $this->fresh_content_is_update(), $this->freshness());

if ($post_id === false) {
return 'failed';
}

$hook = $this->fresh_storage_hook();
if ( !is_null($hook)) :
Expand Down Expand Up @@ -1774,6 +1778,11 @@ function insert_post ($update = false, $freshness = 2) {

$this->_wp_id = wp_insert_post($sdbpost, /*return wp_error=*/ true);

// If the post fails to insert mark as bad.
if (is_wp_error($this->_wp_id)) {
return false;
}

$dbpost['ID'] = $this->_wp_id;
endif;

Expand Down