|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @param $module |
|
5
|
|
|
* @return bool |
|
6
|
|
|
*/ |
|
7
|
|
|
function xoops_module_update_songlist(&$module): bool |
|
|
|
|
|
|
8
|
|
|
{ |
|
9
|
|
|
$sql = []; |
|
10
|
|
|
|
|
11
|
|
|
$sql[] = 'CREATE TABLE `' |
|
12
|
|
|
. $GLOBALS['xoopsDB']->prefix('songlist_voice') |
|
13
|
|
|
. "` ( `vcid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(128) DEFAULT NULL, `artists` INT(12) UNSIGNED DEFAULT '0', `albums` INT(12) UNSIGNED DEFAULT '0', `songs` INT(12) UNSIGNED DEFAULT '0', `rank` DECIMAL(10,3) UNSIGNED DEFAULT '0.000', `votes` INT(10) UNSIGNED DEFAULT '0', `created` INT(12) UNSIGNED DEFAULT '0', `updated` INT(12) UNSIGNED DEFAULT '0', PRIMARY KEY (`vcid`), KEY `SORT` (`name`(32),`rank`,`votes`,`created`)) ENGINE=InnoDB DEFAULT CHARSET=utf8"; |
|
14
|
|
|
$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `vcid` INT(12) UNSIGNED DEFAULT '0'"; |
|
15
|
|
|
$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `lyrics` `lyrics` LONGTEXT'; |
|
16
|
|
|
$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `mp3` VARCHAR(500) DEFAULT ''"; |
|
17
|
|
|
$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `traxid` `traxid` INT(4) UNSIGNED ZEROFILL DEFAULT NULL'; |
|
18
|
|
|
|
|
19
|
|
|
return xoops_module_update_vs_executesql($sql); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @param $sql |
|
24
|
|
|
* @return bool |
|
25
|
|
|
*/ |
|
26
|
|
|
function xoops_module_update_vs_executesql($sql): bool |
|
27
|
|
|
{ |
|
28
|
|
|
if (is_string($sql)) { |
|
29
|
|
|
if ($GLOBALS['xoopsDB']->queryF($sql)) { |
|
30
|
|
|
xoops_error($sql, 'SQL Executed Successfully!!!'); |
|
31
|
|
|
} |
|
32
|
|
|
} elseif (is_array($sql)) { |
|
33
|
|
|
foreach ($sql as $id => $question) { |
|
34
|
|
|
if (is_array($question)) { |
|
35
|
|
|
foreach ($question as $kquestion => $questionb) { |
|
36
|
|
|
if ($GLOBALS['xoopsDB']->queryF($kquestion)) { |
|
37
|
|
|
xoops_error($kquestion, 'SQL Executed Successfully!!!'); |
|
38
|
|
|
xoops_module_update_vs_executesql($questionb); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
} elseif ($GLOBALS['xoopsDB']->queryF($id)) { |
|
42
|
|
|
xoops_error($id, 'SQL Executed Successfully!!!'); |
|
43
|
|
|
if ($GLOBALS['xoopsDB']->queryF($question)) { |
|
44
|
|
|
xoops_error($question, 'SQL Executed Successfully!!!'); |
|
45
|
|
|
} |
|
46
|
|
|
} elseif ($GLOBALS['xoopsDB']->queryF($question)) { |
|
47
|
|
|
xoops_error($question, 'SQL Executed Successfully!!!'); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
} else { |
|
51
|
|
|
return false; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return true; |
|
55
|
|
|
} |
|
56
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.