upgrade.php ➔ smallworld_comDefaultNull()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
// Upgrade functions used when adding or altering tables etc between versions
3
/**
4
 * Function to do the creatind
5
 *
6
 */
7
function smallworld_doUpgrade()
8
{
9
    global $xoopsDB, $xoopsUser;
10
    varcharToBlog();
11
    smallworld_comToBlog();
12
    smallworld_adminAvatarRename();
13
	smallworld_adminDefaultNull();
14
	smallworld_comDefaultNull();
15
	smallworld_complaintsDefaultNull();
16
	smallworld_followersDefaultNull();
17
	smallworld_friendsDefaultNull();
18
	smallworld_imagesDefaultNull();
19
	smallworld_messagesDefaultNull();
20
	smallworld_settingsDefaultNull();
21
	smallworld_userDefaultNull();
22
	smallworld_voteDefaultNull();
23
    if (smallworld_DoTableExists($xoopsDB->prefix('smallworld_settings'))) {
24
        // Table exists
25
        return false;
26
    } else {
27
        // Table does not exist -> create
28
29
        $sql = "CREATE TABLE IF NOT EXISTS " . $xoopsDB->prefix('smallworld_settings') . " (';
30
        $sql .= '`id` int(11) NOT NULL AUTO_INCREMENT,';
0 ignored issues
show
Bug introduced by
The variable $sql seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
31
        $sql .= '`userid` int(11) NOT NULL,';
0 ignored issues
show
Bug introduced by
The variable $sql seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
32
        $sql .= '`value` text NOT NULL,';
0 ignored issues
show
Bug introduced by
The variable $sql seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
33
        $sql .= 'PRIMARY KEY (`id`)';
0 ignored issues
show
Bug introduced by
The variable $sql seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
34
        $sql .= ') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
0 ignored issues
show
Bug introduced by
The variable $sql seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
35
        $result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
36
    }
37
}
38
39
function smallworld_adminAvatarRename()
40
{
41
    global $xoopsDB;
42
    $sql     = 'update ' . $xoopsDB->prefix('smallworld_admin') . " set userimage = '' WHERE userimage = 'blank.gif' || userimage NOT REGEXP '\.(jpe?g|gif|png|bmp)'";
43
    $sql2    = 'update ' . $xoopsDB->prefix('smallworld_user') . " set userimage = '' WHERE userimage = 'blank.gif' || userimage NOT REGEXP '\.(jpe?g|gif|png|bmp)'";
44
    $result  = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
45
    $result2 = $xoopsDB->queryF($sql2);
0 ignored issues
show
Unused Code introduced by
$result2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
46
}
47
48
/**
49
 * @param $tablename
50
 * @return bool
51
 */
52
function smallworld_DoTableExists($tablename)
53
{
54
    global $xoopsDB;
55
    $result = $xoopsDB->queryF("SHOW TABLES LIKE '$tablename'");
56
57
    return ($xoopsDB->getRowsNum($result) > 0);
58
}
59
60
/**
61
 * Alter table messages from varchar(200) to text()
62
 * @return void
63
 */
64
function varcharToBlog()
65
{
66
    global $xoopsDB;
67
    $sql = "ALTER TABLE " . $xoopsDB->prefix('smallworld_messages') . " CHANGE message message TEXT";
68
    $result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
69
}
70
71
/**
72
 * function to correct the comments from varchar to text
73
 * @return void
74
 */
75
function smallworld_comToBlog()
76
{
77
    global $xoopsDB;
78
    $sql = "ALTER TABLE " . $xoopsDB->prefix('smallworld_comments') . " CHANGE `comment` `comment` TEXT";
79
    $result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
80
}
81
82
/**
83
 * function to correct null values in MariaDb / Mysql
84
 * @return void
85
 */
86
function smallworld_adminDefaultNull()
87
{	
88
	global $xoopsDB;
89
	$sql = "ALTER TABLE " . $xoopsDB->prefix('smallworld_admin') . "  
90
	CHANGE `userid` `userid` INT(11) NULL, 
91
	CHANGE `username` `username` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
92
	CHANGE `realname` `realname` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
93
	CHANGE `userimage` `userimage` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
94
	CHANGE `ip` `ip` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
95
	CHANGE `complaint` `complaint` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
96
	CHANGE `inspect_start` `inspect_start` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
97
	CHANGE `inspect_stop` `inspect_stop` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
98
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
99
}
100
101
/**
102
 * function to correct null values in MariaDb / Mysql
103
 * @return void
104
 */
105
function smallworld_comDefaultNull()
106
{	
107
	global $xoopsDB;
108
	$sql = "ALTER TABLE  " . $xoopsDB->prefix('smallworld_comments') . " 
109
	CHANGE `com_id` `com_id` INT(11) NOT NULL AUTO_INCREMENT, 
110
	CHANGE `comment` `comment` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
111
	CHANGE `msg_id_fk` `msg_id_fk` INT(11) NULL, CHANGE `uid_fk` `uid_fk` INT(11) NULL, 
112
	CHANGE `ip` `ip` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
113
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
114
}
115
116
/**
117
 * function to correct null values in MariaDb / Mysql
118
 * @return void
119
 */
