-
- foreach($feed->get_items() as $item) {
-
- $deleted = false;
-
- $rawdelete = $item->get_item_tags( NAMESPACE_TOMB, 'deleted-entry');
- if(isset($rawdelete[0]['attribs']['']['ref'])) {
- $uri = $rawthread[0]['attribs']['']['ref'];
- $deleted = true;
- if(isset($rawdelete[0]['attribs']['']['when'])) {
- $when = $rawthread[0]['attribs']['']['when'];
- $when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s');
- }
- else
- $when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
- }
- if($deleted) {
- $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($uri),
- intval($importer['uid'])
- );
- if(count($r)) {
- $item = $r[0];
- if($item['uri'] == $item['parent-uri']) {
- $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
- `body` = '', `title` = ''
- WHERE `parent-uri` = '%s' AND `uid` = %d",
- dbesc($when),
- dbesc(datetime_convert()),
- dbesc($item['uri']),
- intval($importer['uid'])
- );
+ if($feed->get_item_quantity()) {
+ foreach($feed->get_items() as $item) {
+
+ $deleted = false;
+
+ $rawdelete = $item->get_item_tags( NAMESPACE_TOMB, 'deleted-entry');
+ if(isset($rawdelete[0]['attribs']['']['ref'])) {
+ $uri = $rawthread[0]['attribs']['']['ref'];
+ $deleted = true;
+ if(isset($rawdelete[0]['attribs']['']['when'])) {
+ $when = $rawthread[0]['attribs']['']['when'];
+ $when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s');