diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 1ffa225b21e..ff58505766d 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -114,7 +114,7 @@ jobs: steps: - name: Start MariaDB if: matrix.database == 'mariadb' - run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10 + run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10.5 - name: Start PostgreSQL if: matrix.database == 'pgsql' diff --git a/classes/event/rating_created.php b/classes/event/rating_created.php index 4e918e9aeeb..d96a91321ae 100644 --- a/classes/event/rating_created.php +++ b/classes/event/rating_created.php @@ -63,4 +63,4 @@ public function get_description() { public static function get_name() { return get_string('eventratingcreated', 'mod_moodleoverflow'); } -} \ No newline at end of file +} diff --git a/classes/event/rating_deleted.php b/classes/event/rating_deleted.php index 209cf35b104..1d1fa070e65 100644 --- a/classes/event/rating_deleted.php +++ b/classes/event/rating_deleted.php @@ -63,4 +63,4 @@ public function get_description() { public static function get_name() { return get_string('eventratingdeleted', 'mod_moodleoverflow'); } -} \ No newline at end of file +} diff --git a/classes/event/rating_updated.php b/classes/event/rating_updated.php index 6b3901ee47f..bf0673f79f3 100644 --- a/classes/event/rating_updated.php +++ b/classes/event/rating_updated.php @@ -63,4 +63,4 @@ public function get_description() { public static function get_name() { return get_string('eventratingupdated', 'mod_moodleoverflow'); } -} \ No newline at end of file +} diff --git a/classes/observer.php b/classes/observer.php index 199cf027f2a..26948f67c30 100644 --- a/classes/observer.php +++ b/classes/observer.php @@ -141,4 +141,4 @@ public static function course_module_created(\core\event\course_module_created $ moodleoverflow_instance_created($event->get_context(), $moodleoverflow); } } -} \ No newline at end of file +} diff --git a/classes/privacy/data_export_helper.php b/classes/privacy/data_export_helper.php index 271496a059a..d6314a30bd4 100644 --- a/classes/privacy/data_export_helper.php +++ b/classes/privacy/data_export_helper.php @@ -498,4 +498,4 @@ public static function get_subcontext($discussion = null, $post = null) { } return $subcontext; } -} \ No newline at end of file +} diff --git a/classes/readtracking.php b/classes/readtracking.php index 8bedfe8946f..8b67e39be1a 100644 --- a/classes/readtracking.php +++ b/classes/readtracking.php @@ -565,4 +565,4 @@ public static function moodleoverflow_count_unread_posts_course($userid, $course // Else return nothing. return array(); } -} \ No newline at end of file +} diff --git a/classes/subscriptions.php b/classes/subscriptions.php index 349cec5d3db..4231c4ed4a9 100644 --- a/classes/subscriptions.php +++ b/classes/subscriptions.php @@ -1081,4 +1081,4 @@ public static function get_discussion_subscription_icon($moodleoverflow, $discus return \html_writer::link($subscriptionlink, $output, $array); } -} \ No newline at end of file +} diff --git a/db/events.php b/db/events.php index fb23de721ef..a5d05d3463e 100644 --- a/db/events.php +++ b/db/events.php @@ -44,4 +44,4 @@ 'callback' => 'mod_moodleoverflow_observer::course_module_created', ), -); \ No newline at end of file +); diff --git a/db/messages.php b/db/messages.php index adb9f3a540e..c03df6a673a 100644 --- a/db/messages.php +++ b/db/messages.php @@ -28,4 +28,4 @@ // Ordinary single moodleoverflow posts. 'posts' => array(), -); \ No newline at end of file +); diff --git a/db/services.php b/db/services.php index 2061917cbf2..7bcba3e5eba 100644 --- a/db/services.php +++ b/db/services.php @@ -34,4 +34,4 @@ 'ajax' => true, 'capabilities' => 'mod/moodleoverflow:ratepost' ) -); \ No newline at end of file +); diff --git a/db/upgrade.php b/db/upgrade.php index a7b54be1255..e33cb2fe2a0 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -94,8 +94,6 @@ function xmldb_moodleoverflow_upgrade($oldversion) { $table->add_field('moodleoverflowid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); $table->add_field('grade', XMLDB_TYPE_FLOAT, '10', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('late', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0'); - $table->add_field('completed', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0'); // Adding keys to table moodleoverflow_grades. $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); @@ -155,5 +153,24 @@ function xmldb_moodleoverflow_upgrade($oldversion) { upgrade_mod_savepoint(true, 2021060800, 'moodleoverflow'); } + if ($oldversion < 2021072700) { + // Define fields late and completed to be dropped from moodleoverflow_grades. + $table = new xmldb_table('moodleoverflow_grades'); + + $field = new xmldb_field('late'); + // Conditionally launch drop field late. + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + + $field = new xmldb_field('completed'); + // Conditionally launch drop field completed. + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + + upgrade_mod_savepoint(true, 2021072700, 'moodleoverflow'); + } + return true; -} \ No newline at end of file +} diff --git a/discussion.php b/discussion.php index 1c814d75113..fbb22b423ab 100644 --- a/discussion.php +++ b/discussion.php @@ -159,4 +159,4 @@ moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $canreply); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/index.php b/index.php index 445d34d7eaf..ad494c22ab3 100644 --- a/index.php +++ b/index.php @@ -390,4 +390,4 @@ } // Print the pages footer. -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/locallib.php b/locallib.php index 8a5671b21c9..33bb760f318 100644 --- a/locallib.php +++ b/locallib.php @@ -1901,8 +1901,6 @@ function moodleoverflow_update_user_grade_on_db($moodleoverflow, $postuserrating $gradedataobject->moodleoverflowid = $moodleoverflow->id; $gradedataobject->userid = $userid; $gradedataobject->grade = $grade; - $gradedataobject->late = 0; - $gradedataobject->completed = 0; $DB->insert_record('moodleoverflow_grades', $gradedataobject, false); } diff --git a/markposts.php b/markposts.php index 376645cff9b..e56ce3bb627 100644 --- a/markposts.php +++ b/markposts.php @@ -142,4 +142,4 @@ // Redirect the user back to the view.php. redirect(moodleoverflow_go_back_to($returnto), $message, null, $status); exit; -} \ No newline at end of file +} diff --git a/post.php b/post.php index bd22209343c..08804cfc12b 100644 --- a/post.php +++ b/post.php @@ -763,4 +763,4 @@ $mformpost->display(); // Display the footer. -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/renderer.php b/renderer.php index 6a953be58b3..b05569a3d13 100644 --- a/renderer.php +++ b/renderer.php @@ -102,4 +102,4 @@ public function render_moodleoverflow_email(\mod_moodleoverflow\output\moodleove public function moodleoverflow_email_template() { return null; } -} \ No newline at end of file +} diff --git a/settings.php b/settings.php index 0c0710c3e29..f51f296c035 100644 --- a/settings.php +++ b/settings.php @@ -112,4 +112,4 @@ $setting->set_updatedcallback('moodleoverflow_update_all_grades'); } -} \ No newline at end of file +} diff --git a/subscribe.php b/subscribe.php index 4772dad12e2..cc1617dd454 100644 --- a/subscribe.php +++ b/subscribe.php @@ -333,4 +333,4 @@ redirect($returnto, get_string('discussionnowsubscribed', 'moodleoverflow', $info), null, $notify['success']); exit; } -} \ No newline at end of file +} diff --git a/tests/privacy_provider_test.php b/tests/privacy_provider_test.php index 6907576df7f..2b8bf369775 100644 --- a/tests/privacy_provider_test.php +++ b/tests/privacy_provider_test.php @@ -1459,4 +1459,4 @@ public function test_grades() { 'userid, grade'); self::assertEmpty($grades); } -} \ No newline at end of file +} diff --git a/tests/readtracking_test.php b/tests/readtracking_test.php index 5da8937c18f..ea979137cf7 100644 --- a/tests/readtracking_test.php +++ b/tests/readtracking_test.php @@ -159,4 +159,4 @@ public function test_moodleoverflow_is_tracked() { $result = \mod_moodleoverflow\readtracking::moodleoverflow_is_tracked($mooptional); $this->assertEquals(false, $result); } -} \ No newline at end of file +} diff --git a/tests/subscriptions_test.php b/tests/subscriptions_test.php index 82325c7f9c3..341e96635f2 100644 --- a/tests/subscriptions_test.php +++ b/tests/subscriptions_test.php @@ -1458,4 +1458,4 @@ public function test_is_subscribable_loggedin($options, $expect) { $this->assertEquals($expect, \mod_moodleoverflow\subscriptions::is_subscribable($moodleoverflow)); } -} \ No newline at end of file +} diff --git a/tracking.php b/tracking.php index f56fe1dd6eb..64dcb17f9c4 100644 --- a/tracking.php +++ b/tracking.php @@ -121,4 +121,4 @@ // Print an error message. print_error('cannottrack', 'moodleoverflow', get_local_referer(false)); } -} \ No newline at end of file +} diff --git a/version.php b/version.php index b180510332a..7dde56bd8a2 100644 --- a/version.php +++ b/version.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_moodleoverflow'; -$plugin->version = 2021060800; +$plugin->version = 2021072700; $plugin->release = 'v3.11-r1'; $plugin->requires = 2018051703; $plugin->maturity = MATURITY_STABLE;