MDL-37539 Assignment upgrade: Disable submission comments if allow notes was not...
authorDamyon Wiese <damyon@moodle.com>
Thu, 17 Jan 2013 04:09:36 +0000 (12:09 +0800)
committerDamyon Wiese <damyon@moodle.com>
Thu, 17 Jan 2013 04:15:00 +0000 (12:15 +0800)
For advanced upload of files only - this setting was stored in var2.

mod/assign/submission/comments/locallib.php

index 16364e2..33f97be 100644 (file)
@@ -110,7 +110,12 @@ class assign_submission_comments extends assign_submission_plugin {
      * @return bool was it a success? (false will trigger a rollback)
      */
     public function upgrade_settings(context $oldcontext, stdClass $oldassignment, & $log) {
-        // No settings to upgrade.
+        if ($oldassignment->assignmenttype == 'upload') {
+            // Disable if allow notes was not enabled.
+            if (!$oldassignment->var2) {
+                $this->disable();
+            }
+        }
         return true;
     }