Delete folder while running update

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
musicscore
Power Poster
Power Poster
Posts: 491
Joined: Wed Jan 25, 2006 11:53 am

Delete folder while running update

Post 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.
musicscore
Power Poster
Power Poster
Posts: 491
Joined: Wed Jan 25, 2006 11:53 am

Re: Delete folder while running update

Post 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.
Post Reply

Return to “Developers Discussion”