|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Upgrader from 2.3.0 to 2.3.1 |
|
14
|
|
|
* See the enclosed file license.txt for licensing information. |
|
15
|
|
|
* If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html |
|
16
|
|
|
* |
|
17
|
|
|
* @copyright The XOOPS project http://www.xoops.org/ |
|
18
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL) |
|
19
|
|
|
* @package upgrader |
|
20
|
|
|
* @since 2.3.0 |
|
21
|
|
|
* @author Taiwen Jiang <[email protected]> |
|
22
|
|
|
* @version $Id$ |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
class upgrade_231 extends xoopsUpgrade |
|
26
|
|
|
{ |
|
27
|
|
|
public $tasks = array('field'); |
|
28
|
|
|
|
|
29
|
|
|
public function __construct() |
|
30
|
|
|
{ |
|
31
|
|
|
xoopsUpgrade::__construct(basename(__DIR__)); |
|
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Check if field type already fixed for mysql strict mode |
|
36
|
|
|
|
|
37
|
|
|
*/ |
|
38
|
|
|
public function check_field() |
|
39
|
|
|
{ |
|
40
|
|
|
$xoops = Xoops::getInstance(); |
|
41
|
|
|
$db = $xoops->db(); |
|
42
|
|
|
$fields = array( |
|
43
|
|
|
"cache_data" => "cache_model", "htmlcode" => "banner", "extrainfo" => "bannerclient", |
|
44
|
|
|
"com_text" => "xoopscomments", "conf_value" => "config", "description" => "groups", |
|
45
|
|
|
"imgsetimg_body" => "imgsetimg", "content" => "newblocks", "msg_text" => "priv_msgs", |
|
46
|
|
|
"sess_data" => "session", "tplset_credits" => "tplset", "tpl_source" => "tplsource", |
|
47
|
|
|
"user_sig" => "users", "bio" => "users", |
|
48
|
|
|
); |
|
49
|
|
|
foreach ($fields as $field => $table) { |
|
50
|
|
|
$sql = "SHOW COLUMNS FROM `" . $db->prefix($table) . "` LIKE '{$field}'"; |
|
51
|
|
|
if (!$result = $db->queryF($sql)) { |
|
|
|
|
|
|
52
|
|
|
return false; |
|
53
|
|
|
} |
|
54
|
|
|
while ($row = $db->fetchArray($result)) { |
|
55
|
|
|
if ($row['Field'] != $field) { |
|
56
|
|
|
continue; |
|
57
|
|
|
} |
|
58
|
|
|
if (strtoupper($row['Null']) != "YES") { |
|
59
|
|
|
return false; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
return true; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function apply_field() |
|
67
|
|
|
{ |
|
68
|
|
|
$xoops = Xoops::getInstance(); |
|
69
|
|
|
$db = $xoops->db(); |
|
70
|
|
|
$allowWebChanges = $db->allowWebChanges; |
|
|
|
|
|
|
71
|
|
|
$db->allowWebChanges = true; |
|
72
|
|
|
$result = $db->queryFromFile(__DIR__ . "/mysql.structure.sql"); |
|
73
|
|
|
$db->allowWebChanges = $allowWebChanges; |
|
74
|
|
|
return $result; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
$upg = new upgrade_231(); |
|
79
|
|
|
return $upg; |
|
80
|
|
|
|