readd debug-msgs to logger
This commit is contained in:
parent
86cbd17b42
commit
3600354ab7
@ -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, '<a target="_blank" href="' . $url . '">' . basename($url) . '</a>'));
|
||||
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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user