Skip to content

Commit

Permalink
rss MDL-25319 replicating my optimization made to forum rss in glossa…
Browse files Browse the repository at this point in the history
…ry rss and database rss
  • Loading branch information
Andrew Davis committed Nov 19, 2010
1 parent e3c21e8 commit c02f338
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions mod/data/rsslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ function data_rss_get_feed($context, $args) {
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)
Expand Down
5 changes: 3 additions & 2 deletions mod/glossary/rsslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ function glossary_rss_get_feed($context, $args) {
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;
}
Expand Down

0 comments on commit c02f338

Please sign in to comment.