From bd3e0b205de6fce6ea99cc27ec8bcc68e87c75bc Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 14 Sep 2010 20:59:46 +0000 Subject: [PATCH] MDL-17491 oracler driver diagnostics - tells admins to install PL/SQL packages --- lib/dml/oci_native_moodle_database.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 41bad544c9e..a018027fe36 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -50,7 +50,6 @@ class oci_native_moodle_database extends moodle_database { private $dblocks_supported = null; // To cache locks support along the connection life private $bitwise_supported = null; // To cache bitwise operations support along the connection life - /** * Detects if all needed PHP stuff installed. * Note: can be used before connect() @@ -96,7 +95,7 @@ class oci_native_moodle_database extends moodle_database { * @return string */ public function get_name() { - return get_string('nativeoci', 'install'); // TODO: localise + return get_string('nativeoci', 'install'); } /** @@ -114,7 +113,20 @@ class oci_native_moodle_database extends moodle_database { * @return string */ public function get_configuration_hints() { - return get_string('databasesettingssub_oci', 'install'); // TODO: l + return get_string('databasesettingssub_oci', 'install'); + } + + /** + * Diagnose database and tables, this function is used + * to verify database and driver settings, db engine types, etc. + * + * @return string null means everything ok, string means problem found. + */ + public function diagnose() { + if (!$this->bitwise_supported() or !$this->session_lock_supported()) { + return 'Oracle PL/SQL Moodle support packages are not installed! Database administrator has to execute /lib/dml/oci_native_moodle_package.sql script.'; + } + return null; } /**