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
|
|
|
* @copyright XOOPS Project https://xoops.org/ |
14
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
15
|
|
|
* @author XOOPS Development Team |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use XoopsModules\Gbook; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* |
22
|
|
|
* Prepares system prior to attempting to install module |
23
|
|
|
* @param XoopsModule $module {@link XoopsModule} |
24
|
|
|
* |
25
|
|
|
* @return bool true if ready to install, false if not |
26
|
|
|
*/ |
27
|
|
|
function xoops_module_pre_install_gbook(\XoopsModule $module) |
28
|
|
|
{ |
29
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
30
|
|
|
/** @var Gbook\Utility $utilityClass */ |
31
|
|
|
$utilityClass = ucfirst($moduleDirName) . 'Utility'; |
32
|
|
|
if (!class_exists($utilityClass)) { |
|
|
|
|
33
|
|
|
xoops_load('utility', $moduleDirName); |
|
|
|
|
34
|
|
|
} |
35
|
|
|
//check for minimum XOOPS version |
36
|
|
|
if (!$utilityClass::checkVerXoops($module)) { |
37
|
|
|
return false; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
// check for minimum PHP version |
41
|
|
|
if (!$utilityClass::checkVerPhp($module)) { |
42
|
|
|
return false; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$mod_tables =& $module->getInfo('tables'); |
46
|
|
|
foreach ($mod_tables as $table) { |
47
|
|
|
$GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return true; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* |
55
|
|
|
* Performs tasks required during installation of the module |
56
|
|
|
* @param XoopsModule $module {@link XoopsModule} |
57
|
|
|
* |
58
|
|
|
* @return bool true if installation successful, false if not |
59
|
|
|
*/ |
60
|
|
|
function xoops_module_install_gbook(\XoopsModule $module) |
|
|
|
|
61
|
|
|
{ |
62
|
|
|
return true; |
63
|
|
|
} |
64
|
|
|
|