Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- replaced Common/XoopsConfirm by Common/Confirm(mamba/goffy)
- table renaming in fieldelements (goffy)
- added new fieldelements integer/float (goffy)
- uninstall with bak-file creation (mamba/goffy)

<h5>3.5.1 Beta 1 [NOT RELEASED]</h5> Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4
- semantic versioning (mamba)
Expand Down
24 changes: 10 additions & 14 deletions files/commonfiles/include/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,23 @@ function xoops_module_uninstall_modulebuilder(\XoopsModule $module)

$helper = Modulebuilder\Helper::getInstance();

$utility = new Modulebuilder\Utility();

$success = true;
$helper->loadLanguage('admin');

//------------------------------------------------------------------
// Remove uploads folder (and all subfolders) if they exist
// Rename uploads folder to BAK and add date to name
//------------------------------------------------------------------

$old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")];
foreach ($old_directories as $old_dir) {
$dirInfo = new \SplFileInfo($old_dir);
if ($dirInfo->isDir()) {
// The directory exists so delete it
if (!$utility::rrmdir($old_dir)) {
$module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir));
$success = false;
}
$uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName");
$dirInfo = new \SplFileInfo($uploadDirectory);
if ($dirInfo->isDir()) {
// The directory exists so rename it
$date = date('Y-m-d');
if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) {
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory));
$success = false;
}
unset($dirInfo);
}
unset($dirInfo);
/*
//------------ START ----------------
//------------------------------------------------------------------
Expand Down