Code Duplication    Length = 17-17 lines in 3 locations

install/upgrade_run_2.1.26.php 1 location

@@ 105-121 (lines=17) @@
102
################
103
## Function permits to check if a column exists, and if not to add it
104
################
105
function addColumnIfNotExist($dbname, $column, $columnAttr = "VARCHAR(255) NULL")
106
{
107
    global $db_link;
108
    $exists = false;
109
    $columns = mysqli_query($db_link, "show columns from $dbname");
110
    while ($col = mysqli_fetch_assoc($columns)) {
111
        if ($col['Field'] == $column) {
112
            $exists = true;
113
            return true;
114
        }
115
    }
116
    if (!$exists) {
117
        return mysqli_query($db_link, "ALTER TABLE `$dbname` ADD `$column`  $columnAttr");
118
    } else {
119
        return false;
120
    }
121
}
122
123
function addIndexIfNotExist($table, $index, $sql)
124
{

install/upgrade_run_2.1.27.php 1 location

@@ 108-124 (lines=17) @@
105
 * @param string $column     [description]
106
 * @param string $columnAttr [description]
107
 */
108
function addColumnIfNotExist($dbname, $column, $columnAttr = "VARCHAR(255) NULL")
109
{
110
    global $db_link;
111
    $exists = false;
112
    $columns = mysqli_query($db_link, "show columns from $dbname");
113
    while ($col = mysqli_fetch_assoc($columns)) {
114
        if ($col['Field'] == $column) {
115
            $exists = true;
116
            return true;
117
        }
118
    }
119
    if (!$exists) {
120
        return mysqli_query($db_link, "ALTER TABLE `$dbname` ADD `$column`  $columnAttr");
121
    }
122
123
    return false;
124
}
125
126
/**
127
 * [cleanFields description]

install/upgrade_run_db_original.php 1 location

@@ 41-57 (lines=17) @@
38
################
39
## Function permits to check if a column exists, and if not to add it
40
################
41
function addColumnIfNotExist($dbname, $column, $columnAttr = "VARCHAR(255) NULL")
42
{
43
    global $db_link;
44
    $exists = false;
45
    $columns = mysqli_query($db_link, "show columns from $dbname");
46
    while ($col = mysqli_fetch_assoc($columns)) {
47
        if ($col['Field'] == $column) {
48
            $exists = true;
49
            return true;
50
        }
51
    }
52
    if (!$exists) {
53
        return mysqli_query($db_link, "ALTER TABLE `$dbname` ADD `$column`  $columnAttr");
54
    }
55
56
    return false;
57
}
58
59
function addIndexIfNotExist($table, $index, $sql)
60
{