Merge pull request #1082 from annando/no-item

All references to the item table had been removed
This commit is contained in:
Hypolite Petovan 2021-02-14 11:05:11 -05:00 committed by GitHub
commit 7777f08047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View File

@ -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();

View File

@ -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)
);

View File

@ -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);

View File

@ -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])
);

View File

@ -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