MDL-60105 mod_folder: Set timemodified on change
authorMatt Clarkson <mattc@catalyst.net.nz>
Wed, 13 Sep 2017 00:40:53 +0000 (12:40 +1200)
committerDavid Monllao <davidm@moodle.com>
Wed, 13 Sep 2017 11:51:49 +0000 (13:51 +0200)
Changes to the folder contents were not resulting in the
timemodied of the folder activity being set. This prevented
global search from picking up the changes.

mod/folder/edit.php

index 1d40e4b..e4bb89b 100644 (file)
@@ -61,11 +61,11 @@ if ($mform->is_cancelled()) {
 
 } else if ($formdata = $mform->get_data()) {
     $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
-    $DB->set_field('folder', 'revision', $folder->revision+1, array('id'=>$folder->id));
-
-    // Update the variable of the folder revision so we can pass it as an accurate snapshot later.
+    $folder->timemodified = time();
     $folder->revision = $folder->revision + 1;
 
+    $DB->update_record('folder', $folder);
+
     $params = array(
         'context' => $context,
         'objectid' => $folder->id