]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1607-performance
authorMichael <heluecht@pirati.ca>
Wed, 16 Nov 2016 06:27:21 +0000 (06:27 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 16 Nov 2016 06:27:21 +0000 (06:27 +0000)
Conflicts:
include/dbstructure.php
mod/item.php
mod/nodeinfo.php

1  2 
include/Contact.php
include/dba.php
include/dbstructure.php
include/onepoll.php
mod/contacts.php
mod/network.php
mod/nodeinfo.php

Simple merge
diff --cc include/dba.php
index a9bd571e72ec2d758f5a4edb4a2cee60a0975c3d,082a54bd496694875cb7756974f049c2f065a179..7ca520712a455a31d53d4b92e24800cbcbdac124
@@@ -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");
Simple merge
Simple merge
Simple merge
diff --cc mod/network.php
index f62799f768ba883578b37dc53f6004d9b2243d95,559bad0a3e332208c6795898135007f7674ced82..1b7574d1097c99211be99399b14940dc615f2806
@@@ -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`
                $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
index b90e05174e402a6b1e2ae52a1702d3f8a748333e,40094ee6e3a24047c572d479af1624a97adcd9ac..334dcb055d6c3868c43016e6c864d60ef3ce2222
@@@ -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;
                        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));