]> git.mxchange.org Git - friendica.git/commitdiff
Use the item classes where possible
authorMichael <heluecht@pirati.ca>
Mon, 18 Jun 2018 05:19:28 +0000 (05:19 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 18 Jun 2018 05:19:28 +0000 (05:19 +0000)
include/api.php
include/text.php
mod/display.php
src/Model/Term.php

index d66446cb6896f346e9d0bf701ec264371379c98a..1fbdd8f7fc458fbaf7e26f0e51bfed5089d434b0 100644 (file)
@@ -688,59 +688,8 @@ function api_get_user(App $a, $contact_id = null)
 
                $usr = dba::selectFirst('user', ['default-location'], ['uid' => api_user()]);
                $profile = dba::selectFirst('profile', ['about'], ['uid' => api_user(), 'is-default' => true]);
-
-               /// @TODO old-lost code? (twice)
-               // Counting is deactivated by now, due to performance issues
-               // count public wall messages
-               //$r = q("SELECT COUNT(*) as `count` FROM `item` WHERE `uid` = %d AND `wall`",
-               //              intval($uinfo[0]['uid'])
-               //);
-               //$countitms = $r[0]['count'];
-               $countitms = 0;
-       } else {
-               // Counting is deactivated by now, due to performance issues
-               //$r = q("SELECT count(*) as `count` FROM `item`
-               //              WHERE  `contact-id` = %d",
-               //              intval($uinfo[0]['id'])
-               //);
-               //$countitms = $r[0]['count'];
-               $countitms = 0;
-       }
-
-               /// @TODO old-lost code? (twice)
-               /*
-               // Counting is deactivated by now, due to performance issues
-               // count friends
-               $r = q("SELECT count(*) as `count` FROM `contact`
-                               WHERE  `uid` = %d AND `rel` IN ( %d, %d )
-                               AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
-                               intval($uinfo[0]['uid']),
-                               intval(CONTACT_IS_SHARING),
-                               intval(CONTACT_IS_FRIEND)
-               );
-               $countfriends = $r[0]['count'];
-
-               $r = q("SELECT count(*) as `count` FROM `contact`
-                               WHERE  `uid` = %d AND `rel` IN ( %d, %d )
-                               AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0",
-                               intval($uinfo[0]['uid']),
-                               intval(CONTACT_IS_FOLLOWER),
-                               intval(CONTACT_IS_FRIEND)
-               );
-               $countfollowers = $r[0]['count'];
-
-               $r = q("SELECT count(*) as `count` FROM item where starred = 1 and uid = %d and deleted = 0",
-                       intval($uinfo[0]['uid'])
-               );
-               $starred = $r[0]['count'];
-
-
-               if (! $uinfo[0]['self']) {
-                       $countfriends = 0;
-                       $countfollowers = 0;
-                       $starred = 0;
-               }
-               */
+       }
+       $countitms = 0;
        $countfriends = 0;
        $countfollowers = 0;
        $starred = 0;
index 612100cb6715e6765059a46ec708d2418e412693..16c0b41814f09daca9a521d3fa52c6e3279818a7 100644 (file)
@@ -1177,8 +1177,8 @@ function put_item_in_cache(&$item, $update = false)
                }
 
                if ($update && ($item["id"] > 0)) {
-                       dba::update('item', ['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]],
-                                       ['id' => $item["id"]], false);
+                       Item::update(['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]],
+                                       ['id' => $item["id"]]);
                }
        }
 
index 7198d4bb5f89414073f04cc2fc5a15ba5e585afb..13ec9331be55bc1dbb4f9916141aea31ce04bd71 100644 (file)
@@ -360,7 +360,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
 
        if ($unseen) {
                $condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
-               dba::update('item', ['unseen' => false], $condition);
+               Item::update(['unseen' => false], $condition);
        }
 
        $items = conv_sort($s, "`commented`");
index fd44603f978f33a8aff6eb18964875aeca2d9442..0de2eddf48f458aae33ec4c67778af8d5d085971 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Model;
 
 use Friendica\Core\System;
 use Friendica\Database\DBM;
+use Friendica\Model\Item;
 use dba;
 
 require_once 'boot.php';
@@ -114,7 +115,7 @@ class Term
                                $users = q("SELECT `uid` FROM `contact` WHERE self AND (`url` = '%s' OR `nurl` = '%s')", $link, $link);
                                foreach ($users AS $user) {
                                        if ($user['uid'] == $message['uid']) {
-                                               dba::update('item', ['mention' => true], ['id' => $itemid]);
+                                               Item::update(['mention' => true], ['id' => $itemid]);
                                                dba::update('thread', ['mention' => true], ['iid' => $message['parent']]);
                                        }
                                }