diff --git a/admin/environment.xml b/admin/environment.xml
index 28e938cfedf..8f2d0008152 100644
--- a/admin/environment.xml
+++ b/admin/environment.xml
@@ -4714,6 +4714,7 @@
+
@@ -4893,6 +4894,8 @@
+
+
@@ -4906,6 +4909,7 @@
+
@@ -5090,6 +5094,8 @@
+
+
diff --git a/lang/en/admin.php b/lang/en/admin.php
index e1306a211c1..d378fdd3c29 100644
--- a/lang/en/admin.php
+++ b/lang/en/admin.php
@@ -597,6 +597,7 @@ $string['enroladminnewcourse_help'] = 'When an admin adds a new course, should t
$string['enrolinstancedefaults'] = 'Enrolment instance defaults';
$string['enrolinstancedefaults_desc'] = 'Default enrolment settings in new courses.';
$string['enrolmultipleusers'] = 'Enrol the users';
+$string['ensureauroraversion'] = 'Your site is running on Amazon Aurora database engine. Please ensure that the MySQL version in Amazon Aurora is compatible with the Moodle version you are installing or upgrading to. You can check the compatibility in the Database engine updates for Amazon Aurora MySQL version 3.';
$string['environment'] = 'Environment';
$string['environmenterrortodo'] = 'You must solve all the environmental problems (errors) found above before proceeding to install this Moodle version!';
$string['environmenterrorupgrade'] = 'Warning: you should solve all the environmental problems (errors) found above before proceeding to upgrade this Moodle version! Upgrading without fixing these requirements could cause problems such as data loss. Are you sure you want to continue with the upgrade?';
diff --git a/lib/dml/auroramysql_native_moodle_database.php b/lib/dml/auroramysql_native_moodle_database.php
index 3000913847a..990760cf8b3 100644
--- a/lib/dml/auroramysql_native_moodle_database.php
+++ b/lib/dml/auroramysql_native_moodle_database.php
@@ -68,7 +68,7 @@ class auroramysql_native_moodle_database extends mysqli_native_moodle_database {
* @return string The db vendor name, usually the same as db family name.
*/
public function get_dbvendor(): ?string {
- return 'mysql';
+ return 'auroramysql';
}
/**
diff --git a/lib/tests/upgradelib_test.php b/lib/tests/upgradelib_test.php
index aa2cff4355b..9be95f543cf 100644
--- a/lib/tests/upgradelib_test.php
+++ b/lib/tests/upgradelib_test.php
@@ -1532,4 +1532,36 @@ calendar,core_calendar|/calendar/view.php?view=month',
$this->assertTrue($updatedold->timecreated >= $origtime);
$this->assertTrue($updatedold->timemodified >= $origtime);
}
+
+ /**
+ * Test the check_aurora_version check when the Moodle instance is not using Amazon Aurora as a database architecture.
+ *
+ * @covers ::check_aurora_version
+ */
+ public function test_check_aurora_version_is_not_used(): void {
+ global $CFG;
+
+ $this->resetAfterTest();
+ $CFG->dbtype = 'pgsql';
+
+ $result = new environment_results('custom_checks');
+ $this->assertNull(check_aurora_version($result));
+ }
+
+ /**
+ * Test the check_aurora_version check when the Moodle instance is using Amazon Aurora as a database architecture.
+ *
+ * @covers ::check_aurora_version
+ */
+ public function test_check_aurora_version_is_used(): void {
+ global $CFG;
+
+ $this->resetAfterTest();
+ $CFG->dbtype = 'auroramysql';
+
+ $result = new environment_results('custom_checks');
+ $this->assertInstanceOf(environment_results::class, check_aurora_version($result));
+ $this->assertEquals('Aurora compatibility', $result->getInfo());
+ $this->assertFalse($result->getStatus());
+ }
}
diff --git a/lib/upgradelib.php b/lib/upgradelib.php
index 55323c75b59..bd654b8ce63 100644
--- a/lib/upgradelib.php
+++ b/lib/upgradelib.php
@@ -2876,3 +2876,23 @@ function check_async_backup(environment_results $result): ?environment_results {
return null;
}
+
+/**
+ * Checks if the current database vendor is Aurora MySQL.
+ *
+ * If the database vendor is 'auroramysql', this function sets additional information.
+ *
+ * @param environment_results $result The environment results object to update.
+ * @return environment_results|null The updated environment results object if Aurora is detected, or null otherwise.
+ */
+function check_aurora_version(environment_results $result): ?environment_results {
+ global $CFG;
+
+ if ($CFG->dbtype === 'auroramysql') {
+ $result->setInfo('Aurora compatibility');
+ $result->setFeedbackStr('ensureauroraversion');
+ return $result;
+ }
+
+ return null;
+}