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
{
83
    global $dbTmp;
84
85
    $mysqli_result = mysqli_query($dbTmp, "SHOW INDEX FROM $table WHERE key_name LIKE \"$index\"");
86
    $res = mysqli_fetch_row($mysqli_result);
87
88
    // if index does not exist, then add it
89
    if (!$res) {
90
        $res = mysqli_query($dbTmp, "ALTER TABLE `$table` ".$sql);
91
    }
92
93
    return $res;
94
}
95
96
function tableExists($tablename)

install/upgrade_run_2.1.26.php 1 location

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

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)
85
{

install/upgrade_run_2.1.27.php 1 location

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