Plugin Updates during Moodle Upgrade

Plugin Updates during Moodle Upgrade

by Chris Chard -
Number of replies: 7

Hi, 

I'm upgrading Moodle (3.7 >3.8) and have a bunch of plugins that I need to upgrade too. 

I've got new versions of each plugin, so compatibility is okay, but when I overwrite the existing plugin directory with the new one, will the settings for that plugin be lost?

I.e. are the custom settings for each plugin stored inside the plugin directory itself, or are they stored elsewhere and will remain in tact? 

Thanks very much in advance!

Average of ratings: -
In reply to Chris Chard

Re: Plugin Updates during Moodle Upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

One shouldn't 'over write' anything in moodle code ... core or plugin.  Like core code when one updates, current code should be archived, and a fresh code directory for plugin used.

Plugins should store their settings in the DB ... mdl_config_plugins.

Now you've said you collected all the updates to plugins?

Share with you what I do prior to upgrading core code.

1. install moosh

https://moodle.org/plugins/view.php?id=522

2. in code directory (since I use git to maintain and update code my code directory doesn't move), create a text file that list the short names of the plugins called 'addons.txt'.

Looks like:

mod_game
mod_hotpot
mod_mootyper
mod_taskchain
filter_poodll
qtype_poodllrecording
atto_poodll
atto_subtitle

3. create a bash shell script called 'checkaddons' that contains:

#!/bin/bash
#
echo 'Add-on listing: ';
cat ./addons.txt;
echo '---------------------';
for i in `cat ./addons.txt`
do
   echo "Addon in que: $i";
moosh -n plugin-list |grep $i
done

When run like ./checkaddons displays

Add-on listing:
mod_game
mod_hotpot
mod_mootyper
mod_taskchain
filter_poodll
qtype_poodllrecording
atto_poodll
atto_subtitle
---------------------
Addon in que: mod_game
mod_game,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/22090/mod_game_moodle39_2020072501.zip
Addon in que: mod_hotpot
mod_hotpot,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,https://moodle.org/plugins/download.php/21609/mod_hotpot_moodle38_2020060544.zip
Addon in que: mod_mootyper
mod_mootyper,2.2,2.3,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/21941/mod_mootyper_moodle39_2020070800.zip
Addon in que: mod_taskchain
mod_taskchain,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,https://moodle.org/plugins/download.php/21610/mod_taskchain_moodle38_2020060589.zip
Addon in que: filter_poodll
filter_poodll,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/21827/filter_poodll_moodle39_2020062400.zip
Addon in que: qtype_poodllrecording
qtype_poodllrecording,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/21745/qtype_poodllrecording_moodle39_2020061600.zip
Addon in que: atto_poodll
atto_poodll,2.6,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/19977/atto_poodll_moodle39_2019071300.zip
Addon in que: atto_subtitle
atto_subtitle,3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9,https://moodle.org/plugins/download.php/20669/atto_subtitle_moodle39_2019112101.zip

from that redirected to a 'getlist' file

./checkaddons > getlist

which would need to be edited to contain just the url to the plugins:

'getlist' looks like:

https://moodle.org/plugins/download.php/22090/mod_game_moodle39_2020072501.zip
https://moodle.org/plugins/download.php/21609/mod_hotpot_moodle38_2020060544.zip
https://moodle.org/plugins/download.php/21941/mod_mootyper_moodle39_2020070800.zip
https://moodle.org/plugins/download.php/21610/mod_taskchain_moodle38_2020060589.zip
https://moodle.org/plugins/download.php/21827/filter_poodll_moodle39_2020062400.zip
https://moodle.org/plugins/download.php/21745/qtype_poodllrecording_moodle39_2020061600.zip
https://moodle.org/plugins/download.php/19977/atto_poodll_moodle39_2019071300.zip
https://moodle.org/plugins/download.php/20669/atto_subtitle_moodle39_2019112101.zip

You might note that depending upon when one does checks on plugins, the plugin files (zips) might actually show a filename of version higher that what you are running for code.  As long as it's listed as being compatible.

4. use wget to acquire all the zips

Now you have the zips to use when upgrading those plugins ... if doing so manually.

You could let moodle get the updates to all your pluings if not doing manually.

After upgrading, go to Notifications and check for updates.

It should see plugins that need updating ... follow that link and update the plugins that way.

'SoS', Ken


In reply to Ken Task

Re: Plugin Updates during Moodle Upgrade

by Chris Chard -
First off, thanks so much for taking the time to reply Ken, I really appreciate it!

I should've explained better, I've already backed up the database and moddledata, moodle, plugins directories. Our site is firewalled off from the net, so unfortunately I can't update via git or let moodle update the plugins, otherwise that'd be my go to. Instead I'm updating everything manually via command line (linux).

I was 99% sure the plugins would save their settings to the database, and they weren't stored inside the plugin directory itself, but thank you for confirming!

Does this process sound okay to you? Backup everything, extract new moodle3.8, extract new plugins versions into the right spots, copy across old config.php, then kick off the upgrade via the browser?

Thanks again!!
In reply to Chris Chard

Re: Plugin Updates during Moodle Upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

https://docs.moodle.org/39/en/Upgrading

I'd 'kickoff' the upgrade from the command line while you are there ... takes web service out of the loop ... from within code directory

php admin/cli/cron.php

php admin/cli/maintenance.php --enable

php admin/cli/upgrade.php --non-interactive

php admin/cli/purge_caches.php

php admin/cli/maintenance.php --disable

fgrep '$release' version.php

check ownerships/permissions at this point.  Especially the files/you moved back into new code.

Would also run scripts to backup new code and DB ... filenames of the backups have mdl version and are date/time stamped.

This firewall of which you speak ... I take it the operating system
can get updates.  Must be a real pain when needing to upgrade PHP or MySQL/MariaDB.   Uhhh ... that's a check you should do before pulling trigger on any update of core code.

'SoS', Ken

In reply to Ken Task

Re: Plugin Updates during Moodle Upgrade

by Chris Chard -
Amazing thanks, I ended up finishing the upgrade via the browser last night, but next time I'll definitly do it from the command line — thanks for the steps Ken!

Yeah it's a pain but our IT team manages internal repos for updates to php, etc. We're currently working towards changing our instance of moodle to be public though, at that point everything will become much easier for updates!

Thanks again!
In reply to Chris Chard

Re: Plugin Updates during Moodle Upgrade

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

You wrote:
> Our site is firewalled off from the net, so unfortunately I can't update via git or let moodle update the plugins, otherwise that'd be my go to. Instead I'm updating everything manually via command line (linux).

How does the command line reach the code repositories, if your machine is behind a firewall? Is there a proxy in which your machine/protocol is white-listed, for example? Could you explain?
In reply to Visvanath Ratnaweera

Re: Plugin Updates during Moodle Upgrade

by Chris Chard -
I wasn't pulling the moodle update from the repo via the server, I downloaded locally, then ftp'd the zip to the server, then continued via command line on the server for everything else. It's far from ideal, but we're working towards changing our instance of moodle to be public, so at that point everything, inc updates, will become much easier!

Thanks for replying, apprecite your help!
In reply to Chris Chard

Re: Plugin Updates during Moodle Upgrade

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ha, ha! A proxy on foot? A laptop crosses the firewall on foot, downloads zip files, walks back in to the high-security area, uploads the zip. Well, a USB memory drive would have been enough. Anyways, something for the hard-boiled. ;)

Well, doable for Moodle core and plug-ins. What about system updates? I know a server in such an environment. There the network tarzens open and close a HTTP(S) proxy for the duration of updates/upgrades. No walking necessary. (Would have meant air travel.)