// send the email itself before cron jumps in. Only if
// mailstream_post_remote_hook fails for some reason will this get
// used, and in that case it's worth holding off a bit anyway.
- $ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `item`.`id` FROM `mailstream_item` JOIN `item` ON (`mailstream_item`.`uid` = `item`.`uid` AND `mailstream_item`.`uri` = `item`.`uri` AND `mailstream_item`.`contact-id` = `item`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `item`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100");
+ $ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `post-view`.`id` FROM `mailstream_item` JOIN `post-view` ON (`mailstream_item`.`uid` = `post-view`.`uid` AND `mailstream_item`.`uri` = `post-view`.`uri` AND `mailstream_item`.`contact-id` = `post-view`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `post-view`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100");
Logger::debug('mailstream_cron processing ' . count($ms_item_ids) . ' items');
foreach ($ms_item_ids as $ms_item_id) {
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
}
else {
Logger::info('mailstream_cron: Unable to find item ' . $ms_item_id['id']);
- q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item['message-id']));
+ q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item_id['message-id']));
}
}
mailstream_tidy();
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
- $lastitems = q("SELECT `uri` FROM `thread`
- INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
- WHERE `thread`.`network` = '%s' AND `thread`.`uid` = %d AND `item`.`extid` != ''
- ORDER BY `thread`.`commented` DESC LIMIT 10",
+ $lastitems = q("SELECT `uri` FROM `post-thread-user`
+ INNER JOIN `post-view` ON `post-view`.`id` = `post-thread-user`.`iid`
+ WHERE `post-thread-user`.`network` = '%s' AND `post-thread-user`.`uid` = %d AND `post-view`.`extid` != ''
+ ORDER BY `post-thread-user`.`commented` DESC LIMIT 10",
DBA::escape(Protocol::PUMPIO),
intval($uid)
);
$r = Post::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
while ($row = Post::fetch($r)) {
Logger::info('[twitter] Delete expired item', ['id' => $row['id'], 'guid' => $row['guid'], 'callstack' => \Friendica\Core\System::callstack()]);
- DBA::delete('item', ['id' => $row['id']]);
+ Item::markForDeletionById($row['id']);
}
DBA::close($r);
$args = explode(",",$_GET['a']);
- $baseq="SELECT COUNT(`item`.`id`) as `c`, `p`.`id`
- FROM `item`,
- (SELECT `i`.`id` FROM `item` as `i` WHERE
+ $baseq="SELECT COUNT(`post-view`.`id`) as `c`, `p`.`id`
+ FROM `post-view`,
+ (SELECT `i`.`id` FROM `post-view` as `i` WHERE
`i`.`visible` = 1 AND `i`.`deleted` = 0
AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''
AND `i`.`allow_gid` = ''
AND `i`.`deny_gid` = '' )
OR `i`.`uid` = %d )
AND `i`.`body` LIKE '%%%s%%' LIMIT 1) as `p`
- WHERE `item`.`parent` = `p`.`id` ";
+ WHERE `post-view`.`parent` = `p`.`id` ";
// count likes
- $r = q( $baseq . "AND `item`.`verb` = 'http://activitystrea.ms/schema/1.0/like'",
+ $r = q( $baseq . "AND `post-view`.`verb` = 'http://activitystrea.ms/schema/1.0/like'",
intval($conf['uid']),
DBA::escape($args[0])
);
$strdislike = '';
if (!DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
// count dislikes
- $r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
+ $r = q( $baseq . "AND `post-view`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
intval($conf['uid']),
DBA::escape($args[0])
);
} else {
// retrieve the number of unseen items and the id of the latest one (if there are more than
// one new entries since last poller run, only the latest one will be pushed)
- $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `item` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid']));
+ $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `post-view` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid']));
// send number of unseen items to the device (the number will be displayed on Start screen until
// App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if