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

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