]> git.mxchange.org Git - friendica.git/blobdiff - include/onepoll.php
Merge pull request #2112 from rabuzarus/2811_group_side
[friendica.git] / include / onepoll.php
index e8fc97b21e9676c44cf03a34ac6c0ab130f0010a..6ff7eae422e35063b1746d334cccc836a8fbeb76 100644 (file)
@@ -18,10 +18,10 @@ function onepoll_run(&$argv, &$argc){
        }
 
        if(is_null($db)) {
-           @include(".htconfig.php");
-       require_once("include/dba.php");
-           $db = new dba($db_host, $db_user, $db_pass, $db_data);
-       unset($db_host, $db_user, $db_pass, $db_data);
+               @include(".htconfig.php");
+               require_once("include/dba.php");
+               $db = new dba($db_host, $db_user, $db_pass, $db_data);
+               unset($db_host, $db_user, $db_pass, $db_data);
        };
 
 
@@ -168,8 +168,18 @@ function onepoll_run(&$argv, &$argc){
        );
 
        // Update the contact entry
-       if(($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) || ($contact['network'] === NETWORK_DFRN))
-               update_contact($contact["id"]);
+       if(($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) || ($contact['network'] === NETWORK_DFRN)) {
+               if (!poco_reachable($contact['url'])) {
+                       logger("Skipping probably dead contact ".$contact['url']);
+                       return;
+               }
+
+               if (!update_contact($contact["id"])) {
+                       mark_for_death($contact);
+                       return;
+               } else
+                       unmark_for_death($contact);
+       }
 
        if($contact['network'] === NETWORK_DFRN) {
 
@@ -669,6 +679,6 @@ function onepoll_run(&$argv, &$argc){
 }
 
 if (array_search(__file__,get_included_files())===0){
-  onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
-  killme();
+       onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
+       killme();
 }