diff options
author | CiaranG <ciaran@ciarang.com> | 2009-09-08 13:25:59 +0100 |
---|---|---|
committer | CiaranG <ciaran@ciarang.com> | 2009-09-08 13:25:59 +0100 |
commit | 52a197b235c4347e0fe6b14609098c0a0e444319 (patch) | |
tree | 741f3730ad3c3e7770ca68c5a698f5920b3ab01d | |
parent | afe1b8ec3df8d231ae9c6699da3a3947da285c00 (diff) |
Linkback Plugin: check result properly so failures are not reported as a success in the log. Also logs (debug only) when an attempt is being made
-rw-r--r-- | plugins/LinkbackPlugin.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/LinkbackPlugin.php b/plugins/LinkbackPlugin.php index c49f70de0..60f7a60c7 100644 --- a/plugins/LinkbackPlugin.php +++ b/plugins/LinkbackPlugin.php @@ -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'"); + } } } |