From: stronk7 Date: Tue, 31 Jul 2007 17:05:50 +0000 (+0000) Subject: Moving block_rss_timeout to block_rss_client_timeout. Work in progres... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9c6808457e4403bffebd9ccfaad856c894db7bf1;p=moodle.git Moving block_rss_timeout to block_rss_client_timeout. Work in progres... --- diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 6addd6135f..3a24d5b054 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -19,7 +19,8 @@ function init() { $this->title = get_string('feedstitle', 'block_rss_client'); - $this->version = 2006100102; + $this->version = 2007080100; + $this->cron = 1; } function preferred_width() { @@ -44,6 +45,8 @@ function get_content() { global $CFG, $editing, $COURSE, $USER; + $starttime = microtime(); + if (!empty($COURSE)) { $this->courseid = $COURSE->id; } @@ -139,6 +142,7 @@ } $this->content->text = $output; + //echo 'Time: ' . microtime_diff($starttime, microtime()); return $this->content; } @@ -283,6 +287,17 @@ return s($textlib->substr($title,0,$max-3).'...'); } } + + // cron function, used to refresh all the RSS feeds from Moodle cron + function cron() { + $rs = get_recordset('block_rss_client'); + $counter = 0; + while ($rec = rs_fetch_next_record($rs)) { + $counter ++; + } + rs_close($rs); + mtrace($counter . ' feeds refreshed'); + } } ?> diff --git a/blocks/rss_client/config_global.html b/blocks/rss_client/config_global.html index a95cd3a879..d793abc25f 100644 --- a/blocks/rss_client/config_global.html +++ b/blocks/rss_client/config_global.html @@ -19,13 +19,13 @@ - block_rss_timeout: + block_rss_client_timeout: - diff --git a/blocks/rss_client/db/upgrade.php b/blocks/rss_client/db/upgrade.php index c836984eb1..5b4f47e0e4 100644 --- a/blocks/rss_client/db/upgrade.php +++ b/blocks/rss_client/db/upgrade.php @@ -28,9 +28,10 @@ function xmldb_block_rss_client_upgrade($oldversion=0) { /// this comment lines once this file start handling proper /// upgrade code. -/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php -/// $result = result of "/lib/ddllib.php" function calls -/// } + if ($result && $oldversion < 2007080100) { //New version in version.php + /// block_rss_timeout config setting must be block_rss_client_timeout + set_field('config', 'name', 'block_rss_client_timeout', 'name', 'block_rss_timeout'); + } return $result; }