aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-01-02 18:40:38 -0800
committerfriendica <info@friendica.com>2012-01-02 18:40:38 -0800
commitf4b1d335a571365748ee348ed2b8ac6e1c6670db (patch)
tree42d90925ca58c1cf21212ecd40f4c89591b9c44f
parent4c35a6b0d7e2f2431571d63888816ecff446d258 (diff)
downloadvolse-hubzilla-f4b1d335a571365748ee348ed2b8ac6e1c6670db.tar.gz
volse-hubzilla-f4b1d335a571365748ee348ed2b8ac6e1c6670db.tar.bz2
volse-hubzilla-f4b1d335a571365748ee348ed2b8ac6e1c6670db.zip
sql optimisation cont.
-rw-r--r--include/bbcode.php2
-rw-r--r--mod/network.php9
2 files changed, 5 insertions, 6 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 5218a06e8..6b733c8f4 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -27,7 +27,7 @@ function tryoembed($match){
// BBcode 2 HTML was written by WAY2WEB.net
- // extended to work with Mistpark/Friendika - Mike Macgirvin
+ // extended to work with Mistpark/Friendica - Mike Macgirvin
function bbcode($Text,$preserve_nl = false) {
diff --git a/mod/network.php b/mod/network.php
index b493c419b..6f53a24f8 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -263,7 +263,7 @@ function network_content(&$a, $update = 0) {
$sql_options = (($star) ? " and starred = 1 " : '');
$sql_options .= (($bmark) ? " and bookmark = 1 " : '');
- $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) ";
+ $sql_extra = $sql_options;
if($group) {
$r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -287,7 +287,7 @@ function network_content(&$a, $update = 0) {
info( t('Group is empty'));
}
- $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' )) ";
+ $sql_extra = " AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' ) $sql_options ";
$o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o;
}
elseif($cid) {
@@ -297,7 +297,7 @@ function network_content(&$a, $update = 0) {
intval($cid)
);
if(count($r)) {
- $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " ) ";
+ $sql_extra = " AND `contact-id` = " . intval($cid) . " $sql_options ";
$o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
@@ -350,14 +350,13 @@ function network_content(&$a, $update = 0) {
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
- $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ",
+ $sql_extra .= sprintf(" AND ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' ) ",
dbesc($myurl . '$'),
dbesc($myurl . '\\]'),
dbesc($diasp_url . '\\]')
);
}
-
if($update) {
// only setup pagination on initial page view