FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

Add the option of uninstall for the plugin command. #176

Closed abgreeve closed 5 years ago

abgreeve commented 5 years ago

This will remove the directory and files as well.

FMCorz commented 5 years ago

Thanks Adrian.

Does the core CLI try to delete the files as would the web interface? If yes, I would suggest to prevent this from happening unless a specific flag was set. For example, if I uninstall my plugin to try to install it again, I wouldn't be expecting my files to be deleted from the system.

The same goes with this line:

PluginManager.deleteDirectoryTree(po, M)

I would only perform this if core doesn't do it, and a flag was specifically set to instruct the command to completely delete the folder.

If we don't delete the files, we also don't want to upgrade Moodle as soon as the uninstall has completed, to avoid the plugin from re-installing itself.

Thanks!

abgreeve commented 5 years ago

Thanks Fred, I have to admit that I only thought about how I would use this feature. I have now added a flag to remove the files and folders. By default it will just uninstall the plugin, but leave files and folders intact. I also moved the upgrade so that the plugin does not immediately get re-installed.

FMCorz commented 5 years ago

Thanks! I added a commit to allow upgrading when files weren't removed, although a message states that the plugin will re-install itself. I also raised the IndexError exception when the CLI's result parsing fails.