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\Wggithub; |
||
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_wggithub(\XoopsModule $module) |
||
0 ignored issues
–
show
|
|||
20 | { |
||
21 | // Do some synchronization |
||
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_wggithub(\XoopsModule $module) |
||
32 | { |
||
33 | // return true; |
||
34 | |||
35 | $moduleDirName = \basename(\dirname(__DIR__)); |
||
36 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
||
37 | |||
38 | $helper = Wggithub\Helper::getInstance(); |
||
39 | |||
40 | $success = true; |
||
41 | $helper->loadLanguage('admin'); |
||
42 | |||
43 | //------------------------------------------------------------------ |
||
44 | // Rename uploads folder to BAK and add date to name |
||
45 | //------------------------------------------------------------------ |
||
46 | $uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName"); |
||
47 | $dirInfo = new \SplFileInfo($uploadDirectory); |
||
48 | if ($dirInfo->isDir()) { |
||
49 | // The directory exists so rename it |
||
50 | $date = date('Y-m-d'); |
||
51 | if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) { |
||
52 | $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory)); |
||
53 | $success = false; |
||
54 | } |
||
55 | } |
||
56 | unset($dirInfo); |
||
57 | /* |
||
58 | //------------ START ---------------- |
||
59 | //------------------------------------------------------------------ |
||
60 | // Remove xsitemap.xml from XOOPS root folder if it exists |
||
61 | //------------------------------------------------------------------ |
||
62 | $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); |
||
63 | if (\is_file($xmlfile)) { |
||
64 | if (false === ($delOk = \unlink($xmlfile))) { |
||
65 | $module->setErrors(\sprintf(\_AM_WGGITHUB_ERROR_BAD_REMOVE, $xmlfile)); |
||
66 | } |
||
67 | } |
||
68 | // return $success && $delOk; // use this if you're using this routine |
||
69 | */ |
||
70 | |||
71 | return $success; |
||
72 | //------------ END ---------------- |
||
73 | } |
||
74 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.