Advertisement:

Author Topic: [Ticket] Modules Uninstall Conflicts  (Read 5217 times)

Offline tmarques

  • Semi-Newbie
  • *
  • Posts: 38
[Ticket] Modules Uninstall Conflicts
« on: December 03, 2010, 02:38:09 PM »
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

Offline Kindred

  • The Mean One
  • Project Manager
  • SMF Master
  • *
  • Posts: 39,658
  • Gender: Male
  • Red Sox WIN!
    • wagner999 on Facebook
    • Kindred-999 on GitHub
    • www.linkedin.com/in/wdwagner/ on LinkedIn
    • @Kindred_999 on Twitter
Re: Modules Uninstall Conflicts
« Reply #1 on: December 03, 2010, 02:38:09 PM »
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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Norv

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 18,314
  • Blue Wolf
Re: [Ticket] Modules Uninstall Conflicts
« Reply #2 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.

About:
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

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 16,359
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: [Ticket] Modules Uninstall Conflicts
« Reply #3 on: December 03, 2010, 07:45:14 PM »
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 - Take your forum to the next level built for SMF, Gallery,Store,Classfieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - Portal System for SMF
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline tmarques

  • Semi-Newbie
  • *
  • Posts: 38
Re: [Ticket] Modules Uninstall Conflicts
« Reply #4 on: December 05, 2010, 06:56:43 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:
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.

Offline Illori

  • Doc Coordinator
  • SMF Master
  • *
  • Posts: 35,821
Re: [Ticket] Modules Uninstall Conflicts
« Reply #5 on: November 18, 2011, 08:06:16 AM »
Norv is this something we are still looking into?

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: [Ticket] Modules Uninstall Conflicts
« Reply #6 on: February 29, 2012, 04:13:45 PM »
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.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: [Ticket] Modules Uninstall Conflicts
« Reply #7 on: March 10, 2012, 04:37:51 PM »
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.

Offline Nibogo

  • SMF Hero
  • ******
  • Posts: 6,531
  • Gender: Male
    • smfpacks on Facebook
    • @smfpacks on Twitter
    • SMFPacks
Re: [Ticket] Modules Uninstall Conflicts
« Reply #8 on: March 11, 2012, 08:24:55 PM »
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

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: [Ticket] Modules Uninstall Conflicts
« Reply #9 on: March 12, 2012, 06:41:07 AM »
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.


Offline

  • SMF Friend
  • SMF Legend
  • *
  • Posts: 60,734
Re: [Ticket] Modules Uninstall Conflicts
« Reply #11 on: December 25, 2013, 09:27:37 PM »
And the minute anyone does a manual edit anywhere to get a mod installed, all this falls apart. Sorry but not practical.
Payin' anything to roll the dice, just one more time
Some will win, some will lose, some were born to sing the blues
Oh the movie never ends
It goes on and on and on and on