Merge branch 'master-MDL-67211_v6' of https://github.com/golenkovm/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 26 Aug 2020 01:37:16 +0000 (09:37 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 26 Aug 2020 01:37:16 +0000 (09:37 +0800)
1  2 
lib/db/install.xml
lib/db/upgrade.php
version.php

Simple merge
@@@ -2576,45 -2576,50 +2576,90 @@@ function xmldb_main_upgrade($oldversion
      }
  
      if ($oldversion < 2021052500.04) {
 +        // Define field metadatasettings to be added to h5p_libraries.
 +        $table = new xmldb_table('h5p_libraries');
 +        $field = new xmldb_field('metadatasettings', XMLDB_TYPE_TEXT, null, null, null, null, null, 'coreminor');
 +
 +        // Conditionally launch add field metadatasettings.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Get installed library files that have no metadata settings value.
 +        $params = [
 +            'component' => 'core_h5p',
 +            'filearea' => 'libraries',
 +            'filename' => 'library.json',
 +        ];
 +        $sql = "SELECT l.id, f.id as fileid
 +                  FROM {files} f
 +             LEFT JOIN {h5p_libraries} l ON f.itemid = l.id
 +                 WHERE f.component = :component
 +                       AND f.filearea = :filearea
 +                       AND f.filename = :filename";
 +        $libraries = $DB->get_records_sql($sql, $params);
 +
 +        // Update metadatasettings field when the attribute is present in the library.json file.
 +        $fs = get_file_storage();
 +        foreach ($libraries as $library) {
 +            $jsonfile = $fs->get_file_by_id($library->fileid);
 +            $jsoncontent = json_decode($jsonfile->get_content());
 +            if (isset($jsoncontent->metadataSettings)) {
 +                unset($library->fileid);
 +                $library->metadatasettings = json_encode($jsoncontent->metadataSettings);
 +                $DB->update_record('h5p_libraries', $library);
 +            }
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2021052500.04);
 +    }
 +
++    if ($oldversion < 2021052500.05) {
+         // Define fields to be added to task_scheduled.
+         $table = new xmldb_table('task_scheduled');
+         $field = new xmldb_field('timestarted', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'disabled');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $field = new xmldb_field('hostname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'timestarted');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $field = new xmldb_field('pid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'hostname');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Define fields to be added to task_adhoc.
+         $table = new xmldb_table('task_adhoc');
+         $field = new xmldb_field('timestarted', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'blocking');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $field = new xmldb_field('hostname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'timestarted');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $field = new xmldb_field('pid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'hostname');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Define fields to be added to task_log.
+         $table = new xmldb_table('task_log');
+         $field = new xmldb_field('hostname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'output');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         $field = new xmldb_field('pid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'hostname');
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2021052500.04);
++        upgrade_main_savepoint(true, 2021052500.05);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
--$version  = 2021052500.04;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2021052500.05;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.
  $release  = '4.0dev (Build: 20200822)'; // Human-friendly version name