120
function smallworld_complaintsDefaultNull()
121
{	
122
	global $xoopsDB;
123
	$sql = "ALTER TABLE   " . $xoopsDB->prefix('smallworld_complaints') . " CHANGE `complaint_id` `complaint_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
124
	CHANGE `link` `link` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
125
	CHANGE `byuser_id` `byuser_id` INT(11) NULL, 
126
	CHANGE `owner` `owner` INT(11) NULL; ";
127
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
128
}
129
130
function smallworld_followersDefaultNull()
131
{	
132
	global $xoopsDB;
133
	$sql = "ALTER TABLE   " . $xoopsDB->prefix('smallworld_followers') . " CHANGE `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
134
	CHANGE `me` `me` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
135
	CHANGE `you` `you` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
136
	CHANGE `status` `status` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
137
	CHANGE `date` `date` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
138
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
139
} 
140
141
function smallworld_friendsDefaultNull()
142
{	
143
	global $xoopsDB;
144
	$sql = "ALTER TABLE   " . $xoopsDB->prefix('smallworld_friends') . " CHANGE `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
145
	CHANGE `me` `me` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
146
	CHANGE `you` `you` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
147
	CHANGE `status` `status` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
148
	CHANGE `date` `date` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
149
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
150
} 
151
152
function smallworld_imagesDefaultNull()
153
{	
154
	global $xoopsDB;
155
	$sql = "ALTER TABLE  " . $xoopsDB->prefix('smallworld_images') . " CHANGE `id` `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
156
	CHANGE `userid` `userid` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
157
	CHANGE `imgname` `imgname` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
158
	CHANGE `imgurl` `imgurl` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
159
	CHANGE `time` `time` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
160
	CHANGE `desc` `desc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
161
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
162
}  
163
164
function smallworld_messagesDefaultNull()
165
{	
166
	global $xoopsDB;
167
	$sql = "ALTER TABLE  " . $xoopsDB->prefix('smallworld_messages') . " CHANGE `msg_id` `msg_id` INT(11) NULL AUTO_INCREMENT, 
168
	CHANGE `message` `message` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
169
	CHANGE `uid_fk` `uid_fk` INT(11) NULL, 
170
	CHANGE `priv` `priv` INT(1) NOT NULL, 
171
	CHANGE `created` `created` INT(11) NULL; ";
172
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
173
} 
174
175
function smallworld_settingsDefaultNull()
176
{	
177
	global $xoopsDB;
178
	$sql = "ALTER TABLE  " . $xoopsDB->prefix('smallworld_settings') . " CHANGE `id` `id` INT(11) NULL AUTO_INCREMENT, 
179
	CHANGE `userid` `userid` INT(11) NULL, 
180
	CHANGE `value` `value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
181
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
182
}  
183
184
function smallworld_userDefaultNull()
185
{	
186
	global $xoopsDB;
187
	$sql = "ALTER TABLE  " . $xoopsDB->prefix('smallworld_user') . " CHANGE `id` `id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, 
188
	CHANGE `userimage` `userimage` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
189
	CHANGE `realname` `realname` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
190
	CHANGE `gender` `gender` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
191
	CHANGE `intingender` `intingender` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
192
	CHANGE `relationship` `relationship` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
193
	CHANGE `partner` `partner` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
194
	CHANGE `searchrelat` `searchrelat` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
195
	CHANGE `birthday` `birthday` DATE NULL, 
196
	CHANGE `birthplace` `birthplace` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
197
	CHANGE `birthplace_lat` `birthplace_lat` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
198
	CHANGE `birthplace_lng` `birthplace_lng` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
199
	CHANGE `birthplace_country` `birthplace_country` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
200
	CHANGE `politic` `politic` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
201
	CHANGE `religion` `religion` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
202
	CHANGE `emailtype` `emailtype` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
203
	CHANGE `screenname_type` `screenname_type` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
204
	CHANGE `screenname` `screenname` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
205
	CHANGE `mobile` `mobile` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
206
	CHANGE `phone` `phone` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
207
	CHANGE `adress` `adress` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
208
	CHANGE `present_city` `present_city` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
209
	CHANGE `present_lat` `present_lat` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
210
	CHANGE `present_lng` `present_lng` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
211
	CHANGE `present_country` `present_country` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
212
	CHANGE `website` `website` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
213
	CHANGE `interests` `interests` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
214
	CHANGE `music` `music` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
215
	CHANGE `tvshow` `tvshow` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
216
	CHANGE `movie` `movie` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
217
	CHANGE `books` `books` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
218
	CHANGE `aboutme` `aboutme` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
219
	CHANGE `school_type` `school_type` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
220
	CHANGE `school` `school` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
221
	CHANGE `schoolstart` `schoolstart` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
222
	CHANGE `schoolstop` `schoolstop` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
223
	CHANGE `employer` `employer` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
224
	CHANGE `position` `position` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
225
	CHANGE `jobstart` `jobstart` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
226
	CHANGE `jobstop` `jobstop` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
227
	CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
228
	CHANGE `friends` `friends` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
229
	CHANGE `followers` `followers` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
230
	CHANGE `admin_flag` `admin_flag` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;";
231
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
232
} 
233
234
function smallworld_voteDefaultNull()
235
{	
236
	global $xoopsDB;
237
	$sql = "ALTER TABLE " . $xoopsDB->prefix('smallworld_vote') . " CHANGE `vote_id` `vote_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
238
	CHANGE `msg_id` `msg_id` INT(8) UNSIGNED NULL, 
239
	CHANGE `com_id` `com_id` INT(11) NULL, 
240
	CHANGE `user_id` `user_id` INT(11) NULL, 
241
	CHANGE `owner` `owner` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL, 
242
	CHANGE `up` `up` TINYINT(3) UNSIGNED NULL, 
243
	CHANGE `down` `down` TINYINT(3) UNSIGNED NULL; ";
244
	$result = $xoopsDB->queryF($sql);
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
245
}