1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: |
|
18: |
|
19: | $path = dirname(dirname(dirname(__DIR__)));
|
20: | require_once $path . '/include' . '/cp_header.php';
|
21: |
|
22: | |
23: | |
24: | |
25: | |
26: |
|
27: | |
28: | |
29: | |
30: | |
31: |
|
32: | function xoops_module_update_pm(XoopsModule $module, $oldversion = null)
|
33: | {
|
34: | global $xoopsDB;
|
35: | if ($oldversion <= '1.0.0') {
|
36: |
|
37: | $sql = 'SHOW COLUMNS FROM ' . $xoopsDB->prefix('priv_msgs');
|
38: | $result = $xoopsDB->queryF($sql);
|
39: | if (!$xoopsDB->isResultSet($result)) {
|
40: | return false;
|
41: | }
|
42: |
|
43: | if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
|
44: | return true;
|
45: | } elseif ($rows == 8) {
|
46: | return $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/sql/mysql.upgrade.sql');
|
47: | } else {
|
48: | return false;
|
49: | }
|
50: | }
|
51: |
|
52: | if ($oldversion < '1.1.0') {
|
53: |
|
54: | $templateDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/';
|
55: | $template_list = array_diff(scandir($templateDirectory), array('..', '.'));
|
56: | foreach ($template_list as $k => $v) {
|
57: | $fileinfo = new SplFileInfo($templateDirectory . $v);
|
58: | if ($fileinfo->getExtension() === 'html' && $fileinfo->getFilename() !== 'index.html') {
|
59: | @unlink($templateDirectory . $v);
|
60: | }
|
61: | }
|
62: |
|
63: | xoops_load('xoopsfile');
|
64: |
|
65: | $imagesDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/images/';
|
66: | $folderHandler = XoopsFile::getHandler('folder', $imagesDirectory);
|
67: | $folderHandler->delete($imagesDirectory);
|
68: |
|
69: | $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
|
70: | $xoopsDB->queryF($sql);
|
71: | }
|
72: |
|
73: | return true;
|
74: | }
|
75: | |