From 99c8d7f21203dc68bb191d77e01c2f8a6f0cf5a0 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 18 Jan 2009 16:43:45 +0100 Subject: Media changelog added There is a new media changelog now, with the flag RECENTS_MEDIA_CHANGES media changes can be requested from the getRecents()-function or the new getRecentsSince()-function, that returns all changes since a given timestamp and optionally before a given timestamp. The media upload and the XML-RPC-server have been changed to use these functions. Additionally, the event MEDIA_UPLOAD_FINISH has been extended, it has a new $data-attribute (the 5th), that contains a boolean if the file does already exist and will be overwritten. darcs-hash:20090118154345-074e0-5d9a90d269e86d8c6a156ecce5cf63115c827433.gz --- lib/exe/indexer.php | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'lib/exe/indexer.php') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 908bbe86a..6380f8f9d 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -40,6 +40,7 @@ if ($evt->advise_before()) { metaUpdate() or runSitemapper() or runTrimRecentChanges() or + runTrimRecentChanges(true) or $evt->advise_after(); } if($defer) sendGIF(); @@ -52,15 +53,18 @@ exit; /** * Trims the recent changes cache (or imports the old changelog) as needed. * + * @param media_changes If the media changelog shall be trimmed instead of + * the page changelog + * * @author Ben Coburn */ -function runTrimRecentChanges() { +function runTrimRecentChanges($media_changes = false) { global $conf; // Import old changelog (if needed) // Uses the imporoldchangelog plugin to upgrade the changelog automaticaly. // FIXME: Remove this from runTrimRecentChanges when it is no longer needed. - if (isset($conf['changelog_old']) && + if (!$media_changes && isset($conf['changelog_old']) && @file_exists($conf['changelog_old']) && !@file_exists($conf['changelog']) && !@file_exists($conf['changelog'].'_importing') && !@file_exists($conf['changelog'].'_tmp')) { $tmp = array(); // no event data @@ -68,22 +72,24 @@ function runTrimRecentChanges() { return true; } + $fn = ($media_changes ? $conf['media_changelog'] : $conf['changelog']); + // Trim the Recent Changes // Trims the recent changes cache to the last $conf['changes_days'] recent // changes or $conf['recent'] items, which ever is larger. // The trimming is only done once a day. - if (@file_exists($conf['changelog']) && - (filectime($conf['changelog'])+86400)