|
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
|
|
|
* Xoopspoll uninstall functions.php |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright:: {@link https://xoops.org/ XOOPS Project} |
|
16
|
|
|
* @license :: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
17
|
|
|
* @package :: xoopspoll |
|
18
|
|
|
* @since :: 1.40 |
|
19
|
|
|
* @author :: zyspec <[email protected]> |
|
20
|
|
|
* @param XoopsModule $module |
|
21
|
|
|
* @return bool |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
use XoopsModules\Newbb; |
|
25
|
|
|
use XoopsModules\Xoopspoll\{ |
|
26
|
|
|
Utility |
|
27
|
|
|
}; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param \XoopsModule $module |
|
31
|
|
|
* @return bool |
|
32
|
|
|
*/ |
|
33
|
|
|
function xoops_module_pre_uninstall_xoopspoll(\XoopsModule $module) |
|
|
|
|
|
|
34
|
|
|
{ |
|
35
|
|
|
/* make sure that any polls associated with xoopspoll are cleared from newbb */ |
|
36
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
|
37
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
38
|
|
|
$newbbModule = $moduleHandler->getByDirname('newbb'); |
|
39
|
|
|
$success = true; |
|
40
|
|
|
if (is_object($newbbModule) && $newbbModule->getVar('isactive')) { |
|
41
|
|
|
/** @var Newbb\TopicHandler $topicHandler */ |
|
42
|
|
|
$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
|
|
|
|
|
43
|
|
|
$criteria = new \Criteria('topic_haspoll', 0, '>'); |
|
44
|
|
|
$s1 = $topicHandler->updateAll('poll_id', 0, $criteria); // clear any polls associated with forum topic |
|
45
|
|
|
$s2 = $topicHandler->updateAll('topic_haspoll', 0, $criteria); // clear haspoll indicator in forum |
|
46
|
|
|
$success = $s1 && $s2; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
return $success; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param XoopsModule $module |
|
54
|
|
|
* @return bool |
|
55
|
|
|
*/ |
|
56
|
|
|
function xoops_module_uninstall_xoopspoll(\XoopsModule $module) |
|
|
|
|
|
|
57
|
|
|
{ |
|
58
|
|
|
/* clear the voted cookie(s) for the admin user's machine when module is uninstalled */ |
|
59
|
|
|
// xoops_load('pollUtility', 'xoopspoll'); |
|
60
|
|
|
$success = Utility::setVoteCookie('', null, time() - 3600); |
|
61
|
|
|
|
|
62
|
|
|
return $success; |
|
63
|
|
|
} |
|
64
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.