Nice idea! But, why stick to 'optional' plugins, it could work for core ones like mod_assign as well.
There are problems though - any type of plugin can have various callbacks that can affect any page in Moodle (for example the one that lets you insert HTML code after the header). Depending on the installation some of these things might not really be 'optional'...
It would be great if this worked though - perhaps the plugin could have a marker in version.php for whether it's OK to temporarily disable it during upgrade.
For us, we don't do plugin upgrades aside from our quarterly whole-system upgrades (well we do patches but not that require upgrade), but the approach you've suggested would also benefit the normal upgrade - probably in most upgrades a significant portion of time is spent doing plugin upgrades.
I.e. it could automatically do the plugin upgrades as a second part of upgrade, with the opportunity to turn off maintenance mode at that point. Maybe it would work best like this:
- switch on full maintenance mode
- core part of upgrade completes
- switch off full maintenance mode, switch on plugin maintenance mode for each plugin requiring upgrade
- as each plugin upgrade completes, switch off maintenance mode for that plugin
An issue with this is that plugin upgrade ordering then becomes important - for example, in our system, we use a particular course format and if that requires an upgrade, there is not too much benefit bringing the system back online if nobody can look at any courses... Similar but even worse with the theme. So you'd probably want to do theme upgrades first, then auth, course formats, blocks, then modules (and you'd probably want to consider subplugins as part of the module rather than do separate maintenance mode for each of those), then other stuff? Just off the top of my head, there are probably other ones.
Still, doing the per-plugin maintenance mode would be a nice step towards this type of improvement for the main upgrade, as well as allowing you to upgrade plugins without downtime, so basically it would be great.
--sam