Code Duplication    Length = 13-15 lines in 2 locations

install/actions/action_connection.php 1 location

@@ 31-45 (lines=15) @@
28
}
29
30
// check the database collation if not specified in the configuration
31
if ($upgradeable && (!isset ($database_connection_charset) || empty($database_connection_charset))) {
32
    if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
33
        $rs = mysqli_query($conn, "show session variables like 'collation_server'");
34
    }
35
    if ($rs && $collation = mysqli_fetch_row($rs)) {
36
        $database_collation = $collation[1];
37
    }
38
    if (empty ($database_collation)) {
39
        $database_collation = 'utf8_general_ci';
40
    }
41
    $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
42
    $database_connection_charset = $database_charset;
43
} else {
44
    $database_collation = 'utf8_general_ci';
45
}
46
47
// determine the database connection method if not specified in the configuration
48
if ($upgradeable && (!isset($database_connection_method) || empty($database_connection_method))) {

install/actions/action_summary.php 1 location

@@ 216-228 (lines=13) @@
213
}
214
215
// check the database collation if not specified in the configuration
216
if (!isset ($database_connection_charset) || empty ($database_connection_charset)) {
217
    if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
218
        $rs = mysqli_query($conn, "show session variables like 'collation_server'");
219
    }
220
    if ($rs && $collation = mysqli_fetch_row($rs)) {
221
        $database_collation = $collation[1];
222
    }
223
    if (empty ($database_collation)) {
224
        $database_collation = 'utf8_unicode_ci';
225
    }
226
    $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
227
    $database_connection_charset = $database_charset;
228
}
229
230
// determine the database connection method if not specified in the configuration
231
if (!isset($database_connection_method) || empty($database_connection_method)) {