Page 1 of 1
Automatic Upgrade of modules
Posted: Wed Nov 30, 2005 6:57 pm
by lemkepf
Hello Crew,
I personally can't see any reason why a module would have to be "upgraded" by clicking the little upgrade button... can someone enlighten me as to why?
Why not do an "automatic" upgrade the first time it's used?
So the question is... can anyone think of a way to do an "automatic" update of a module the first time it is used?
Thanks for the help!
Paul
Re: Automatic Upgrade of modules
Posted: Wed Nov 30, 2005 7:38 pm
by Ted
Well, I don't see any reason why automatic upgrades couldn't be done when the module is loaded at the beginning of the page display.
The only issue I could really see is that the module developer wants to display an upgrade message.
There is already a flag now that defaults to true that modules can override to turn off automatic upgrading. However, this only applies when you run the upgrade.php script. I suppose it coule work here as well...
Re: Automatic Upgrade of modules
Posted: Wed Nov 30, 2005 7:54 pm
by lemkepf
wishy wrote:
Well, I don't see any reason why automatic upgrades couldn't be done when the module is loaded at the beginning of the page display.
The only issue I could really see is that the module developer wants to display an upgrade message.
There is already a flag now that defaults to true that modules can override to turn off automatic upgrading. However, this only applies when you run the upgrade.php script. I suppose it coule work here as well...
That's the reason! I knew there was one... but... i have to thank you.

I didn't even know "function module_autoupgrade()" existed!!!
I'm working on something for my web hosting company to allow a central install of "CMS Made Simple" so they don't have to worry about the upgrades etc. The only issue is what to do about any module updates we put it. So this might solve our issue.
Here is my idea... along with the default install we'll create a php file called "upgrade_mod.php" that would have that autoupgrade function in it. Then when we do a module upgrade we can use a script or something to automatically do an "http fetch" against all the accounts that use that module so it would automatically upgrade their modules.
Or... do you think there is a better way?
Re: Automatic Upgrade of modules
Posted: Thu Dec 01, 2005 5:33 pm
by Ted
I just committed a better way.
Basically, if the module can auto upgrade itself, it will do it on the next page load. So, you could send it out to all of the installs and it'll "just work" next time a page is requested.
Re: Automatic Upgrade of modules
Posted: Thu Dec 01, 2005 6:03 pm
by lemkepf
But not all of them are? What could i do about the ones that aren't autoupgradeable?
Re: Automatic Upgrade of modules
Posted: Thu Dec 01, 2005 6:11 pm
by Ted
A module has to deliberatly opt out of auto upgrade. It returns true by default. Most likely because it involves some kind of manual action that you probably couldn't script anyway...
Re: Automatic Upgrade of modules
Posted: Thu Dec 01, 2005 6:14 pm
by lemkepf
Nice.
