Code Duplication    Length = 15-16 lines in 2 locations

main/install/install.lib.php 2 locations

@@ 2269-2284 (lines=16) @@
2266
            $groupId = intval($item['group_id']);
2267
2268
            // Fix group id
2269
            if (!empty($groupId)) {
2270
                $sql = "SELECT * FROM c_group_info
2271
                        WHERE c_id = $courseId AND id = $groupId
2272
                        LIMIT 1";
2273
                $data = $connection->fetchAssoc($sql);
2274
                if (!empty($data)) {
2275
                    $newGroupId = $data['iid'];
2276
                    $sql = "UPDATE $table SET group_id = $newGroupId
2277
                            WHERE iid = $iid";
2278
                    $connection->executeQuery($sql);
2279
                } else {
2280
                    // The group does not exists clean this record
2281
                    $sql = "DELETE FROM $table WHERE iid = $iid";
2282
                    $connection->executeQuery($sql);
2283
                }
2284
            }
2285
        }
2286
    }
2287
@@ 2317-2331 (lines=15) @@
2314
            $ref = $item['ref'];
2315
2316
            // Fix group id
2317
            if (!empty($groupId)) {
2318
                $sql = "SELECT * FROM c_group_info
2319
                        WHERE c_id = $courseId AND id = $groupId";
2320
                $data = $connection->fetchAssoc($sql);
2321
                if (!empty($data)) {
2322
                    $newGroupId = $data['iid'];
2323
                    $sql = "UPDATE c_item_property SET to_group_id = $newGroupId
2324
                            WHERE iid = $iid";
2325
                    $connection->executeQuery($sql);
2326
                } else {
2327
                    // The group does not exists clean this record
2328
                    $sql = "DELETE FROM c_item_property WHERE iid = $iid";
2329
                    $connection->executeQuery($sql);
2330
                }
2331
            }
2332
2333
            $sql = '';
2334
            $newId = '';