From c02f338e5ebf5ab026cc034445b97a1b7cdff96e Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Fri, 19 Nov 2010 06:56:23 +0000 Subject: [PATCH] rss MDL-25319 replicating my optimization made to forum rss in glossary rss and database rss --- mod/data/rsslib.php | 5 +++-- mod/glossary/rsslib.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/data/rsslib.php b/mod/data/rsslib.php index e03f30f6035..7020d382b2f 100644 --- a/mod/data/rsslib.php +++ b/mod/data/rsslib.php @@ -34,8 +34,9 @@ if (file_exists($cachedfilepath)) { $cachedfilelastmodified = filemtime($cachedfilepath); } - - if (data_rss_newstuff($data, $cachedfilelastmodified)) { + //if the cache is more than 60 seconds old and there's new stuff + $dontrecheckcutoff = time()-60; + if ( $dontrecheckcutoff > $cachedfilelastmodified && data_rss_newstuff($data, $cachedfilelastmodified)) { require_once($CFG->dirroot . '/mod/data/lib.php'); // Get the first field in the list (a hack for now until we have a selector) diff --git a/mod/glossary/rsslib.php b/mod/glossary/rsslib.php index 4ebd37699ed..b9b51ddb00b 100644 --- a/mod/glossary/rsslib.php +++ b/mod/glossary/rsslib.php @@ -37,8 +37,9 @@ if (file_exists($cachedfilepath)) { $cachedfilelastmodified = filemtime($cachedfilepath); } - - if (glossary_rss_newstuff($glossary, $cachedfilelastmodified)) { + //if the cache is more than 60 seconds old and there's new stuff + $dontrecheckcutoff = time()-60; + if ( $dontrecheckcutoff > $cachedfilelastmodified && glossary_rss_newstuff($glossary, $cachedfilelastmodified)) { if (!$recs = $DB->get_records_sql($sql, array(), 0, $glossary->rssarticles)) { return null; }