]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Linkback Plugin: check result properly so failures are not reported as a success...
authorCiaranG <ciaran@ciarang.com>
Tue, 8 Sep 2009 12:25:59 +0000 (13:25 +0100)
committerCiaranG <ciaran@ciarang.com>
Tue, 8 Sep 2009 12:25:59 +0000 (13:25 +0100)
plugins/LinkbackPlugin.php

index c49f70de0d54d0598e71d735233bfc51c86cfe59..60f7a60c797f60e80b9914f20a1403eefdeb4aaa 100644 (file)
@@ -75,6 +75,8 @@ class LinkbackPlugin extends Plugin
 
     function linkbackUrl($url)
     {
+        common_log(LOG_DEBUG,"Attempting linkback for " . $url);
+
         $orig = $url;
         $url = htmlspecialchars_decode($orig);
         $scheme = parse_url($url, PHP_URL_SCHEME);
@@ -134,15 +136,20 @@ class LinkbackPlugin extends Plugin
                                                                "User-Agent: " . $this->userAgent(),
                                                                'content' => $request)));
         $file = file_get_contents($endpoint, false, $context);
-        $response = xmlrpc_decode($file);
-        if (xmlrpc_is_fault($response)) {
+        if (!$file) {
             common_log(LOG_WARNING,
+                      "Pingback request failed for '$url' ($endpoint)");
+        } else {
+            $response = xmlrpc_decode($file);
+            if (xmlrpc_is_fault($response)) {
+                common_log(LOG_WARNING,
                        "Pingback error for '$url' ($endpoint): ".
                        "$response[faultString] ($response[faultCode])");
-        } else {
-            common_log(LOG_INFO,
+            } else {
+                common_log(LOG_INFO,
                        "Pingback success for '$url' ($endpoint): ".
                        "'$response'");
+            }
         }
     }