From 3600354ab76a62dda807f36859b28e5fa0875cdf Mon Sep 17 00:00:00 2001 From: onli Date: Thu, 14 Aug 2014 11:31:21 +0200 Subject: [PATCH] readd debug-msgs to logger --- .../serendipity_event_spartacus.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php index b387b636..a5432132 100644 --- a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php +++ b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php @@ -372,6 +372,7 @@ class serendipity_event_spartacus extends serendipity_event } function &fetchfile($url, $target, $cacheTimeout = 0, $decode_utf8 = false, $sub = 'plugins') { + global $serendipity; static $error = false; // Fix double URL strings. @@ -384,8 +385,10 @@ class serendipity_event_spartacus extends serendipity_event $url_hostname = $url_parts['host']; } $url_ip = gethostbyname($url_hostname); + if (is_object($serendipity['logger'])) $serendipity['logger']->debug(sprintf(PLUGIN_EVENT_SPARTACUS_FETCHING, '' . basename($url) . '')); if (file_exists($target) && filesize($target) > 0 && filemtime($target) >= (time()-$cacheTimeout)) { $data = file_get_contents($target); + if (is_object($serendipity['logger'])) $serendipity['logger']->debug(sprintf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE, strlen($data), $target)); } else { require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; $options = array('allowRedirects' => true, 'maxRedirects' => 5); @@ -464,7 +467,7 @@ class serendipity_event_spartacus extends serendipity_event if (!$data) { $data = $req->getResponseBody(); } - + if (is_object($serendipity['logger'])) $serendipity['logger']->debug(sprintf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_URL, strlen($data), $target)); $tdir = dirname($target); if (!is_dir($tdir) && !$this->rmkdir($tdir, $sub)) { $this->outputMSG('error', sprintf(FILE_WRITE_ERROR, $tdir));