Code Duplication    Length = 13-13 lines in 4 locations

install/upgrade_ajax.php 1 location

@@ 81-93 (lines=13) @@
78
    }
79
}
80
81
function addIndexIfNotExist($table, $index, $sql) {
82
    global $dbTmp;
83
84
    $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
85
    $res = mysqli_fetch_row($mysqli_result);
86
87
    // if index does not exist, then add it
88
    if (!$res) {
89
        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
90
    }
91
92
    return $res;
93
}
94
95
function tableExists($tablename, $database = false)
96
{

install/upgrade_run_2.1.26.php 1 location

@@ 84-96 (lines=13) @@
81
    }
82
}
83
84
function addIndexIfNotExist($table, $index, $sql) {
85
    global $dbTmp;
86
87
    $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
88
    $res = mysqli_fetch_row($mysqli_result);
89
90
    // if index does not exist, then add it
91
    if (!$res) {
92
        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
93
    }
94
95
    return $res;
96
}
97
98
function tableExists($tablename, $database = false)
99
{

install/upgrade_run_2.1.27.php 1 location

@@ 64-76 (lines=13) @@
61
    }
62
}
63
64
function addIndexIfNotExist($table, $index, $sql) {
65
    global $dbTmp;
66
67
    $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
68
    $res = mysqli_fetch_row($mysqli_result);
69
70
    // if index does not exist, then add it
71
    if (!$res) {
72
        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
73
    }
74
75
    return $res;
76
}
77
78
function tableExists($tablename, $database = false)
79
{

install/upgrade_run_db_original.php 1 location

@@ 70-82 (lines=13) @@
67
    }
68
}
69
70
function addIndexIfNotExist($table, $index, $sql) {
71
    global $dbTmp;
72
73
    $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
74
    $res = mysqli_fetch_row($mysqli_result);
75
76
    // if index does not exist, then add it
77
    if (!$res) {
78
        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
79
    }
80
81
    return $res;
82
}
83
84
function tableExists($tablename, $database = false)
85
{