#2 above ...
"Moodle updates fine, but afterwards all custom plugins are missing"
Indicates you are not using git for updates/upgrades, but what I'll call the old way which required the server operator to copy back into new code directory, all the addons ... like one would do config.php.
If one has many, prone to human error ... unless one maintains a list of those plugins and their locations.
There is no utility for admin to check 'environment' ... for plugins.
Thus, I've turned to CLI and the use of moosh to help.
First, I create an 'addons.txt' file manually that contains one liners of the addons for a site by addon shortname. Example ... looks like:
mod_hvp
mod_questionnaire
mod_customcert
Then create a bash shell script that will use moosh to check on those addons. Called 'checkaddons' ... it looks like:
#!/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
Executable and executed via ./checkaddons output looks like this:
./checkaddons
Add-on listing:
mod_hvp
mod_questionnaire
mod_customcert
---------------------
Addon in que: mod_hvp
mod_hvp,2.7,2.8,2.9,3.0,3.1,3.2,3.3,3.4,3.5,3.6,3.7,https://moodle.org/plugins/download.php/19594/mod_hvp_moodle37_2019052100.zip
Addon in que: mod_questionnaire
mod_questionnaire,1.9,2.0,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,https://moodle.org/plugins/download.php/19726/mod_questionnaire_moodle37_2018110101.zip
Addon in que: mod_customcert
mod_customcert,2.9,3.0,3.1,3.4,3.5,3.6,3.7,https://moodle.org/plugins/download.php/19798/mod_customcert_moodle37_2019052001.zip
At this point I can see which plugins do have a version for my destination version on updates or upgrades.
Prior to pulling the trigger on updating/upgrading, I can acquire the plugins (via wget) in advance and put them in a 'addedplugins' directory for manually upgrading.
mkdir addons
cd addons
create a getlist file of urls ... like
https://moodle.org/plugins/download.php/19174/mod_hvp_moodle36_2019031301.zip
https://moodle.org/plugins/download.php/19206/mod_questionnaire_moodle36_2018050109.zip
https://moodle.org/plugins/download.php/18626/mod_customcert_moodle36_2018120301.zip
can then use wget -i ./getlist
and wget will acquire just those zips.
Now that I have them, I can copy the zips to appropriate location of code directory and manually hide the plugin directory ... in /mod of code ... mv mod_hvp .mod_hvp ... apache/moodle can't see them.
And then unzip the zip ... which creates the mod_hvp directory with new code. Check ownerships/permisisons on the unzipped code directory and set them correctly.
Once having done the above for each addon, can go to admin/cli/ and issue php upgrade.php
No apache is in the loop ... just php and the scripts. It updates the db tables.
Done!
I'll check site to make sure all is working, then go back and 'clean up' the zips and hidden directories I created to make the backups of code directory cleaner/meaner ... more accurate. Perfect time to make a backup of code directory. Might then be done for some time if on LTS of a moodle.
So my overall process is to acquire moodle core code with git and once that. is done and checked then do the plugins.
Yes, takes some time ... but .... works for me!
'SoS', Ken