Upgrading from 3.7 to 3.8

Re: Upgrading from 3.7 to 3.8

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

Yes, they did 'bail' you out.

Guess you had a lapse and had reverted to a combo of old way and new git way.   Happens with first time users of git and upgrades.   Been there done that!   So when ever an anticipated memory lapse is in the future ... script it! smile

Since you are using git now, you can update core code easily.  And one can upgrade easily.  And all of it without using GUI at all.  Adjust web service user to your system (I use CentOS thus apache).

in your code root, create an 'up' script - for updating core code.
nano up

echo '3.8.2+ (Build: 20200502)'
git branch -a
php admin/cli/cron.php;
php admin/cli/maintenance.php --enable;
git pull;
php admin/cli/upgrade.php --non-interactive;
php admin/cli/maintenance.php --disable;
chown apache:apache * -R;
chown root:root up bu upgrade;
fgrep '$release' version.php

An upgrade script (this one includes sitebackup lines which could be used in a separate 'bu' script for 'site backups' and run just prior to updates (probably a good practice) or anytime one tinkers with themes or plugins.

echo '3.8.2+ (Build: 20200502) to 3.9.x'
echo 'backing up ...'
tar -cvf /home/backup/moodle-code-382+-$(date +%Y%m%d%-H%M%S).tar ../moodle;
tar -cvf /home/backup/moodle-data-min-382+-$(date +%Y%m%d%-H%M%S).tar /var/www/moodledata/filedir;
mysqldump -u root -p'' moodle > /home/backup/moodle382+-db-$(date +%Y%m%d%-H%M%S).sql;
git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE;
git checkout MOODLE_39_STABLE;
php admin/cli/upgrade.php non-interactive;
php admin/cli/cron.php;
php admin/cli/maintenance.php --disable;
chown apache:apache * -R;
chown root:root up upgrade bu;
fgrep '$release' version.php

Such scripts git will not complain about.

Do change ownerships/permissions on any such script in code root where only the root user can see/edit/execute ... group/others cannot see/etc.

chmod u+rwx up

chmod go-rwx up

looks like:

-rwxr-----. 1 root root 865 May 13 10:22 up

Captain Hindsight! ...

'SoS', Ken

Average of ratings: Useful (1)