Code Duplication    Length = 14-18 lines in 2 locations

install/cli-install.php 1 location

@@ 931-944 (lines=14) @@
928
    $siteid = uniqid('');
929
    mysqli_query($sqlParser->conn,
930
        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
931
} else {
932
    // update site_id if missing
933
    $ds = mysqli_query($sqlParser->conn,
934
        "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
935
    if ($ds) {
936
        $r = mysqli_fetch_assoc($ds);
937
        $siteid = $r['setting_value'];
938
        if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
939
            $siteid = uniqid('');
940
            mysqli_query($sqlParser->conn,
941
                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
942
        }
943
    }
944
}
945
946
// Reset database for installation of demo-site
947
if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {

install/src/controllers/install.php 1 location

@@ 215-232 (lines=18) @@
212
                    $sqlParser->conn,
213
                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
214
            );
215
        } else {
216
            // update site_id if missing
217
            $ds = mysqli_query(
218
                    $sqlParser->conn,
219
                "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"
220
            );
221
            if ($ds) {
222
                $r = mysqli_fetch_assoc($ds);
223
                $siteid = $r['setting_value'];
224
                if ($siteid == '' || $siteid === 'MzGeQ2faT4Dw06+U49x3') {
225
                    $siteid = uniqid('');
226
                    mysqli_query(
227
                            $sqlParser->conn,
228
                        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
229
                    );
230
                }
231
            }
232
        }
233
234
        // Reset database for installation of demo-site
235
        if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {