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