From 05a805398ef5c05bf5faf24a6a60f719e34b14da Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 14 Feb 2021 08:18:02 +0000 Subject: [PATCH] All references to the item table had been removed --- mailstream/mailstream.php | 4 ++-- pumpio/pumpio.php | 8 ++++---- twitter/twitter.php | 2 +- widgets/widget_like.php | 12 ++++++------ windowsphonepush/windowsphonepush.php | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index f1043ef3..3abf2e5a 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -332,7 +332,7 @@ function mailstream_cron($a, $b) { // 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'])) { @@ -346,7 +346,7 @@ function mailstream_cron($a, $b) { } 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(); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 19f11190..357f1743 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1299,10 +1299,10 @@ function pumpio_fetchinbox(App $a, $uid) $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) ); diff --git a/twitter/twitter.php b/twitter/twitter.php index e1265d5d..519cfd2d 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -853,7 +853,7 @@ function twitter_expire(App $a) $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); diff --git a/widgets/widget_like.php b/widgets/widget_like.php index 8dd6b8a7..9b347d94 100644 --- a/widgets/widget_like.php +++ b/widgets/widget_like.php @@ -25,9 +25,9 @@ function like_widget_content(&$a, $conf){ $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` = '' @@ -35,10 +35,10 @@ function like_widget_content(&$a, $conf){ 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]) ); @@ -48,7 +48,7 @@ function like_widget_content(&$a, $conf){ $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]) ); diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 5d07e1cc..bf160f0a 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -150,7 +150,7 @@ function windowsphonepush_cron() } 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