Code Duplication    Length = 15-16 lines in 2 locations

main/install/install.lib.php 2 locations

@@ 2189-2204 (lines=16) @@
2186
            $groupId = intval($item['group_id']);
2187
2188
            // Fix group id
2189
            if (!empty($groupId)) {
2190
                $sql = "SELECT * FROM c_group_info
2191
                        WHERE c_id = $courseId AND id = $groupId
2192
                        LIMIT 1";
2193
                $data = $connection->fetchAssoc($sql);
2194
                if (!empty($data)) {
2195
                    $newGroupId = $data['iid'];
2196
                    $sql = "UPDATE $table SET group_id = $newGroupId
2197
                            WHERE iid = $iid";
2198
                    $connection->executeQuery($sql);
2199
                } else {
2200
                    // The group does not exists clean this record
2201
                    $sql = "DELETE FROM $table WHERE iid = $iid";
2202
                    $connection->executeQuery($sql);
2203
                }
2204
            }
2205
        }
2206
    }
2207
@@ 2239-2253 (lines=15) @@
2236
            $ref = $item['ref'];
2237
2238
            // Fix group id
2239
            if (!empty($groupId)) {
2240
                $sql = "SELECT * FROM c_group_info
2241
                        WHERE c_id = $courseId AND id = $groupId";
2242
                $data = $connection->fetchAssoc($sql);
2243
                if (!empty($data)) {
2244
                    $newGroupId = $data['iid'];
2245
                    $sql = "UPDATE c_item_property SET to_group_id = $newGroupId
2246
                            WHERE iid = $iid";
2247
                    $connection->executeQuery($sql);
2248
                } else {
2249
                    // The group does not exists clean this record
2250
                    $sql = "DELETE FROM c_item_property WHERE iid = $iid";
2251
                    $connection->executeQuery($sql);
2252
                }
2253
            }
2254
2255
            $sql = '';
2256
            $newId = '';