xoops_module_uninstall_pedigree()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 25
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 11
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 25
rs 9.9
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 *
15
 * @package         XoopsModules\Pedigree
16
 * @author          XOOPS Development Team <https://xoops.org>
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         GPL 2.0 or later
19
 * @link            https://xoops.org/
20
 */
21
22
use XoopsModules\Pedigree\{
23
    Common\Configurator,
24
    Helper,
25
    Utility
26
};
27
28
require \dirname(__DIR__) . '/preloads/autoloader.php';
29
30
/**
31
 * Prepares system prior to attempting to uninstall module
32
 * @param \XoopsModule $module {@link XoopsModule}
33
 *
34
 * @return bool true if ready to uninstall, false if not
35
 */
36
function xoops_module_pre_uninstall_pedigree(\XoopsModule $module): bool
0 ignored issues
show
Unused Code introduced by
The parameter $module is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
function xoops_module_pre_uninstall_pedigree(/** @scrutinizer ignore-unused */ \XoopsModule $module): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
{
38
    // Do some synchronization if needed
39
    return true;
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_pedigree(\XoopsModule $module): bool
0 ignored issues
show
Unused Code introduced by
The parameter $module is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
function xoops_module_uninstall_pedigree(/** @scrutinizer ignore-unused */ \XoopsModule $module): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
{
50
    $moduleDirName      = basename(\dirname(__DIR__));
51
    $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName
0 ignored issues
show
Unused Code introduced by
The assignment to $moduleDirNameUpper is dead and can be removed.
Loading history...
52
53
    $helper       = Helper::getInstance();
54
    $configurator = new Configurator();
55
56
    //    $configurator = new Pedigree\Common\Configurator();
57
58
    // Load language files
59
    $helper->loadLanguage('admin');
60
    $helper->loadLanguage('common');
61
    $success = true;
62
63
    //------------------------------------------------------------------
64
    // Remove uploads folder (and all subfolders) if they exist
65
    //------------------------------------------------------------------
66
    if (0 < count($configurator->uploadFolders)) {
67
        foreach (array_keys($configurator->uploadFolders) as $i) {
68
            $success = $success && Utility::deleteDirectory($configurator->uploadFolders[$i]);
69
        }
70
    }
71
72
    return $success;
73
    //------------ END  ----------------
74
}
75