From 0c8fe7832b9da9de159f475802ba01c1c6b7681d Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 27 May 2005 09:18:20 +0000 Subject: [PATCH] Increase spartacus output --- docs/NEWS | 3 +++ .../serendipity_event_spartacus.php | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 59ca5d4..09b9f17 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 0.9 () ------------------------------------------------------------------------ + * Increased level of output message from the Spartacus plugin + (garvinhicking) + * Patched XML-RPC functions, thanks to Tim Putnam. This should enable XML-RPC services to properly fetch existing articles and edit them. diff --git a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php index 9b2597a..ca58fef 100644 --- a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php +++ b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php @@ -21,7 +21,11 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPARTACUS_FETCH', 'Hier klicken um ein neues %s aus dem Netz zu installieren.'); @define('PLUGIN_EVENT_SPARTACUS_FETCHERROR', 'Die URL %s konnte nicht geöffnet werden. Möglicherweise existieren Server- oder Netzwerkprobleme.'); @define('PLUGIN_EVENT_SPARTACUS_FETCHING', 'Versuche URL %s zu öffnen...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_URL', '%s bytes von obiger URL geladen. Speichere Inhalt als %s...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE', '%s bytes von bereits bestehender Datei geladen. Speichere Inhalt als %s...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_DONE', 'Data successfully fetched.'); break; + case 'en': default: @define('PLUGIN_EVENT_SPARTACUS_NAME', 'Spartacus'); @@ -29,6 +33,9 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPARTACUS_FETCH', 'Click here to fetch a new %s from the Serendipity Online Repository'); @define('PLUGIN_EVENT_SPARTACUS_FETCHERROR', 'The URL %s could not be opened. Maybe the Serendipity or SourceForge.net Server is down - we are sorry, you need to try again later.'); @define('PLUGIN_EVENT_SPARTACUS_FETCHING', 'Trying to open URL %s...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_URL', 'Fetched %s bytes from the URL above. Saving file as %s...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE', 'Fetched %s bytes from already existing file on your server. Saving file as %s...'); + @define('PLUGIN_EVENT_SPARTACUS_FETCHED_DONE', 'Data successfully fetched.'); break; } @@ -44,7 +51,7 @@ class serendipity_event_spartacus extends serendipity_event $propbag->add('description', PLUGIN_EVENT_SPARTACUS_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '1.01'); + $propbag->add('version', '1.1'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -120,23 +127,30 @@ class serendipity_event_spartacus extends serendipity_event } function &fetchfile($url, $target, $cacheTimeout = 0) { - printf(PLUGIN_EVENT_SPARTACUS_FETCHING, '' . serendipity_truncateString($url, 68) . ''); + printf(PLUGIN_EVENT_SPARTACUS_FETCHING, '' . basename($url) . ''); echo '
'; if (file_exists($target) && filesize($target) > 0 && filemtime($target) >= (time()-$cacheTimeout)) { $data = file_get_contents($target); + printf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE, strlen($data), $target); + echo '
'; } else { require_once S9Y_INCLUDE_PATH . 'bundled-libs/HTTP/Request.php'; $req = &new HTTP_Request($url); if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { printf(PLUGIN_EVENT_SPARTACUS_FETCHERROR, $url); + echo '
'; if (file_exists($target) && filesize($target) > 0) { $data = file_get_contents($target); + printf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE, strlen($data), $target); + echo '
'; } } else { // Fetch file $data = $req->getResponseBody(); + printf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_URL, strlen($data), $target); + echo '
'; $tdir = dirname($target); if (!is_dir($tdir) && !$this->rmkdir($tdir)) { printf(FILE_WRITE_ERROR, $tdir); @@ -148,11 +162,14 @@ class serendipity_event_spartacus extends serendipity_event if (!$fp) { printf(FILE_WRITE_ERROR, $target); + echo '
'; return false; } fwrite($fp, $data); fclose($fp); + echo PLUGIN_EVENT_SPARTACUS_FETCHED_DONE; + echo '
'; } } @@ -277,6 +294,7 @@ class serendipity_event_spartacus extends serendipity_event $pdir = $serendipity['serendipityPath'] . '/plugins/'; if (!is_writable($pdir)) { printf(DIRECTORY_WRITE_ERROR, $pdir); + echo '
'; return false; } -- 2.39.5