Upgrading from 3.7 to 3.8

Upgrading from 3.7 to 3.8

by John Bizeray -
Number of replies: 8

Hello,

Last year after many failures, I managed to install Moodle 3.7 using this excellent Moodle installation guide for idiots.

Now, I want to upgrade to Moodle 3.8... Sadly, I have not been able to find a corresponding idiot's guide to upgrade to 3.8.

I have tried putting Moodle into maintenance mode, backing up the Moodle vm, and then from the cli:

cd /var/www/html

sudo mv moodle moodle.old

git clone git://git.moodle.org/moodle.git

cd moodle $ git branch -a 

git branch --track MOODLE_38_STABLE origin/MOODLE_38_STABLE (3) 

git checkout MOODLE_38_STABLE

sudo cp  /var/www/html/moodle.old/config.php  /var/www/html/moodle/config.php

I must be missing some steps because my Moodle site does not work after this and so I have to restore my Moodle from backup.  

Much esteem and love in advance for whoever can explain to me how to upgrade my Moodle site.


Average of ratings: -
In reply to John Bizeray

Re: Upgrading from 3.7 to 3.8

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I can't see anything wrong with what you did.

So, what is the exact nature of "my Moodle site does not work"?
In reply to Howard Miller

Re: Upgrading from 3.7 to 3.8

by John Bizeray -
I cannot reply to you accurately since I nuked my last attempt by restoring my Moodle site.
I may try to reproduce my previous results later.
Many thanks for your reply.
In reply to John Bizeray

Re: Upgrading from 3.7 to 3.8

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Indeed a Moodle migration guide for idiots, aka Ubuntu, is missing. You must have been following Moodle migration guide for non-idiots, which was not wrong, but over-caring. You could have saved a second clone, which is 720 MB data.

