From: Michael Date: Wed, 16 Nov 2016 06:27:21 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/develop' into 1607-performance X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=126c4774c330d9c9c9038312198c57fb653682df;p=friendica.git Merge remote-tracking branch 'upstream/develop' into 1607-performance Conflicts: include/dbstructure.php mod/item.php mod/nodeinfo.php --- 126c4774c330d9c9c9038312198c57fb653682df diff --cc include/dba.php index a9bd571e72,082a54bd49..7ca520712a --- a/include/dba.php +++ b/include/dba.php @@@ -61,25 -61,28 +61,30 @@@ class dba } } - if(class_exists('mysqli')) { + if (class_exists('mysqli')) { $this->db = @new mysqli($server,$user,$pass,$db); - if(! mysqli_connect_errno()) { + if (! mysqli_connect_errno()) { $this->connected = true; + //mysqli_set_charset($this->db, 'utf8'); } - } - else { + if (isset($a->config["system"]["db_charset"])) { + $this->db->set_charset($a->config["system"]["db_charset"]); + } + } else { $this->mysqli = false; $this->db = mysql_connect($server,$user,$pass); - if($this->db && mysql_select_db($db,$this->db)) { + if ($this->db && mysql_select_db($db,$this->db)) { $this->connected = true; + //mysql_set_charset('utf8', $this->db); } + if (isset($a->config["system"]["db_charset"])) + mysql_set_charset($a->config["system"]["db_charset"], $this->db); } - if(! $this->connected) { + if (!$this->connected) { $this->db = null; - if(! $install) + if (!$install) { system_unavailable(); + } } $a->save_timestamp($stamp1, "network"); diff --cc mod/network.php index f62799f768,559bad0a3e..1b7574d109 --- a/mod/network.php +++ b/mod/network.php @@@ -596,9 -597,10 +597,9 @@@ function network_content(&$a, $update // only setup pagination on initial page view $pager_sql = ''; - } - else { + } else { if(get_config('system', 'old_pager')) { - $r = q("SELECT COUNT(*) AS `total` + $r = qu("SELECT COUNT(*) AS `total` FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending` WHERE $sql_table.`uid` = %d AND $sql_table.`visible` AND NOT $sql_table.`deleted` @@@ -635,10 -637,10 +636,10 @@@ $simple_update = (($update) ? " AND `item`.`unseen` " : ''); if ($sql_order == "") - $sql_order = "`item`.`received`"; + $sql_order = "`item`.`id`"; // "New Item View" - show all items unthreaded in reverse created date order - $items = q("SELECT %s FROM $sql_table $sql_post_table %s + $items = qu("SELECT %s FROM $sql_table $sql_post_table %s WHERE %s AND `item`.`uid` = %d $simple_update $sql_extra $sql_nets diff --cc mod/nodeinfo.php index b90e05174e,40094ee6e3..334dcb055d --- a/mod/nodeinfo.php +++ b/mod/nodeinfo.php @@@ -183,22 -183,15 +183,15 @@@ function nodeinfo_cron() return; } } - logger("cron_start"); +*/ logger("cron_start"); - $users = q("SELECT profile.*, `user`.`login_date`, `lastitem`.`lastitem_date` - FROM (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid` - FROM `item` - WHERE `item`.`type` = 'wall' - GROUP BY `item`.`uid`) AS `lastitem` - RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`, `contact`, `profile` - WHERE - `user`.`uid` = `contact`.`uid` AND `profile`.`uid` = `user`.`uid` - AND `profile`.`is-default` AND (`profile`.`publish` OR `profile`.`net-publish`) - AND `user`.`verified` AND `contact`.`self` - AND NOT `user`.`blocked` - AND NOT `user`.`account_removed` - AND NOT `user`.`account_expired`"); - + $users = qu("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item` + FROM `user` + INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` AND `profile`.`is-default` + INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` + WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified` + AND NOT `user`.`blocked` AND NOT `user`.`account_removed` + AND NOT `user`.`account_expired`"); if (is_array($users)) { $total_users = count($users); $active_users_halfyear = 0; @@@ -224,20 -217,7 +217,9 @@@ set_config('nodeinfo','active_users_monthly', $active_users_monthly); } - // $posts = q("SELECT COUNT(*) AS `local_posts` FROM `thread` - // INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id` AND `contact`.`uid` = `thread`.`uid` - // WHERE `contact`.`self`"); - $posts = q("SELECT COUNT(*) AS local_posts FROM `thread` WHERE `thread`.`wall`"); - /* - $posts = q("SELECT COUNT(*) AS local_posts FROM `thread` - INNER JOIN `item` ON `item`.`id` = `thread`.`iid` - WHERE `thread`.`wall` AND NOT `thread`.`private` AND - `thread`.`uid` != 0 AND LEFT(`item`.`body`, 6) != '[share' AND - `thread`.`network` IN ('%s', '%s', '%s')", - dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN)); - */ ++ $posts = qu("SELECT COUNT(*) AS local_posts FROM `thread` WHERE `thread`.`wall`"); +/* - $posts = q("SELECT COUNT(*) AS `local_posts` FROM `item` + $posts = qu("SELECT COUNT(*) AS `local_posts` FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `contact`.`self` and `item`.`id` = `item`.`parent` AND left(body, 6) != '[share' AND `item`.`network` IN ('%s', '%s', '%s')", dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));