[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

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

   1  <?php
   2  
   3  // This file keeps track of upgrades to
   4  // the choice module
   5  //
   6  // Sometimes, changes between versions involve
   7  // alterations to database structures and other
   8  // major things that may break installations.
   9  //
  10  // The upgrade function in this file will attempt
  11  // to perform all the necessary actions to upgrade
  12  // your older installation to the current version.
  13  //
  14  // If there's something it cannot do itself, it
  15  // will tell you what you need to do.
  16  //
  17  // The commands in here will all be database-neutral,
  18  // using the methods of database_manager class
  19  //
  20  // Please do not forget to use upgrade_set_timeout()
  21  // before any action that may take longer time to finish.
  22  
  23  function xmldb_choice_upgrade($oldversion) {
  24      global $CFG, $DB;
  25  
  26      $dbman = $DB->get_manager();
  27  
  28  
  29      // Moodle v2.2.0 release upgrade line
  30      // Put any upgrade step following this
  31  
  32      // Moodle v2.3.0 release upgrade line
  33      // Put any upgrade step following this
  34  
  35  
  36      // Moodle v2.4.0 release upgrade line
  37      // Put any upgrade step following this
  38  
  39  
  40      // Moodle v2.5.0 release upgrade line.
  41      // Put any upgrade step following this.
  42  
  43  
  44      // Moodle v2.6.0 release upgrade line.
  45      // Put any upgrade step following this.
  46  
  47      // Moodle v2.7.0 release upgrade line.
  48      // Put any upgrade step following this.
  49  
  50      if ($oldversion < 2014051201) {
  51  
  52          // Define field allowmultiple to be added to choice.
  53          $table = new xmldb_table('choice');
  54          $field = new xmldb_field('allowmultiple', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'allowupdate');
  55  
  56          // Conditionally launch add field allowmultiple.
  57          if (!$dbman->field_exists($table, $field)) {
  58              $dbman->add_field($table, $field);
  59          }
  60  
  61          // Choice savepoint reached.
  62          upgrade_mod_savepoint(true, 2014051201, 'choice');
  63      }
  64  
  65      // Moodle v2.8.0 release upgrade line.
  66      // Put any upgrade step following this.
  67  
  68      return true;
  69  }
  70  
  71  


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