diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index 46a8b0e5c2..d42b9c2dc4 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -179,28 +179,6 @@ class Database { //return self::format_glued_course_table_name(self::fix_database_parameter($database_name), $short_table_name); } - /** - * Gets a complete course table name from a course code - * - * @param string $course_code - * @param string $table the name of the table - * @todo this function should be deprecated use api_get_course_info() - * and then get_course_table() - */ - public static function get_course_table_from_code($course_code, $table) { - $course_table = self::get_main_table(TABLE_MAIN_COURSE); - $course_cat_table = self::get_main_table(TABLE_MAIN_CATEGORY); - $sql = "SELECT $course_table.db_name, $course_cat_table.code - FROM $course_table - LEFT JOIN $course_cat_table - ON $course_table.category_code = $course_cat_table.code - WHERE $course_table.code = '$course_code' - LIMIT 1"; - - $result = self::fetch_array(self::query($sql)); - return sprintf("%s.%s", $result[0], $table); - } - /** * This generic method returns the correct and complete name of any * statistic table of which you pass the short name as a parameter. diff --git a/main/inc/lib/database.mysqli.lib.php b/main/inc/lib/database.mysqli.lib.php index 348496fdc8..aff3c65266 100644 --- a/main/inc/lib/database.mysqli.lib.php +++ b/main/inc/lib/database.mysqli.lib.php @@ -168,25 +168,6 @@ class Database { return self::format_glued_course_table_name(self::fix_database_parameter($database_name), $short_table_name); } - /** - * Gets a complete course table name from a course code - * - * @param string $course_code - * @param string $table the name of the table - */ - public static function get_course_table_from_code($course_code, $table) { - $course_table = self::get_main_table(TABLE_MAIN_COURSE); - $course_cat_table = self::get_main_table(TABLE_MAIN_CATEGORY); - $result = self::fetch_array(self::query( - "SELECT $course_table.db_name, $course_cat_table.code - FROM $course_table - LEFT JOIN $course_cat_table - ON $course_table.category_code = $course_cat_table.code - WHERE $course_table.code = '$course_code' - LIMIT 1")); - return sprintf("%s.%s", $result[0], $table); - } - /** * This generic method returns the correct and complete name of any statistic table * of which you pass the short name as a parameter. diff --git a/main/inc/lib/search/tool_processors/learnpath_processor.class.php b/main/inc/lib/search/tool_processors/learnpath_processor.class.php index 7e76c6ab75..5a609510b0 100644 --- a/main/inc/lib/search/tool_processors/learnpath_processor.class.php +++ b/main/inc/lib/search/tool_processors/learnpath_processor.class.php @@ -92,8 +92,8 @@ class learnpath_processor extends search_processor { if (!empty($course_information)) { $lpi_table = Database::get_course_table(TABLE_LP_ITEM); - $lp_table = Database::get_course_table_from_code(TABLE_LP_MAIN); - $doc_table = Database::get_course_table_from_code(TABLE_DOCUMENT); + $lp_table = Database::get_course_table(TABLE_LP_MAIN); + $doc_table = Database::get_course_table(TABLE_DOCUMENT); $lp_id = Database::escape_string($lp_id); diff --git a/tests/main/inc/lib/database.lib.test.php b/tests/main/inc/lib/database.lib.test.php index ec1bd4eb40..4d8222f1d6 100755 --- a/tests/main/inc/lib/database.lib.test.php +++ b/tests/main/inc/lib/database.lib.test.php @@ -152,15 +152,7 @@ class TestDatabase extends UnitTestCase { $res=$this->dbase->get_course_table($short_table_name,$database_name); $this->assertTrue(is_string($res)); } - - function testGetCourseTableFromCode() { - $course_code='AYDD'; - $table='course'; - $ret = NULL; - $res=$this->dbase->get_course_table_from_code($course_code, $table); - $this->assertTrue(is_string($res)); - } - + function testGetCourseTablePrefix() { global $_configuration; $res=$this->dbase->get_course_table_prefix($_configuration);