From: stronk7 Date: Tue, 26 May 2009 14:46:01 +0000 (+0000) Subject: MDL-14992 sessions - proper destructor method and fixed dispose() behaviour. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8fdb24f0794312793d223d00dd75f74761e18b47;p=moodle.git MDL-14992 sessions - proper destructor method and fixed dispose() behaviour. --- diff --git a/lib/dml/adodb_moodle_database.php b/lib/dml/adodb_moodle_database.php index 12bbf1e836..9a033bf494 100644 --- a/lib/dml/adodb_moodle_database.php +++ b/lib/dml/adodb_moodle_database.php @@ -98,10 +98,10 @@ abstract class adodb_moodle_database extends moodle_database { * Do NOT use connect() again, create a new instance if needed. */ public function dispose() { + parent::dispose(); // Call parent dispose to write/close session and other common stuff before clossing conn if ($this->adodb) { $this->adodb->Close(); } - parent::dispose(); } /** diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index a60884849a..e8070348ff 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -94,7 +94,7 @@ abstract class moodle_database { /** * Destructor - cleans up and flushes everything needed. */ - public function __desctruct() { + public function __destruct() { $this->dispose(); } diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index c65662e9e7..12871c106f 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -159,11 +159,11 @@ class mysqli_native_moodle_database extends moodle_database { * Do NOT use connect() again, create a new instance if needed. */ public function dispose() { + parent::dispose(); // Call parent dispose to write/close session and other common stuff before clossing conn if ($this->mysqli) { $this->mysqli->close(); $this->mysqli = null; } - parent::dispose(); } /** diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 7d3c070a63..daf49b9aee 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -154,11 +154,11 @@ class oci_native_moodle_database extends moodle_database { * Do NOT use connect() again, create a new instance if needed. */ public function dispose() { + parent::dispose(); // Call parent dispose to write/close session and other common stuff before clossing conn if ($this->oci) { oci_close($this->oci); $this->oci = null; } - parent::dispose(); } diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index 8a6895af73..61d078e26f 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -166,11 +166,11 @@ class pgsql_native_moodle_database extends moodle_database { * Do NOT use connect() again, create a new instance if needed. */ public function dispose() { + parent::dispose(); // Call parent dispose to write/close session and other common stuff before clossing conn if ($this->pgsql) { pg_close($this->pgsql); $this->pgsql = null; } - parent::dispose(); }