[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

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


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