So for the record:
$ cd /var/www/html
(NO $ sudo mv moodle moodle.old since you made a full site backup)
(NO $ git clone git://git.moodle.org/moodle.git dito)
$ cd moodle
$ git branch -a
$ git branch --track MOODLE_38_STABLE origin/MOODLE_38_STABLE
$ git checkout MOODLE_38_STABLE
(NO $ cp /var/www/html/moodle.old/config.php /var/www/html/moodle/config.php)

Now visit yoursite/admin/ in your browser as 'admin'.

That is, if you want to replay. If you want to find out what went wrong in your first try, the first thing to check is a Unix file/directory permissions problem. With all your sudo things you could have made the new moodle/ diretory or the copied config.php inaccessible for the user 'www-data'.
In reply to Visvanath Ratnaweera

Re: Upgrading from 3.7 to 3.8

by John Bizeray -
Thank you. I tried your suggestion.
It aborted (output included below).

cd /var/www/html/moodle
git branch -a
git branch --track MOODLE_38_STABLE origin/MOODLE_38_STABLE
git checkout MOODLE_38_STABLE

The ouput of: git checkout MOODLE_38_STABLE

error: Your local changes to the following files would be overwritten by checkout:
.eslintignore
.eslintrc
.nvmrc
.stylelintignore
.travis.yml
Gruntfile.js
admin/antiviruses.php
admin/auth.php
admin/category.php
admin/classes/form/purge_caches.php
admin/classes/task_log_table.php
admin/cli/install.php
admin/cli/reset_password.php
admin/cli/upgrade.php
admin/courseformats.php
admin/customfields.php
admin/dataformats.php
admin/editors.php
admin/enrol.php
admin/environment.xml
admin/index.php
admin/licenses.php
admin/media.php
admin/message.php
admin/mnet/delete.php
admin/plugins.php
admin/qbehaviours.php
admin/qtypes.php
admin/registration/confirmregistration.php
admin/registration/index.php
admin/registration/renewregistration.php
admin/renderer.php
admin/repository.php
admin/roles/admins.php
admin/roles/allow.php
admin/roles/classes/allow_assign_page.php
admin/roles/classes/allow_override_page.php
admin/roles/classes/allow_role_page.php
admin/roles/classes/allow_switch_page.php
admin/roles/classes/allow_view_page.php
admin/roles/classes/define_role_table_advanced.php
admin/roles/define.php
admin/roles/manage.php
admin/roles/override.php
admin/roles/usersroles.php
admin/settings/analytics.php
admin/settings/appearance.php
admin/settings/badges.php
admin/settings/courses.php
admin/settings/development.php
admin/settings/frontpage.php
admin/settings/plugins.php
admin/settings/security.php
admin/settings/server.php
admin/settings/subsystems.php
admin/settings/top.php
admin/settings/users.php
admin/tasklogs.php
admin/templates/setting.mustache
admin/testoutgoingmailconf.php
admin/tests/behat/filter_users.feature
admin/timezone.php
admin/tool/analytics/amd/build/log_info.min.js
admin/tool/analytics/amd/build/model.min.js
admin/tool/analytics/amd/src/model.js
admin/tool/analytics/classes/output/form/edit_model.php
admin/tool/analytics/classes/output/helper.php
admin/tool/analytics/classes/output/invalid_analysables.php
admin/tool/analytics/classes/output/models_list.php
admin/tool/analytics/classes/output/renderer.php
admin/tool/analytics/classes/task/predict_models.php
admin/tool/analytics/classes/task/train_models.php
admin/tool/analytics/cli/enable_model.php
admin/tool/analytics/cli/evaluate_model.php
admin/tool/analytics/createmodel.php
admin/tool/analytics/importmodel.php
admin/tool/analytics/lang/en/tool_analytics.php
admin/tool/analytics/model.php
admin/tool/analytics/restoredefault.php
admin/tool/analytics/settings.php
admin/tool/analytics/templates/restorable_models.mustache
admin/tool/analytics/tests/behat/restoredefault.feature
admin/tool/analytics/version.php
admin/tool/availabilityconditions/version.php
admin/tool/behat/index.php
admin/tool/behat/lang/en/tool_behat.php
admin/tool/behat/locallib.php
admin/tool/behat/renderer.php
admin/tool/behat/steps_definitions_form.php
admin/tool/behat/styles.css
admin/tool/behat/tests/behat/list_steps.feature
admin/tool/behat/version.php
admin/tool/capability/renderer.php
admin/tool/capability/version.php
admin/tool/cohortroles/classes/api.php
admin/tool/cohortroles/classes/cohort_role_assignment.php
admin/tool/cohortroles/tests/api_test.php
admin/tool/cohortroles/version.php
admin/tool/customlang/db/upgrade.php
admin/tool/customlang/version.php
admin/tool/dataprivacy/amd/build/add_category.min.js
admin/tool/dataprivacy/amd/build/add_purpose.min.js
admin/tool/dataprivacy/amd/build/categoriesactions.min.js
admin/tool/dataprivacy/amd/build/data_deletion.min.js
admin/tool/dataprivacy/amd/build/data_registry.min.js
admin/tool/dataprivacy/amd/build/data_request_modal.min.js
admin/tool/dataprivacy/amd/build/defaultsactions.min.js
admin/tool/dataprivacy/amd/build/effective_retention_period.min.js
admin/tool/dataprivacy/amd/build/events.min.js
admin/tool/dataprivacy/amd/build/expand_contract.min.js
admin/tool/dataprivacy/amd/build/form-user-selector.min.js
admin/tool/dataprivacy/amd/build/myrequestactions.min.js
admin/tool/dataprivacy/amd/build/purposesactions.min.js
admin/tool/da
Aborting
In reply to John Bizeray

Re: Upgrading from 3.7 to 3.8

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It's probably just down to a permissions change. It's actually why your way is a bit better....
In reply to Howard Miller

Re: Upgrading from 3.7 to 3.8

by John Bizeray -
Thank you very much!
sudo chmod 0755 /var/www/html/moodle/config.php
did the trick.
Now for fixing the plugins...

In reply to John Bizeray

Re: Upgrading from 3.7 to 3.8

by John Bizeray -
It looks all good now. Thank you both for your help. You guys saved my hair from being pulled out!
My Moodle Environment
In reply to John Bizeray

Re: Upgrading from 3.7 to 3.8

by Ken Task -
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)