Code Duplication    Length = 17-17 lines in 3 locations

install/upgrade_run_2.1.26.php 1 location

@@ 66-82 (lines=17) @@
63
################
64
## Function permits to check if a column exists, and if not to add it
65
################
66
function addColumnIfNotExist($db, $column, $columnAttr = "VARCHAR(255) NULL")
67
{
68
    global $dbTmp;
69
    $exists = false;
70
    $columns = mysqli_query($dbTmp, "show columns from $db");
71
    while ($c = mysqli_fetch_assoc($columns)) {
72
        if ($c['Field'] == $column) {
73
            $exists = true;
74
            return true;
75
        }
76
    }
77
    if (!$exists) {
78
        return mysqli_query($dbTmp, "ALTER TABLE `$db` ADD `$column`  $columnAttr");
79
    } else {
80
        return false;
81
    }
82
}
83
84
function addIndexIfNotExist($table, $index, $sql) {
85
    global $dbTmp;

install/upgrade_run_2.1.27.php 1 location

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

install/upgrade_run_db_original.php 1 location

@@ 52-68 (lines=17) @@
49
################
50
## Function permits to check if a column exists, and if not to add it
51
################
52
function addColumnIfNotExist($db, $column, $columnAttr = "VARCHAR(255) NULL")
53
{
54
    global $dbTmp;
55
    $exists = false;
56
    $columns = mysqli_query($dbTmp, "show columns from $db");
57
    while ($c = mysqli_fetch_assoc($columns)) {
58
        if ($c['Field'] == $column) {
59
            $exists = true;
60
            return true;
61
        }
62
    }
63
    if (!$exists) {
64
        return mysqli_query($dbTmp, "ALTER TABLE `$db` ADD `$column`  $columnAttr");
65
    } else {
66
        return false;
67
    }
68
}
69
70
function addIndexIfNotExist($table, $index, $sql) {
71
    global $dbTmp;