From bbac4ae7c5b0c0f0e37c32805aba6ffa8b7a9fe3 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 5 Jun 2007 01:19:09 +0000 Subject: [PATCH] MDL-9972 Removed the __destruct() method, which was not needed. Also fixed a few bugs that caused notices in PHP5. --- lib/grade/grade_tree.php | 6 +++--- lib/simpletest/testgradelib.php | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/grade/grade_tree.php b/lib/grade/grade_tree.php index f2bb8818aa..b8d3e10eba 100644 --- a/lib/grade/grade_tree.php +++ b/lib/grade/grade_tree.php @@ -416,7 +416,7 @@ class grade_tree { foreach ($elements as $key => $element) { $this->first_sortorder++; $new_sortorder = $this->first_sortorder; - $old_sortorder = $element['object']->sortorder; + $old_sortorder = $element['object']->get_sortorder(); // Assign new sortorder $element['object']->sortorder = $new_sortorder; @@ -501,7 +501,7 @@ class grade_tree { $count = 0; foreach ($array as $key => $child) { - $sortorder = $child['object']->sortorder; + $sortorder = $child['object']->get_sortorder(); if ($returnnextelement) { return $sortorder; } @@ -547,7 +547,7 @@ class grade_tree { } // Look at the current key of the fillers array. It is a sortorder. - if (key($this->fillers) < $object->sortorder || empty($object)) { + if (empty($object) || key($this->fillers) < $object->sortorder) { $sortorder = key($this->fillers); $filler_object = current($this->fillers); diff --git a/lib/simpletest/testgradelib.php b/lib/simpletest/testgradelib.php index 9512fee609..f8d7f2dde8 100644 --- a/lib/simpletest/testgradelib.php +++ b/lib/simpletest/testgradelib.php @@ -363,17 +363,6 @@ class gradelib_test extends UnitTestCase { } $CFG->prefix = $CFG->old_prefix; } - - /** - * In PHP5, this is called to drop the test tables after all the tests have been performed. - * Until we move to PHP5, I know no easy way to accomplish this. - */ - function __destruct() { - foreach ($this->tables as $table) { - $xmldbtable = new XMLDBTable($table); - drop_table($xmldbtable, true, false); - } - } /** * Load scale data into the database, and adds the corresponding objects to this class' variable. -- 2.39.5