Code Duplication    Length = 8-9 lines in 2 locations

install/cli-install.php 1 location

@@ 1004-1011 (lines=8) @@
1001
1002
                        return;
1003
                    }
1004
                    if (!is_null($save_sql_id_as)) {
1005
                        $sql_id = @mysqli_insert_id($sqlParser->conn);
1006
                        if (!$sql_id) {
1007
                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn,
1008
                                "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1009
                            $sql_id = $idQuery['id'];
1010
                        }
1011
                        $custom_placeholders[$save_sql_id_as] = $sql_id;
1012
                    }
1013
                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1014
                } else {

install/src/controllers/install.php 1 location

@@ 307-315 (lines=9) @@
304
                            $errorData = true;
305
                            break;
306
                        }
307
                        if (!is_null($save_sql_id_as)) {
308
                            $sql_id = @mysqli_insert_id($sqlParser->conn);
309
                            if (!$sql_id) {
310
                                $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;";
311
                                $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query));
312
                                $sql_id = $idQuery['id'];
313
                            }
314
                            $custom_placeholders[$save_sql_id_as] = $sql_id;
315
                        }
316
                    } else {
317
                        $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create';
318
                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";