Page 1 of 1

Delete folder while running update

Posted: Thu Jul 24, 2025 2:24 pm
by musicscore
Hey ther again.

I'm almost finished versie 0.3 of my module and are change the methode.upgrade.php.
With this php file I want to delete a complete folder (including the files in that folder).
Seaching the internet I found this code :

Code: Select all

	// delete jquery directory
		$dir = "/modules/IwPopupManager/jquery";
		if (!empty($dir)) { 
			array_map('unlink', array_filter((array) array_merge(glob("$dir/*"))));
		}
		rmdir($dir);
So I modified the methode.upgrade.php file and tested the upgrade :
  • Installed versie 0.1
  • Copied versie 0.3 using ftp
  • Did the upgrade in the cmsms console
Everything worked except the deletion of the folder.

Please advise how to delete the folder while upgrading the module.

T.I.A. again.

Re: Delete folder while running update

Posted: Fri Jul 25, 2025 10:02 am
by musicscore
I checked the Gallery module (methode.upgrade.php) and found @unlink command.
Put this code in my methode.upgrade.php without any luck :

Code: Select all

@unlink("/modules/IwPopupManager/jquery/popup.js");
@rmdir('/modules/IwPopupManager/jquery');
Please advise. If this is solved I can upload the new version of my module (version 0.3)

T.I.A.