Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   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      // Automatically generated Moodle v3.5.0 release upgrade line.
  28      // Put any upgrade step following this.
  29  
  30      // Automatically generated Moodle v3.6.0 release upgrade line.
  31      // Put any upgrade step following this.
  32  
  33      // Automatically generated Moodle v3.7.0 release upgrade line.
  34      // Put any upgrade step following this.
  35  
  36      if ($oldversion < 2019052001) {
  37  
  38          $columns = $DB->get_columns('data');
  39  
  40          $oldclass = "mod-data-default-template ##approvalstatus##";
  41          $newclass = "mod-data-default-template ##approvalstatusclass##";
  42  
  43          // Update existing classes.
  44          $DB->replace_all_text('data', $columns['singletemplate'], $oldclass, $newclass);
  45          $DB->replace_all_text('data', $columns['listtemplate'], $oldclass, $newclass);
  46          $DB->replace_all_text('data', $columns['addtemplate'], $oldclass, $newclass);
  47          $DB->replace_all_text('data', $columns['rsstemplate'], $oldclass, $newclass);
  48          $DB->replace_all_text('data', $columns['asearchtemplate'], $oldclass, $newclass);
  49  
  50          // Data savepoint reached.
  51          upgrade_mod_savepoint(true, 2019052001, 'data');
  52      }
  53      // Automatically generated Moodle v3.8.0 release upgrade line.
  54      // Put any upgrade step following this.
  55  
  56      // Automatically generated Moodle v3.9.0 release upgrade line.
  57      // Put any upgrade step following this.
  58  
  59      return true;
  60  }