News:

Wondering if this will always be free?  See why free is better.

Main Menu

[Ticket] Modules Uninstall Conflicts

Started by tmarques, December 03, 2010, 02:38:09 PM

Previous topic - Next topic

tmarques

There's an issue with uninstalling mods that I'd like very much to see solved and to which I can lend a hand if kindly mentored to the right direction. It goes something like this:

Modules frequently overlap with other modules in the files they modify. So one applies a fix to this code:

array = (
   'var1' => 'var1p',
   'var2' => 'var2p',
   'var3' => 'var3p',
)

That looks like this:

array =(
   'var1' => 'var1p',
   'var2' => 'var2p',
   'varOLD => 'varOLDp',
   'var3' => 'var3p',
)

Then we install another mod that modifies the same section and it ends up like this:

array =(
   'var1' => 'var1p',
   'var2' => 'var2p',
   'varOLD => 'varOLDp',
   'varNEW => 'varNEWp',
   'var3' => 'var3p',
)

So the first mod will try and search for:

array =(
   'var1' => 'var1p',
   'var2' => 'var2p',
   'varOLD => 'varOLDp',
   'var3' => 'var3p',
)

To replace with:

array = (
   'var1' => 'var1p',
   'var2' => 'var2p',
   'var3' => 'var3p',
)

And won't find it. This is a problem when managing big forums with mods counting in the dozens, when there is a need to fix some module that has been installed first than say 20 other ones.
The way I do it is keep an order of the installed mods and uninstall all that were installed after module X, before uninstalling X. This sometimes means uninstalling many mods, which takes time and is prone to error.

I would like very much to see this solved in a way that if I want to uninstall module X and modules: Y1, Y2, Y3, Y4 and Y5 were installed after, SMF should uninstall all Yx modules, then the X module, then install all Yx modules again.
This would require that a list is shown before hand, since while installing and uninstalling topics one might run into problems with deleted helper files, like with Global Headers and Footers, but it allows to embedded the changes into a custom modification of said module so that it can always automatized afterwards.

Are you planning such fix, are my modules coded wrong? I'm willing to implement a solution myself and share it with you if you would be kind enough to help me on this.

Best regards,
Tiago

Kindred

Questions like this should not be posted to the helpdesk (since Devs only rarely read the helpdesk)

We have the bug reports board and SMF coding boards which are better arenas to air these sort of items.


So, as such, I am dropping this out of helpdesk and into the forum
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Norv

Another thread of interest on the same problem:
http://www.simplemachines.org/community/index.php?topic=381354.msg2631155#msg2631155

Thank you for the report.

About:
Quote from: tmarques on December 03, 2010, 02:38:09 PM
I would like very much to see this solved in a way that if I want to uninstall module X and modules: Y1, Y2, Y3, Y4 and Y5 were installed after, SMF should uninstall all Yx modules, then the X module, then install all Yx modules again.
This would require that a list is shown before hand, since while installing and uninstalling topics one might run into problems with deleted helper files, like with Global Headers and Footers, but it allows to embedded the changes into a custom modification of said module so that it can always automatized afterwards.

We don't plan to add such "smart" uninstallation as you suggest, currently. It would have problems of its own, because for example: some forums admins are very careful with security, and they might make some/most of the files unwritable, since they don't plan to uninstall Y1, Y2, Y3... SMF would fail, and not only that, but it would also do the unexpected thing (why would I expect it will keep uninstalling and installing undercover, mods I never told it to touch? and give errors about them being unwritable or unable to delete when I was trying something else; moreover the failure could be worse, in the middle of something, and finding out of the blue half-installed mods you never touched ... doesn't sound like a problem very easy to debug). Added to what you said - it may delete useful additional files. Custom modifications, too.

That said, I fully understand the problem, unfortunately I don't really think it's fully solvable with the modification system.
What would help IMHO (at least in a measure): seeing installation dates in package manager and being able to sort on them.

Just brainstorming: maybe it would help if package manager would be able, in case there are uninstallation errors, to display a list of mods previously installed, in addition to the error...?

Thoughts appreciated.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

vbgamer45

Just throwing this out there for code that is added using the add after or add before  but not replace the package manager should be able to find the original code that is added then just remove it but in the case of the replace it will still throw an error.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

tmarques

Quote from: Norv on December 03, 2010, 03:16:25 PM
Another thread of interest on the same problem:
http://www.simplemachines.org/community/index.php?topic=381354.msg2631155#msg2631155

Thank you for the report.



No problem, I'm the one thankful for you looking into it.


I'll have a more in depth look soon, for now let me answer to what I think is appropriate before further reflection.

Quote
About:
Quote from: tmarques on December 03, 2010, 02:38:09 PM
I would like very much to see this solved in a way that if I want to uninstall module X and modules: Y1, Y2, Y3, Y4 and Y5 were installed after, SMF should uninstall all Yx modules, then the X module, then install all Yx modules again.
This would require that a list is shown before hand, since while installing and uninstalling topics one might run into problems with deleted helper files, like with Global Headers and Footers, but it allows to embedded the changes into a custom modification of said module so that it can always automatized afterwards.

We don't plan to add such "smart" uninstallation as you suggest, currently. It would have problems of its own, because for example: some forums admins are very careful with security, and they might make some/most of the files unwritable, since they don't plan to uninstall Y1, Y2, Y3... SMF would fail, and not only that, but it would also do the unexpected thing (why would I expect it will keep uninstalling and installing undercover, mods I never told it to touch? and give errors about them being unwritable or unable to delete when I was trying something else; moreover the failure could be worse, in the middle of something, and finding out of the blue half-installed mods you never touched ... doesn't sound like a problem very easy to debug). Added to what you said - it may delete useful additional files. Custom modifications, too.


I know, hence mentioning that this could be a toggle option and/or it should show which mods it would uninstall AND REINSTALL, after the module that can uninstall due to conflicts is actually removed.


Say you have:


M1
M2
M3
M4
M5


Installed by the order of the numbers, and you want to remove M2. You click the uninstall button, the forum checks it should uninstall M5, M4 and M3 before going to M2 and prints a warning:


Due to conflicts, will uninstall: M3, M4, M5 and reinstall, please check configurations for these modules are ok after M2 is successfully uninstalled.


In an even better way, the modification system would only uninstall M3, M4 and M5 if it tries to remove M2 and finds that not all sections are successful. An easier way would be to check if M3, M4 and M5 change files that M2 also does but that is very coarse and M2 may not need to remove those mods prior to a successful uninstall of M2 since M2 may change other areas of the same files that don't impact any of the other mods. This is not the most common behavior, as most modules tend to touch the same sections of code.


When I started using SMF this was actually something that I found strange but since I was coding modules, I got an understanding of the problem. I believe that most people that just install and uninstall packages will not understand why they are having problems and if they go ahead with the uninstalling, they will probably break the forum(has happened to me by related errors (not forced), multiple times) or will leave it in a difficult to maintain state.


Quote
That said, I fully understand the problem, unfortunately I don't really think it's fully solvable with the modification system.
What would help IMHO (at least in a measure): seeing installation dates in package manager and being able to sort on them.

Just brainstorming: maybe it would help if package manager would be able, in case there are uninstallation errors, to display a list of mods previously installed, in addition to the error...?

Thoughts appreciated.



Yes, that would actually also be very helpful. The problem is having to uninstall them by hand increases maintenance times for upgrades, so I suggest having the optional automatic system but what you propose is a very good improvement to what is currently available and would also help other users that don't understand the problem to fix their forums in relatively easy way.
I understand this is a difficult problem to tackle, hence saying that I would be fully available to help with it.

Illori

Norv is this something we are still looking into?

emanuele

The "installed packages" list should already be sorted by install time (that is the list I use to do exactly that).

Another temporary (probably easy to implement) solution could be to provide a list of mods installed after the one you are trying to uninstall just below the warning.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

Something like the attached patch for example.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Nibogo

Emanuele I like your idea; however, it could be even better, I ain't sure about this but if we've modified files in database we could check which mods modified the same files that are throwing errors, that could be pretty useful, but it would demand a little bit more code which shouldn't be that bad

emanuele

That would be cool too.
At the moment the files modified are saved into the database, it would need a new column, though.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.


Arantor

And the minute anyone does a manual edit anywhere to get a mod installed, all this falls apart. Sorry but not practical.

Advertisement: