From 76b042ddee262aa487839b1d47109a72444cfab2 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 14:42:55 +0100 Subject: [PATCH 1/4] More logging in case of errors + logged network type + added TODO (for ugly E_NOTICE). Signed-off-by: Roland Haeder --- mod/dfrn_request.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 2741ad59b..82886a6ef 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -42,8 +42,10 @@ function dfrn_request_init(&$a) { if(! function_exists('dfrn_request_post')) { function dfrn_request_post(&$a) { - if(($a->argc != 2) || (! count($a->profile))) + if(($a->argc != 2) || (! count($a->profile))) { + logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile)); return; + } if(x($_POST, 'cancel')) { @@ -461,7 +463,7 @@ function dfrn_request_post(&$a) { $network = NETWORK_DFRN; } - logger('dfrn_request: url: ' . $url); + logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG); if($network === NETWORK_DFRN) { $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", @@ -825,6 +827,7 @@ function dfrn_request_content(&$a) { else $tpl = get_markup_template('auto_request.tpl'); + // TODO This .= triggers an E_NOTICE, really needed? $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:"); // see if we are allowed to have NETWORK_MAIL2 contacts @@ -850,6 +853,7 @@ function dfrn_request_content(&$a) { get_server() ); + // TODO This .= triggers an E_NOTICE, really needed? $o .= replace_macros($tpl,array( '$header' => t('Friend/Connection Request'), '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'), From 7d5166c9fefd03ec63807813e831017e6ad25382 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 1 Mar 2016 18:28:06 +0100 Subject: [PATCH 2/4] Closed TODO: no .= needed here. #2392 Signed-off-by: Roland Haeder --- mod/dfrn_request.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 82886a6ef..545599606 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -827,8 +827,7 @@ function dfrn_request_content(&$a) { else $tpl = get_markup_template('auto_request.tpl'); - // TODO This .= triggers an E_NOTICE, really needed? - $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:"); + $page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:"); // see if we are allowed to have NETWORK_MAIL2 contacts @@ -853,8 +852,7 @@ function dfrn_request_content(&$a) { get_server() ); - // TODO This .= triggers an E_NOTICE, really needed? - $o .= replace_macros($tpl,array( + $o = replace_macros($tpl,array( '$header' => t('Friend/Connection Request'), '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'), '$pls_answer' => t('Please answer the following:'), From ce5f6fae51ac6c246bb0371798994bef7e589d42 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 1 Mar 2016 19:14:45 +0100 Subject: [PATCH 3/4] Small bugfix: Fixes problen when version number contains linebreaks --- mod/admin.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 7a16820c4..a98f464f8 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -283,14 +283,14 @@ function admin_page_federation(&$a) { // get a total count for the platform, the name and version of the // highest version and the protocol tpe $c = q('SELECT count(*) AS total, platform, network, version FROM gserver - WHERE platform LIKE "%s" AND last_contact > last_failure + WHERE platform LIKE "%s" AND last_contact > last_failure AND `version` != "" ORDER BY version ASC;', $p); $total = $total + $c[0]['total']; // what versions for that platform do we know at all? // again only the active nodes $v = q('SELECT count(*) AS total, version FROM gserver - WHERE last_contact > last_failure AND platform LIKE "%s" + WHERE last_contact > last_failure AND platform LIKE "%s" AND `version` != "" GROUP BY version ORDER BY version;', $p); @@ -344,6 +344,9 @@ function admin_page_federation(&$a) { $v = $newVv; } + foreach ($v as $key => $vv) + $v[$key]["version"] = trim(strip_tags($vv["version"])); + // the 3rd array item is needed for the JavaScript graphs as JS does // not like some characters in the names of variables... $counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]); From 411566f48b58135e6820b6557794806b077e5444 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 1 Mar 2016 19:17:01 +0100 Subject: [PATCH 4/4] API: Some small speed improvement when calling the home timeline. --- include/api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/api.php b/include/api.php index 55e39e358..699b066d2 100644 --- a/include/api.php +++ b/include/api.php @@ -1691,13 +1691,13 @@ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` - FROM `item`, `contact` + FROM `item` FORCE INDEX (`uid_id`), `contact` WHERE `item`.`uid` = %d AND `verb` = '%s' AND NOT (`item`.`author-link` IN ('https://%s', 'http://%s')) - AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 + AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` AND `contact`.`id` = `item`.`contact-id` - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN (SELECT `iid` from thread where uid = %d AND `mention` AND !`ignored`) + AND NOT `contact`.`blocked` AND NOT `contact`.`pending` + AND `item`.`parent` IN (SELECT `iid` FROM `thread` WHERE `uid` = %d AND `mention` AND !`ignored`) $sql_extra AND `item`.`id`>%d ORDER BY `item`.`id` DESC LIMIT %d ,%d ",