]> git.mxchange.org Git - friendica.git/commitdiff
Onepoll hadn't polled anymore / small relocation in zrlinit for better logging
authorMichael <heluecht@pirati.ca>
Tue, 16 Oct 2018 13:17:01 +0000 (13:17 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 16 Oct 2018 13:17:01 +0000 (13:17 +0000)
src/Model/Profile.php
src/Worker/OnePoll.php

index e44ac29519101cc29f13aa91a1979bbcfda68010..1f0773cd18c5998d6aac26b945a98071d6826967 100644 (file)
@@ -1014,15 +1014,6 @@ class Profile
                        return;
                }
 
-               // Avoid endless loops
-               $cachekey = 'zrlInit:' . $my_url;
-               if (Cache::get($cachekey)) {
-                       logger('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG);
-                       return;
-               } else {
-                       Cache::set($cachekey, true, CACHE_MINUTE);
-               }
-
                $arr = ['zrl' => $my_url, 'url' => $a->cmd];
                Addon::callHooks('zrl_init', $arr);
 
@@ -1033,8 +1024,6 @@ class Profile
                        return;
                }
 
-               Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
-
                $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
 
                if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
@@ -1042,8 +1031,19 @@ class Profile
                        return;
                }
 
+               // Avoid endless loops
+               $cachekey = 'zrlInit:' . $my_url;
+               if (Cache::get($cachekey)) {
+                       logger('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG);
+                       return;
+               } else {
+                       Cache::set($cachekey, true, CACHE_MINUTE);
+               }
+
                logger('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG);
 
+               Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
+
                // Try to avoid recursion - but send them home to do a proper magic auth.
                $query = str_replace(array('?zrl=', '&zid='), array('?rzrl=', '&rzrl='), $a->query_string);
                // The other instance needs to know where to redirect.
index 3c16af75f86334ddec6cd0777e75b4f0c5e96bde..0066a04aedd06c7136576506d1e6695c3cd445f1 100644 (file)
@@ -333,7 +333,7 @@ class OnePoll
                        $curlResult = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
                        unlink($cookiejar);
 
-                       if (!$curlResult->isTimeout()) {
+                       if ($curlResult->isTimeout()) {
                                // set the last-update so we don't keep polling
                                DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
                                Contact::markForArchival($contact);