Code Duplication    Length = 15-15 lines in 2 locations

install/cli-install.php 1 location

@@ 1049-1063 (lines=15) @@
1046
}
1047
1048
// generate new site_id and set manager theme to default
1049
if ($installMode == 0) {
1050
    $siteid = uniqid('');
1051
    mysqli_query($sqlParser->conn,
1052
        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
1053
} else {
1054
    // update site_id if missing
1055
    $ds = mysqli_query($sqlParser->conn,
1056
        "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
1057
    if ($ds) {
1058
        $r = mysqli_fetch_assoc($ds);
1059
        $siteid = $r['setting_value'];
1060
        if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
1061
            $siteid = uniqid('');
1062
            mysqli_query($sqlParser->conn,
1063
                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1064
        }
1065
    }
1066
}

install/src/controllers/install.php 1 location

@@ 254-268 (lines=15) @@
251
}
252
253
// generate new site_id and set manager theme to default
254
if ($installMode == 0) {
255
    $siteid = uniqid('');
256
    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
257
} else {
258
    // update site_id if missing
259
    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
260
    if ($ds) {
261
        $r = mysqli_fetch_assoc($ds);
262
        $siteid = $r['setting_value'];
263
        if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
264
            $siteid = uniqid('');
265
            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
266
        }
267
    }
268
}
269
270
// Reset database for installation of demo-site
271
if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {