Is it possible to upgrade mod without manually uninstalling it ?

Started by Karmasterrr, June 22, 2021, 10:26:36 AM

Previous topic - Next topic

Karmasterrr

I have mod and pretty active forum and I want to upgrade my mod immediately.
Right now I can't to that, because I need to uninstall previous version of mod and this creates pause and frustrates users  :'(

Is it possible to make this without pause ? Like that:
1) upload new mod archive
2) click install, it shows that there is previous version installed, shows status of uninstall and future install and probable errors
3) click upgrade, it uninstalls previous version and installs new version in one click

@rjen

That really depends on the mod in question and how it is coded...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Aleksi "Lex" Kilpinen

It is possible, everything is possible. But the more you try to do at once, the more you risk of getting errors and causing more issues. In most cases I would just do it like this if I wanted to be fast.
1) Check that the old version uninstalls cleanly, but do not uninstall it yet.
2) If the old version does uninstall cleanly, upload the new version through the package manager, but do not install yet.
3) Make a backup of everything.
4) Uninstall the old version, and immediately after install the new version and hope you don't run in to any issues installing.
In an ideal situation, this will cause an interruption of a second or two in the operation of said mod - not much more.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Illori

You can also put the forum in maintenance mode and uninstall and reinstall the mod then take it out of maintenance mode.

The users will not have access to the forum to complain if the feature is missing.

Karmasterrr

Are you guys sure that this basic feature is not yet implemented in SMF ?  ???

Aleksi "Lex" Kilpinen

Quote from: Karmaster on June 22, 2021, 11:13:55 AM
Are you guys sure that this basic feature is not yet implemented in SMF ?  ???
No, that is not what we said.
There are mods that can do this, and then there are mods that will likely absolutely break if you try.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Kindred

This is not a "feature" or "lack of feature" in SMF at all.

SMF *CAN* handle a mod upgrade.

the issue is with the MOD coding.

If the mod author has designed, coded and indicated (in the code and XML) an upgrade path, then the mod may be able to be upgraded in place.

Most mod authors don't do this.
Most mod authors just use the easy --  uninstall the old version, then install the new version -- as an upgrade path.

If you have a question about a SPECIFIC mod, then ask in the mod support thread  perhaps the mod author has made an upgrade path or perhpas the author would be willing to do so...   but if not, then you'll have to either code the upgrade yourself or accept the small amount of down-time needed to do the upgrade of the mod. (could be as little as 30 seconds, depending on the mod)
Сл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."

Karmasterrr


shawnb61

Quote from: Karmaster on June 22, 2021, 01:47:29 PM
@Kindred I am my mod developer, what is upgrade path ?

You can read the basics here:
https://wiki.simplemachines.org/smf/Category:Package_SDK

E.g.:
Quote<install></install>, <upgrade></upgrade>, and <uninstall></uninstall>
    Actions taken on installation. The elements and their attributes are the same for the install, upgrade, and uninstall elements.

For me, it helps to look at an example of a mod that allows upgrades, e.g., SAVE:
https://custom.simplemachines.org/mods/index.php?mod=2681

Likely much easier to think thru if you are using hooks, & for upgrades where you only need to copy the new versions of *your* files over.



Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Karmasterrr

If I understood it right, "upgrade path" is waste of time and efforts ..

Karmasterrr

Quote from: Aleksi "Lex" Kilpinen on June 22, 2021, 11:05:48 AM
It is possible, everything is possible. But the more you try to do at once, the more you risk of getting errors and causing more issues.
No risk at all, not more than doing it manually. It is even less risk, because prevents miss-click errors, wrong file uploads etc etc..

GL700Wing

I manage several active forums that each have lots of mods (ie, +100) installed plus quite a bit of code customisation so minimising downtime for mod updates can be challenging - especially when it is not possible to simply uninstall the previous version of a mod due to conflicts with other code changes (eg, other mods or custom code).

The approach I've taken for many years to literally reduce downtime of the production forum to less than a minute is a follows:
1.  Create a test forum by taking a full copy of the production forum (ie, database and forum files) and, if the test database is large and/or there are a large number of attachments, prune the database to reduce its size and the number of attachments.
2.  Put the test forum into maintenance mode and create a pre-update backup copy of the essential files in the test forum (ie, the files in the forum home directory and the Sources and Themes directories).
3.   Work through the process of applying the mod update - depending on code conflicts this may take anywhere from a few minutes to a few days.  Make sure to note if you had to make manual changes for the mod to any of the files in the forum home directory (eg, SSI.php, Settings.php, index.php, etc).
4.  Test, test and re-test the mod update and any required manual code changes on your test forum to ensure everything works as expected/required.
5.  If the unlikely event you had to manually make changes to the Settings.php file in the test forum home directory make a copy of the Settings.php file in the production forum home directory and update that copy as required to work with the updated mod that you are planning to install.
6.  Create a post-update backup copy of the essential files in the test forum (ie, the files in the forum home directory and the Sources and Themes directories).

When you are certain the test forum has been fully and successfully upgraded you can upgrade the production forum as follows:
1.  Put the production forum into maintenance mode and create a pre-update backup copy of the essential files in the production forum (ie, the files in the forum home directory and the Sources and Themes directories).
2.  Apply the mod update (ie, remove the previous version and install the new version) ignoring all errors. Note: this may leave your production forum unusable.
3. Starting in the test forum home directory, and with the exception of Settings.php, copy the required files from the home directory and the Sources and Themes directories to the production forum.
4.  If necessary, change to the production forum home directory and copy the updated Settings.php into place.
5.  Create a post-update backup copy of the essential files in the production forum (ie, the files in the forum home directory and the Sources and Themes directories).
6.  Take the production forum out of maintenance mode.

Also, and once I've created the initial test forum, I've found that I can use the same test database for future mod updates - all I have to do is copy the the required files from the production forum home directory and the Sources and Themes directories to the test forum before starting the mod update process again.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

shawnb61

Quote from: Karmaster on June 22, 2021, 06:14:59 PM
If I understood it right, "upgrade path" is waste of time and efforts ..

I think that depends on how your mod is coded, & the nature of the changes.  If your mod is 100% updates to core SMF files, then the upgrade is basically an uninstall & install anyway.  Probably not worth it.  OTOH...  If you can structure your code so it is mostly in standalone files specific to your mod, and your updates can be limited to those standalone files only, then performing an upgrade is simply copying the new mod-specific files over.  In this case, the upgrade is very fast & easy with virtually zero downtime.  E.g., a 100% hooks-based mod may need no file operations.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Karmasterrr

Quote from: GL700Wing on June 22, 2021, 08:36:59 PM
I manage several active forums that each have lots of mods (ie, +100) installed plus...
Your upgrade plan is good, but not related to my question.
I just want Wordpress-like upgrade tool to uninstall/install single mod in one click, when there are no conflicts.

Quote from: shawnb61 on June 22, 2021, 09:05:58 PM
I think that depends on how your mod is coded, & the nature of the changes.
...yes, and checking and tracking what have changed ... "requires time and efforts"  ;D

live627

You can use source control to  establish a history of  your code and then automate finding differences in  revisions. Or use the diff command




The mod upgrade can also be used as a shortcut to combine uninstall  and reinstall. Perfectly legal—the package manager doesn't care. I believe the same tags can be used in  <upgrade> as in <install>.

landyvlad

Quote from: Karmaster on June 23, 2021, 03:14:55 AM
I just want Wordpress-like upgrade tool to uninstall/install single mod in one click, when there are no conflicts.
Well SMF is not wordpress and does not operate like wordpress.

The problem isn't with SMF. You need to alter your expectations.
 
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Kindred

Actually, smf does exactly that....  if the mod author has properly written the mod.
Сл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."

Aleksi "Lex" Kilpinen

Whereas Wordpress actually doesn't necessarily do that. WP tends to just overwrite complete files.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Kindred

Quote from: Aleksi "Lex" Kilpinen on June 25, 2021, 08:01:12 AM
Whereas Wordpress actually doesn't necessarily do that. WP tends to just overwrite complete files.


oh yeah -- and with the automatic update to plugins in the current WP, it's incredibly frustrating to do a custom hack to a plug in and forget to make a back -- and then have the hack erased by the next upgrade!




but, anyway Karmaster --   SMF handles updates to mods quite well.
The fact that YOU, as a mod author, don't want to take advantage of the design illustrates a problem with mod authors, not the core product. :P
Сл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."

Advertisement: