Merge branch 'MDL-69170-adhoc-task-timestamp' of https://github.com/Peterburnett...
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 20 Aug 2020 00:45:27 +0000 (08:45 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 20 Aug 2020 00:45:27 +0000 (08:45 +0800)
1  2 
lib/db/upgrade.php
version.php

@@@ -2542,24 -2539,20 +2542,39 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2020072300.01);
      }
  
 -    if ($oldversion < 2020073000.01) {
 +    if ($oldversion < 2020081400.01) {
 +        // Delete all user evidence files from users that have been deleted.
 +        $sql = "SELECT DISTINCT f.*
 +                  FROM {files} f
 +             LEFT JOIN {context} c ON f.contextid = c.id
 +             LEFT JOIN {user} u ON c.instanceid = u.id
 +                 WHERE f.component = :component
 +                   AND f.filearea = :filearea
 +                   AND u.deleted = 1";
 +        $stalefiles = $DB->get_records_sql($sql, ['component' => 'core_competency', 'filearea' => 'userevidence']);
 +
 +        $fs = get_file_storage();
 +        foreach ($stalefiles as $stalefile) {
 +            $fs->get_file_instance($stalefile)->delete();
 +        }
 +
 +        upgrade_main_savepoint(true, 2020081400.01);
 +    }
 +
++    if ($oldversion < 2021052500.01) {
+         // Define field timecreated to be added to task_adhoc.
+         $table = new xmldb_table('task_adhoc');
+         $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'blocking');
+         // Conditionally launch add field timecreated.
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2020073000.01);
++        upgrade_main_savepoint(true, 2021052500.01);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,9 -29,9 +29,9 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2021052500.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2020073000.01;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2021052500.01;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.
 -$release  = '4.0dev (Build: 20200730)'; // Human-friendly version name
 -$branch   = '40';                       // This version's branch.
 +$release  = '4.0dev (Build: 20200814)'; // Human-friendly version name
 +$branch   = '400';                      // This version's branch.
  $maturity = MATURITY_ALPHA;             // This version's maturity level.