[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/label/db/ -> upgrade.php (source)

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * Label module upgrade
  20   *
  21   * @package mod_label
  22   * @copyright  2006 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  // This file keeps track of upgrades to
  27  // the label module
  28  //
  29  // Sometimes, changes between versions involve
  30  // alterations to database structures and other
  31  // major things that may break installations.
  32  //
  33  // The upgrade function in this file will attempt
  34  // to perform all the necessary actions to upgrade
  35  // your older installation to the current version.
  36  //
  37  // If there's something it cannot do itself, it
  38  // will tell you what you need to do.
  39  //
  40  // The commands in here will all be database-neutral,
  41  // using the methods of database_manager class
  42  //
  43  // Please do not forget to use upgrade_set_timeout()
  44  // before any action that may take longer time to finish.
  45  
  46  defined('MOODLE_INTERNAL') || die;
  47  
  48  function xmldb_label_upgrade($oldversion) {
  49      global $CFG, $DB;
  50  
  51      $dbman = $DB->get_manager();
  52  
  53  
  54      // Moodle v2.2.0 release upgrade line
  55      // Put any upgrade step following this
  56  
  57      // Moodle v2.3.0 release upgrade line
  58      // Put any upgrade step following this
  59  
  60  
  61      // Moodle v2.4.0 release upgrade line
  62      // Put any upgrade step following this
  63  
  64      if ($oldversion < 2013021400) {
  65          // find all courses that contain labels and reset their cache
  66          $modid = $DB->get_field_sql("SELECT id FROM {modules} WHERE name=?",
  67                  array('label'));
  68          if ($modid) {
  69              $courses = $DB->get_fieldset_sql('SELECT DISTINCT course '.
  70                  'FROM {course_modules} WHERE module=?', array($modid));
  71              foreach ($courses as $courseid) {
  72                  rebuild_course_cache($courseid, true);
  73              }
  74          }
  75  
  76          // label savepoint reached
  77          upgrade_mod_savepoint(true, 2013021400, 'label');
  78      }
  79  
  80      // Moodle v2.5.0 release upgrade line.
  81      // Put any upgrade step following this.
  82  
  83  
  84      // Moodle v2.6.0 release upgrade line.
  85      // Put any upgrade step following this.
  86  
  87      // Moodle v2.7.0 release upgrade line.
  88      // Put any upgrade step following this.
  89  
  90      // Moodle v2.8.0 release upgrade line.
  91      // Put any upgrade step following this.
  92  
  93      return true;
  94  }
  95  
  96  


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