MDL-67062 core_h5p: fix oracle distinct error
authorSara Arjona <sara@moodle.com>
Thu, 27 Feb 2020 12:12:52 +0000 (13:12 +0100)
committerSara Arjona <sara@moodle.com>
Thu, 27 Feb 2020 12:12:52 +0000 (13:12 +0100)
h5p/classes/api.php

index c1087d1..fdd5b29 100644 (file)
@@ -82,10 +82,12 @@ class api {
     public static function get_dependent_libraries(int $libraryid): array {
         global $DB;
 
-        $sql = 'SELECT DISTINCT hl.*
-                  FROM {h5p_library_dependencies} hld
-                  JOIN {h5p_libraries} hl ON hl.id = hld.libraryid
-                 WHERE hld.requiredlibraryid = :libraryid';
+        $sql = 'SELECT *
+                  FROM {h5p_libraries}
+                 WHERE id IN (SELECT DISTINCT hl.id
+                                FROM {h5p_library_dependencies} hld
+                                JOIN {h5p_libraries} hl ON hl.id = hld.libraryid
+                               WHERE hld.requiredlibraryid = :libraryid)';
         $params = ['libraryid' => $libraryid];
 
         return $DB->get_records_sql($sql, $params);