]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1702-no-old_pager
authorMichael <heluecht@pirati.ca>
Sun, 12 Mar 2017 20:52:14 +0000 (20:52 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 12 Mar 2017 20:52:14 +0000 (20:52 +0000)
Conflicts:
mod/profile.php

1  2 
include/Contact.php
mod/profile.php

Simple merge
diff --cc mod/profile.php
index ab7b7cff76f33f65e5b250afd7fc0b21fedb66fb,d2864d838a3ea7eafe7a04a858e7a51411931e2c..93f2602e23f6b8b4ef1c40be6818f246bedf3c5c
@@@ -240,6 -240,34 +240,17 @@@ function profile_content(App $a, $updat
                        $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
                }
  
 -              if(get_config('system', 'old_pager')) {
 -                  $r = q("SELECT COUNT(*) AS `total`
 -                          FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
 -                          $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
 -                          AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
 -                          WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
 -                          and `thread`.`moderated` = 0
 -                          AND `thread`.`wall` = 1
 -                          $sql_extra3 $sql_extra $sql_extra2 ",
 -                          intval($a->profile['profile_uid'])
 -                      );
 -
 -                      if (dbm::is_result($r)) {
 -                              $a->set_pager_total($r[0]['total']);
 -                      }
 -              }
 -
+               // Belongs the profile page to a forum?
+               // If not then we can improve the performance with an additional condition
+               $r = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `page-flags` IN (%d, %d)",
+                       intval($a->profile['profile_uid']),
+                       intval(PAGE_COMMUNITY),
+                       intval(PAGE_PRVGROUP));
+               if (!dbm::is_result($r)) {
+                       $sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
+               }
                //  check if we serve a mobile device and get the user settings
                //  accordingly
                if ($a->is_mobile) {