Merge pull request #3622 from annando/new-dba

Enhanced dba functions, several replaced database calls
This commit is contained in:
Tobias Diekershoff 2017-08-11 08:11:20 +02:00 committed by GitHub
commit e6e8ebbac5
16 changed files with 183 additions and 367 deletions

View file

@ -423,9 +423,7 @@ function display_content(App $a, $update = 0) {
intval($r[0]['parent']));
if ($unseen) {
q("UPDATE `item` SET `unseen` = 0 WHERE `parent` = %d AND `unseen`",
intval($r[0]['parent'])
);
dba::update('item', array('unseen' => false), array('parent' => $r[0]['parent'], 'unseen' => true));
}
}

View file

@ -794,18 +794,12 @@ function network_content(App $a, $update = 0) {
if (!$group && !$cid && !$star) {
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `uid` = %d LIMIT 1",
intval(local_user()));
$unseen = dba::select('item', array('id'), array('unseen' => true, 'uid' => local_user()), array('limit' => 1));
if (dbm::is_result($unseen)) {
$r = q("UPDATE `item` SET `unseen` = 0
WHERE `unseen` = 1 AND `uid` = %d",
intval(local_user())
);
$r = dba::update('item', array('unseen' => false), array('uid' => local_user(), 'unseen' => true));
}
} elseif ($update_unseen) {
$unseen = q("SELECT `id` FROM `item` ".$update_unseen. " LIMIT 1");
if (dbm::is_result($unseen)) {