|
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
|
|
|
* Mymenus module |
|
13
|
|
|
* |
|
14
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
15
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
16
|
|
|
* @package mymenus |
|
17
|
|
|
* @since 1.5 |
|
18
|
|
|
* @author Xoops Development Team |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
use XoopsModules\Mymenus; |
|
22
|
|
|
|
|
23
|
|
|
defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
24
|
|
|
|
|
25
|
|
|
//$moduleDirname = basename(dirname(__DIR__)); |
|
26
|
|
|
//require(XOOPS_ROOT_PATH . "/modules/$moduleDirname/include/common.php"); |
|
27
|
|
|
require __DIR__ . '/common.php'; |
|
28
|
|
|
$helper = Mymenus\Helper::getInstance($debug); |
|
29
|
|
|
|
|
30
|
|
|
xoops_loadLanguage('admin', $helper->getDirname()); |
|
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param object|\XoopsObject $xoopsModule |
|
34
|
|
|
* @param int $previousVersion |
|
35
|
|
|
* @return bool FALSE if failed |
|
36
|
|
|
*/ |
|
37
|
|
|
function xoops_module_update_mymenus(\XoopsObject $xoopsModule, $previousVersion) |
|
|
|
|
|
|
38
|
|
|
{ |
|
39
|
|
|
if ($previousVersion < 151) { |
|
40
|
|
|
//if (!checkInfoTemplates($xoopsModule)) return false; |
|
41
|
|
|
if (!Mymenus\Updater::checkInfoTable($xoopsModule)) { |
|
42
|
|
|
return false; |
|
43
|
|
|
} |
|
44
|
|
|
//update_tables_to_150($xoopsModule); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
return true; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
if (!function_exists('InfoColumnExists')) { |
|
52
|
|
|
/** |
|
53
|
|
|
* @param $tablename |
|
54
|
|
|
* @param $spalte |
|
55
|
|
|
* |
|
56
|
|
|
* @return bool |
|
57
|
|
|
*/ |
|
58
|
|
|
function InfoColumnExists($tablename, $spalte) |
|
59
|
|
|
{ |
|
60
|
|
|
if ('' === $tablename || '' === $spalte) { |
|
61
|
|
|
return true; |
|
62
|
|
|
} // Fehler!! |
|
63
|
|
|
$result = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM ' . $tablename . " LIKE '" . $spalte . "'"); |
|
64
|
|
|
$ret = $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
|
65
|
|
|
|
|
66
|
|
|
return $ret; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
if (!function_exists('InfoTableExists')) { |
|
71
|
|
|
/** |
|
72
|
|
|
* @param $tablename |
|
73
|
|
|
* |
|
74
|
|
|
* @return bool |
|
75
|
|
|
*/ |
|
76
|
|
|
function InfoTableExists($tablename) |
|
77
|
|
|
{ |
|
78
|
|
|
$result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); |
|
79
|
|
|
$ret = $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
|
80
|
|
|
|
|
81
|
|
|
return $ret; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|