]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14992 sessions - proper destructor method and fixed dispose() behaviour.
authorstronk7 <stronk7>
Tue, 26 May 2009 14:46:01 +0000 (14:46 +0000)
committerstronk7 <stronk7>
Tue, 26 May 2009 14:46:01 +0000 (14:46 +0000)
lib/dml/adodb_moodle_database.php
lib/dml/moodle_database.php
lib/dml/mysqli_native_moodle_database.php
lib/dml/oci_native_moodle_database.php
lib/dml/pgsql_native_moodle_database.php

index 12bbf1e8362c30c67a6e75563d3c1d4bb8289086..9a033bf4942a872f455c1291be797851955f8ccf 100644 (file)
@@ -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();
     }
 
     /**
index a60884849aa2d00d6e93699bab07100d06db0d66..e8070348ff04240b483d165984d52c4e0bfa21bc 100644 (file)
@@ -94,7 +94,7 @@ abstract class moodle_database {
     /**
      * Destructor - cleans up and flushes everything needed.
      */
-    public function __desctruct() {
+    public function __destruct() {
         $this->dispose();
     }
 
index c65662e9e7424fca4c2fb5aa7300817055f13a61..12871c106f907e8b58e07066e3112b6d6aaee38d 100644 (file)
@@ -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();
     }
 
     /**
index 7d3c070a6326fbadf31224d45eec2f28a54e236a..daf49b9aee2817bd03f9ea7f56bea7df85f9dbd0 100644 (file)
@@ -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();
     }
 
 
index 8a6895af73fbe2c7a2fce8999bf4e7847bad31c8..61d078e26f393f951188f46bff8e1cc706a38273 100644 (file)
@@ -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();
     }