]> git.mxchange.org Git - friendica.git/blobdiff - include/onepoll.php
Merge pull request #1703 from rabuzarus/readable_bytes
[friendica.git] / include / onepoll.php
index bb5b8905ab5d93bd58d46c66205ad6f88e806513..7b93a9a2f0d0a63e7ee422f0919b2b08c28597cf 100644 (file)
@@ -176,7 +176,7 @@ function onepoll_run(&$argv, &$argc){
                        return;
                }
 
-               if(! strstr($handshake_xml,'<?xml')) {
+               if(! strstr($handshake_xml,'<')) {
                        logger('poller: response from ' . $url . ' did not contain XML.');
 
                        mark_for_death($contact);
@@ -284,13 +284,13 @@ function onepoll_run(&$argv, &$argc){
        }
        elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {
 
-               logger("onepoll: mail: Fetching", LOGGER_DEBUG);
+               logger("Mail: Fetching", LOGGER_DEBUG);
 
                $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
                if($mail_disabled)
                        return;
 
-               logger("onepoll: Mail: Enabled", LOGGER_DEBUG);
+               logger("Mail: Enabled", LOGGER_DEBUG);
 
                $mbox = null;
                $x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1",
@@ -312,7 +312,9 @@ function onepoll_run(&$argv, &$argc){
                                        intval($mailconf[0]['id']),
                                        intval($importer_uid)
                                );
-                       }
+                               logger("Mail: Connected to " . $mailconf[0]['user']);
+                       } else
+                               logger("Mail: Connection error ".$mailconf[0]['user']." ".print_r(imap_errors()));
                }
                if($mbox) {
 
@@ -523,7 +525,10 @@ function onepoll_run(&$argv, &$argc){
                                                }
                                        }
                                }
-                       }
+                       } else
+                               logger("Mail: no mails for ".$mailconf[0]['user']);
+
+                       logger("Mail: closing connection for ".$mailconf[0]['user']);
                        imap_close($mbox);
                }
        }
@@ -537,7 +542,7 @@ function onepoll_run(&$argv, &$argc){
 
        if($xml) {
                logger('poller: received xml : ' . $xml, LOGGER_DATA);
-               if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
+               if(! strstr($xml,'<')) {
                        logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
                        $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
                                dbesc(datetime_convert()),
@@ -586,8 +591,8 @@ function onepoll_run(&$argv, &$argc){
 
        // load current friends if possible.
 
-       if($contact['poco']) {  
-               $r = q("SELECT count(*) as total from glink 
+       if($contact['poco']) {
+               $r = q("SELECT count(*) as total from glink
                        where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
                        intval($contact['id'])
                );
@@ -602,6 +607,6 @@ function onepoll_run(&$argv, &$argc){
 }
 
 if (array_search(__file__,get_included_files())===0){
-  onepoll_run($argv,$argc);
+  onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
   killme();
 }