[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/blocks/rss_client/db/ -> upgrade.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Database upgrades for the RSS block.
  19   *
  20   * @package   block_rss_client
  21   * @copyright 2014 Davo Smith
  22   * @author    Neill Magill <neill.magill@nottingham.ac.uk>
  23   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL
  24   */
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  /**
  28   * Upgrade the block_rss_client database.
  29   *
  30   * @param int $oldversion The version number of the plugin that was installed.
  31   * @return boolean
  32   */
  33  function xmldb_block_rss_client_upgrade($oldversion) {
  34      global $DB;
  35      $dbman = $DB->get_manager();
  36  
  37      if ($oldversion < 2015071700) {
  38          // Support for skipping RSS feeds for a while when they fail.
  39          $table = new xmldb_table('block_rss_client');
  40          // How many seconds we are currently ignoring this RSS feed for (due to an error).
  41          $field = new xmldb_field('skiptime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'url');
  42          if (!$dbman->field_exists($table, $field)) {
  43              $dbman->add_field($table, $field);
  44          }
  45          // When to next update this RSS feed.
  46          $field = new xmldb_field('skipuntil', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'skiptime');
  47          if (!$dbman->field_exists($table, $field)) {
  48              $dbman->add_field($table, $field);
  49          }
  50          upgrade_block_savepoint(true, 2015071700, 'rss_client');
  51      }
  52  
  53      // Moodle v3.0.0 release upgrade line.
  54      // Put any upgrade step following this.
  55  
  56      // Moodle v3.1.0 release upgrade line.
  57      // Put any upgrade step following this.
  58  
  59      return true;
  60  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1