]> git.mjollnir.org Git - moodle.git/commitdiff
Moving block_rss_timeout to block_rss_client_timeout. Work in progres...
authorstronk7 <stronk7>
Tue, 31 Jul 2007 17:05:50 +0000 (17:05 +0000)
committerstronk7 <stronk7>
Tue, 31 Jul 2007 17:05:50 +0000 (17:05 +0000)
blocks/rss_client/block_rss_client.php
blocks/rss_client/config_global.html
blocks/rss_client/db/upgrade.php

index 6addd6135f2defae9440536b2bebe293c94c983e..3a24d5b054a814f210cdfeab6fbeb98a45f6410b 100644 (file)
@@ -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;
         }
         }
 
         $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');
+     }
 }
 
 ?>
index a95cd3a8790470ef91408807e7fcb0746bb6856f..d793abc25fe8d94ba2896e8c85cf058b20418030 100644 (file)
 </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>
index c836984eb1708a2ff6dc9d5af8dc9d8f81cccef4..5b4f47e0e48eabebd1441b2920a9be10ae02c13a 100644 (file)
@@ -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;
 }