function init() {
$this->title = get_string('feedstitle', 'block_rss_client');
- $this->version = 2006100102;
+ $this->version = 2007080100;
+ $this->cron = 1;
}
function preferred_width() {
function get_content() {
global $CFG, $editing, $COURSE, $USER;
+ $starttime = microtime();
+
if (!empty($COURSE)) {
$this->courseid = $COURSE->id;
}
}
$this->content->text = $output;
+ //echo 'Time: ' . microtime_diff($starttime, microtime());
return $this->content;
}
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');
+ }
}
?>
</tr>
<tr valign="top">
- <td align="right">block_rss_timeout:</td>
+ <td align="right">block_rss_client_timeout:</td>
<td>
- <input name="block_rss_timeout" type="text" size="5" value="<?php
- if(isset($CFG->block_rss_timeout)) {
- p($CFG->block_rss_timeout);
+ <input name="block_rss_client_timeout" type="text" size="5" value="<?php
+ if(isset($CFG->block_rss_client_timeout)) {
+ p($CFG->block_rss_client_timeout);
} else {
- p(10);
+ p(30);
} ?>" />
</td>
<td>
/// 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;
}