[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/portfolio/boxnet/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   * Upgrade.
  19   *
  20   * @package    portfolio_boxnet
  21   * @copyright  2013 Frédéric Massart
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  /**
  28   * Upgrade function.
  29   *
  30   * @param int $oldversion the version we are upgrading from.
  31   * @return bool result
  32   */
  33  function xmldb_portfolio_boxnet_upgrade($oldversion) {
  34      global $CFG, $DB;
  35  
  36      $dbman = $DB->get_manager();
  37  
  38      if ($oldversion < 2013110602) {
  39          require_once($CFG->libdir . '/portfoliolib.php');
  40          require_once($CFG->dirroot . '/portfolio/boxnet/db/upgradelib.php');
  41  
  42          $existing = $DB->get_record('portfolio_instance', array('plugin' => 'boxnet'), '*', IGNORE_MULTIPLE);
  43          if ($existing) {
  44  
  45              // Only disable or message the admins when the portfolio hasn't been set for APIv2.
  46              $instance = portfolio_instance($existing->id, $existing);
  47              if ($instance->get_config('clientid') === null && $instance->get_config('clientsecret') === null) {
  48  
  49                  // Disable Box.net.
  50                  $instance->set('visible', 0);
  51                  $instance->save();
  52  
  53                  // Message the admins.
  54                  portfolio_boxnet_admin_upgrade_notification();
  55              }
  56          }
  57  
  58          upgrade_plugin_savepoint(true, 2013110602, 'portfolio', 'boxnet');
  59      }
  60  
  61      // Moodle v2.6.0 release upgrade line.
  62      // Put any upgrade step following this.
  63  
  64      // Moodle v2.7.0 release upgrade line.
  65      // Put any upgrade step following this.
  66  
  67      // Moodle v2.8.0 release upgrade line.
  68      // Put any upgrade step following this.
  69  
  70      return true;
  71  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1