1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* uninstall.php - cleanup on module uninstall |
4
|
|
|
* |
5
|
|
|
* @author XOOPS Module Development Team |
6
|
|
|
* @copyright {@link https://xoops.org 2001-2016 XOOPS Project} |
7
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
8
|
|
|
* @link https://xoops.org XOOPS |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
use XoopsModules\Oledrion; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Prepares system prior to attempting to uninstall module |
15
|
|
|
* @param \XoopsModule $module {@link XoopsModule} |
16
|
|
|
* |
17
|
|
|
* @return bool true if ready to uninstall, false if not |
18
|
|
|
*/ |
19
|
|
|
function xoops_module_pre_uninstall_oledrion(\XoopsModule $module) |
|
|
|
|
20
|
|
|
{ |
21
|
|
|
// Do some synchronization if needed |
22
|
|
|
return true; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Performs tasks required during uninstallation of the module |
27
|
|
|
* @param \XoopsModule $module {@link XoopsModule} |
28
|
|
|
* |
29
|
|
|
* @return bool true if uninstallation successful, false if not |
30
|
|
|
*/ |
31
|
|
|
function xoops_module_uninstall_oledrion(\XoopsModule $module) |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
34
|
|
|
|
35
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
36
|
|
|
$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName |
|
|
|
|
37
|
|
|
/** @var Oledrion\Helper $helper */ |
38
|
|
|
/** @var Oledrion\Utility $utility */ |
39
|
|
|
$helper = Oledrion\Helper::getInstance(); |
40
|
|
|
$utility = new Oledrion\Utility(); |
|
|
|
|
41
|
|
|
// $configurator = new Oledrion\Common\Configurator(); |
42
|
|
|
|
43
|
|
|
// Load language files |
44
|
|
|
$helper->loadLanguage('admin'); |
45
|
|
|
$helper->loadLanguage('common'); |
46
|
|
|
$success = true; |
47
|
|
|
|
48
|
|
|
//------------------------------------------------------------------ |
49
|
|
|
// Remove uploads folder (and all subfolders) if they exist |
50
|
|
|
//------------------------------------------------------------------ |
51
|
|
|
/* |
52
|
|
|
$old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; |
53
|
|
|
foreach ($old_directories as $old_dir) { |
54
|
|
|
$dirInfo = new \SplFileInfo($old_dir); |
55
|
|
|
if ($dirInfo->isDir()) { |
56
|
|
|
// The directory exists so delete it |
57
|
|
|
if (false === $utility::rrmdir($old_dir)) { |
58
|
|
|
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); |
59
|
|
|
$success = false; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
unset($dirInfo); |
63
|
|
|
} |
64
|
|
|
*/ |
65
|
|
|
|
66
|
|
|
/* |
67
|
|
|
//------------ START ---------------- |
68
|
|
|
//------------------------------------------------------------------ |
69
|
|
|
// Remove xsitemap.xml from XOOPS root folder if it exists |
70
|
|
|
//------------------------------------------------------------------ |
71
|
|
|
$xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); |
72
|
|
|
if (is_file($xmlfile)) { |
73
|
|
|
if (false === ($delOk = unlink($xmlfile))) { |
74
|
|
|
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE'), $xmlfile)); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
// return $success && $delOk; // use this if you're using this routine |
78
|
|
|
*/ |
79
|
|
|
|
80
|
|
|
return $success; |
81
|
|
|
//------------ END ---------------- |
82
|
|
|
} |
83
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.