But, for many reasons we may have to uninstall a MOD (as if you discover just after the installation that it doesn't work correctly on your forums).
And in this case, 2 possibilities:
1. either it's the last MOD you've installed or no file that the MOD has modified has been modified again by another MOD since its installation, and it will be easy to restore the backup files,
2. or it's not the last MOD installed and other MODs have already modified the same files, and it will be more complex to uninstall.
Of course the 1st case is much more easy to solve than the second one.
And that's why EM 0.3.0 has introduced its first uninstallation features by starting to support this 1st case.
But what must we do to uninstall a MOD?
1. Restore the backups of modified files
2. Restore the backups of replaced files
3. Restore the DB as it was before the modifications
4. (for EM only) remove the MOD from the MOD history
EM 0.3.0 support the 1st & 4th task.
The 2nd one (rare I agree) could be easily added.
But the 3rd one is much more sensitive.
IMO, 3 theoretical possibilities:
1. Always backup the DB before installing a MOD, and restore it if needed
-> IMO, this is NOT realistic. Some of you have too large DB and it's not possible to ask to backup it for any MOD installation.
2. Deduce the reverse instructions of the SQL queries and apply them
-> OK, but it will not be so easy to build a tool able to translate SQL queries in reverse SAFE(!) instructions
3. Simply apply reverse instructions provide by the MOD author and controlled during the phpBB MOD validation
And this is my suggest:
Regardless EM, upgrade the phpBB MOD template by replacing the [ SQL ] action, by 2 [ SQL INSTALL ] & [ SQL UNINSTALL ] actions!
If a MOD need to modify the phpBB DB, it should always be provided with [ SQL INSTALL ] & [ SQL UNINSTALL ] instructions (in the MOD template).
Then, in step 2, very easy instructions (in the MOD template or in a small how-to) should advise to always backup modified and replaced files pior to install a MOD, to be able to restore all these files and uninstall easily the DB modifications (eventually improve this advise...)
Like that, MODs installed by hand could easily be uninstalled (a simple how-to could explain it), and EM could easily complete it's 1st uninstall functionality to be able to fully uninstall MODs.##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
Sounds interesting?
P.S. 1: Example for one of my MODs (Advanced time management)...
Code: Select all
#
#-----[ SQL INSTALL ]-------------------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_time_mode', '6');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dst_time_lag', '60');
ALTER TABLE phpbb_users ADD user_time_mode TINYINT not null DEFAULT '6';
ALTER TABLE phpbb_users ADD user_dst_time_lag TINYINT not null DEFAULT '60';
ALTER TABLE phpbb_users ADD user_pc_timeOffsets VARCHAR(11) not null DEFAULT '0';
#
#-----[ SQL UNINSTALL ]-----------------------------------------------
#
DELETE FROM phpbb_config WHERE config_name='default_time_mode' LIMIT 1;
DELETE FROM phpbb_config WHERE config_name='default_dst_time_lag' LIMIT 1;
ALTER TABLE phpbb_users DROP user_time_mode;
ALTER TABLE phpbb_users DROP user_dst_time_lag;
ALTER TABLE phpbb_users DROP user_pc_timeOffsets;
P.S. 2: For EM, a reliable uninstall feature like this one could allow to uninstall every installed MOD by uninstalling the last MODs in the reverse installation order until the MOD we want to uninstalled is actually uninstalled. And then re-install the other ones.