diff --git a/admin/environment.xml b/admin/environment.xml
index 4925aafb1c8..e031c7fc270 100644
--- a/admin/environment.xml
+++ b/admin/environment.xml
@@ -3923,6 +3923,8 @@
+
+
@@ -4113,6 +4115,8 @@
+
+
@@ -4305,6 +4309,8 @@
+
+
@@ -4496,6 +4502,8 @@
+
+
diff --git a/lang/en/admin.php b/lang/en/admin.php
index 37a2e2f22e9..51efd4e40e1 100644
--- a/lang/en/admin.php
+++ b/lang/en/admin.php
@@ -972,6 +972,7 @@ $string['opensslrecommended'] = 'Installing the optional OpenSSL library is high
$string['opensslrequired'] = 'The OpenSSL PHP extension is now required by Moodle to provide stronger cryptographic services.';
$string['opentowebcrawlers'] = 'Open to search engines';
$string['optionalmaintenancemessage'] = 'Optional maintenance message';
+$string['oracledatabaseinuse'] = 'We are changing Oracle DB support in Moodle LMS. Moodle version 4.5 will be the last version that supports Oracle as a database architecture. Further information can be found here';
$string['order1'] = 'First';
$string['order2'] = 'Second';
$string['order3'] = 'Third';
diff --git a/lib/tests/upgradelib_test.php b/lib/tests/upgradelib_test.php
index bc472165c84..e62d9c77c8d 100644
--- a/lib/tests/upgradelib_test.php
+++ b/lib/tests/upgradelib_test.php
@@ -1399,6 +1399,38 @@ class upgradelib_test extends advanced_testcase {
}
}
+ /**
+ * Test the check_oracle_usage check when the Moodle instance is not using Oracle as a database architecture.
+ *
+ * @covers ::check_oracle_usage
+ */
+ public function test_check_oracle_usage_is_not_used(): void {
+ global $CFG;
+
+ $this->resetAfterTest();
+ $CFG->dbtype = 'pgsql';
+
+ $result = new environment_results('custom_checks');
+ $this->assertNull(check_oracle_usage($result));
+ }
+
+ /**
+ * Test the check_oracle_usage check when the Moodle instance is using Oracle as a database architecture.
+ *
+ * @covers ::check_oracle_usage
+ */
+ public function test_check_oracle_usage_is_used(): void {
+ global $CFG;
+
+ $this->resetAfterTest();
+ $CFG->dbtype = 'oci';
+
+ $result = new environment_results('custom_checks');
+ $this->assertInstanceOf(environment_results::class, check_oracle_usage($result));
+ $this->assertEquals('oracle_database_usage', $result->getInfo());
+ $this->assertFalse($result->getStatus());
+ }
+
/**
* Data provider of usermenu items.
*
diff --git a/lib/upgradelib.php b/lib/upgradelib.php
index 45bb85b5424..ca122bd8b3f 100644
--- a/lib/upgradelib.php
+++ b/lib/upgradelib.php
@@ -2864,3 +2864,26 @@ function check_mod_assignment(environment_results $result): ?environment_results
return null;
}
+
+/**
+ * Check whether the Oracle database is currently being used and warn if so.
+ *
+ * The Oracle database support will be removed in a future version (4.5) as it is no longer supported by PHP.
+ *
+ * @param environment_results $result object to update, if relevant
+ * @return environment_results|null updated results or null if the current database is not Oracle.
+ *
+ * @see https://tracker.moodle.org/browse/MDL-80166 for further information.
+ */
+function check_oracle_usage(environment_results $result): ?environment_results {
+ global $CFG;
+
+ // Checking database type.
+ if ($CFG->dbtype === 'oci') {
+ $result->setInfo('oracle_database_usage');
+ $result->setFeedbackStr('oracledatabaseinuse');
+ return $result;
+ }
+
+ return null;
+}