|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits of |
|
4
|
|
|
supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit |
|
6
|
|
|
authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, but |
|
9
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
/** |
|
13
|
|
|
* Module: RandomQuote |
|
14
|
|
|
* |
|
15
|
|
|
* @category Module |
|
16
|
|
|
* @package randomquote |
|
17
|
|
|
* @author XOOPS Module Development Team |
|
18
|
|
|
* @author ZySpec <[email protected]> |
|
19
|
|
|
* @copyright {@link http://xoops.org 2001-2016 XOOPS Project} |
|
20
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
21
|
|
|
* @link http://xoops.org XOOPS |
|
22
|
|
|
* @since 2.00 |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* |
|
27
|
|
|
* Prepares system prior to attempting to uninstall module |
|
28
|
|
|
* @param obj $module {@link XoopsModule} |
|
29
|
|
|
* |
|
30
|
|
|
* @return bool true if ready to uninstall, false if not |
|
31
|
|
|
*/ |
|
32
|
|
|
function xoops_module_pre_uninstall_randomquote(&$module) |
|
|
|
|
|
|
33
|
|
|
{ |
|
34
|
|
|
// Do some synchronization with tags to remove tags associated with this module |
|
35
|
|
|
|
|
36
|
|
|
$success = true; |
|
37
|
|
|
$tagModule = XoopsModule::getByDirname('tag'); |
|
38
|
|
|
if ($tagModule instanceof XoopsModule) { |
|
|
|
|
|
|
39
|
|
|
// first delete all quotes |
|
40
|
|
|
$quotesHandler = xoops_getmodulehandler('quotes', $module->dirname()); |
|
41
|
|
|
$quoteObjs = $quotesHandler->deleteAll(); |
|
|
|
|
|
|
42
|
|
|
//now 'unlink' the quote tags from Tag modules |
|
43
|
|
|
include_once $GLOBALS['xoops']->path("/modules/tag/include/functions.recon.php"); |
|
44
|
|
|
$success = tag_synchronization(); |
|
45
|
|
|
if (!$success) { |
|
46
|
|
|
xoops_loadLanguage('admin', $module->dirname()); |
|
47
|
|
|
$module->setErrors(_AM_RANDOMQUOTE_ERROR_TAG_REMOVAL); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
return $success; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* |
|
56
|
|
|
* Performs tasks required during uninstallation of the module |
|
57
|
|
|
* @param obj $module {@link XoopsModule} |
|
58
|
|
|
* |
|
59
|
|
|
* @return bool true if uninstallation successful, false if not |
|
60
|
|
|
*/ |
|
61
|
|
|
function xoops_module_uninstall_randomquote(&$module) |
|
|
|
|
|
|
62
|
|
|
{ |
|
63
|
|
|
$success = true; |
|
64
|
|
|
return $success; |
|
65
|
|
|
} |
|
66
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: