1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | /* |
||
5 | You may not change or alter any portion of this comment or credits |
||
6 | of supporting developers from this source code or any supporting source code |
||
7 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
8 | |||
9 | This program is distributed in the hope that it will be useful, |
||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
12 | */ |
||
13 | |||
14 | /** |
||
15 | * @category Module |
||
16 | * @package suico |
||
17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
18 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
19 | * @author Bruno Barthez, Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
20 | */ |
||
21 | |||
22 | use XoopsModules\Suico; |
||
23 | |||
24 | /** |
||
25 | * Prepares system prior to attempting to uninstall module |
||
26 | * @param XoopsModule $module {@link XoopsModule} |
||
27 | * |
||
28 | * @return bool true if ready to uninstall, false if not |
||
29 | */ |
||
30 | function xoops_module_pre_uninstall_suico( |
||
31 | XoopsModule $module |
||
0 ignored issues
–
show
|
|||
32 | ) { |
||
33 | // Do some synchronization if needed |
||
34 | return true; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Performs tasks required during uninstallation of the module |
||
39 | * @param XoopsModule $module {@link XoopsModule} |
||
40 | * |
||
41 | * @return bool true if uninstallation successful, false if not |
||
42 | */ |
||
43 | function xoops_module_uninstall_suico( |
||
44 | XoopsModule $module |
||
45 | ) { |
||
46 | require __DIR__ . '/common.php'; |
||
47 | $moduleDirName = basename(dirname(__DIR__)); |
||
48 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
49 | $helper = Suico\Helper::getInstance(); |
||
50 | $utility = new Suico\Utility(); |
||
51 | // $configurator = new Suico\Common\Configurator(); |
||
52 | // Load language files |
||
53 | $helper->loadLanguage('admin'); |
||
54 | $helper->loadLanguage('common'); |
||
55 | $success = true; |
||
56 | //------------------------------------------------------------------ |
||
57 | // Remove uploads folder (and all subfolders) if they exist |
||
58 | //------------------------------------------------------------------ |
||
59 | $old_directories = [ |
||
60 | $GLOBALS['xoops']->path("uploads/{$moduleDirName}"), |
||
61 | ]; |
||
62 | foreach ($old_directories as $old_dir) { |
||
63 | $dirInfo = new SplFileInfo($old_dir); |
||
64 | if ($dirInfo->isDir()) { |
||
65 | // The directory exists so delete it |
||
66 | if (!$utility::rrmdir($old_dir)) { |
||
67 | $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); |
||
68 | $success = false; |
||
69 | } |
||
70 | } |
||
71 | unset($dirInfo); |
||
72 | } |
||
73 | /* |
||
74 | //------------ START ---------------- |
||
75 | //------------------------------------------------------------------ |
||
76 | // Remove xsitemap.xml from XOOPS root folder if it exists |
||
77 | //------------------------------------------------------------------ |
||
78 | $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); |
||
79 | if (is_file($xmlfile)) { |
||
80 | if (false === ($delOk = unlink($xmlfile))) { |
||
81 | $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE'), $xmlfile)); |
||
82 | } |
||
83 | } |
||
84 | // return $success && $delOk; // use this if you're using this routine |
||
85 | */ |
||
86 | return $success; |
||
87 | //------------ END ---------------- |
||
88 | } |
||
89 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.