Files
moodle/blocks/rss_client/db/upgrade.php
T
2017-05-19 19:23:55 +02:00

67 lines
2.4 KiB
PHP

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Database upgrades for the RSS block.
*
* @package block_rss_client
* @copyright 2014 Davo Smith
* @author Neill Magill <neill.magill@nottingham.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
*/
defined('MOODLE_INTERNAL') || die();
/**
* Upgrade the block_rss_client database.
*
* @param int $oldversion The version number of the plugin that was installed.
* @return boolean
*/
function xmldb_block_rss_client_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2015071700) {
// Support for skipping RSS feeds for a while when they fail.
$table = new xmldb_table('block_rss_client');
// How many seconds we are currently ignoring this RSS feed for (due to an error).
$field = new xmldb_field('skiptime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'url');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// When to next update this RSS feed.
$field = new xmldb_field('skipuntil', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'skiptime');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_block_savepoint(true, 2015071700, 'rss_client');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}