Upgrade problem from 3.1.18 -> 3.7.1

Upgrade problem from 3.1.18 -> 3.7.1

by Pasi Hakkarainen -
Number of replies: 9

Hi!

Our service provider forced us to use newer php version (7.2 or 7.3) and also some other reason forced me to upgrade Moodle.

I do not have terminal/shh connection to the server only ftp & direct Admin + Installatron Applications Installer.

I tried to upgrade Moodle but it did not worked and now I am stucked.

I have copy from old moodle directory and I have gz-file from moodle database. I installed new version of moodle (fresh install) and tried to upload database backup but did not get old data visible.

Is there a way to get my old data working again if I have database backup and old moodle directory backup?

Thx a lot!

Average of ratings: -
In reply to Pasi Hakkarainen

Re: Upgrade problem from 3.1.18 -> 3.7.1

by Ken Task -
Picture of Particularly helpful Moodlers

You must be on a shared server rather than a dedicated VPS (managed or un-managed) where you are the only customer.

Please see:
https://docs.moodle.org/37/en/Upgrading

under check requirements .... this;
"You can only upgrade to Moodle 3.7 from Moodle 3.2 or later. If upgrading from earlier versions, you must upgrade to 3.2 as a first step."

PHP version and code is one thing ... there is also DB ...
https://docs.moodle.org/dev/Moodle_3.2_release_notes#Database_requirements

So IF your shared server is capable of running 3.7.x, you have to upgrade the 3.1.x to 3.2.highest first.

'SoS', Ken

In reply to Ken Task

Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Pasi Hakkarainen -
Ok thx for your reply...

Now I am not sure if I am able to do that because I restored my upgrade and there always an "IF"... which means that I am afraid that restore did not work... Anyway I'll try this...

However my original question was also... Now I've installe clean Moodle version 3.7.1. and I have mysql backup and original 3.1.18 moodle directory saved.... so is there a way to migrate data from old to new (if I do not have terminal connection to the server)?
In reply to Pasi Hakkarainen

Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Ken Task -
Picture of Particularly helpful Moodlers

"is there a way to migrate data from old to new" ...

The only way of which I am aware (that doesn't require a moodle developer level person with super human understanding of moodle DB's) is to restore backups from the 3.1.18 courses to the 3.7.1.

Did you make any course backups?  Were those backups using default settings?

If so, there is a command line way to find .mbz moodle backups contained in the moodledata directory of the 3.1.18 but it is involved.

'SoS', Ken

In reply to Pasi Hakkarainen

Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Ken Task -
Picture of Particularly helpful Moodlers
In reply to Ken Task

Vs: Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Pasi Hakkarainen -
Omg...

Anyway I downgraded server php version back to the 5.6 and tried to upgrade moodle first from 3.1.18 -> 3.2.5 to get newer version but got an error:

Mixed Moodle versions detected, upgrade cannot continue
The Moodle update process has been paused because PHP scripts from at least two major versions of Moodle have been detected in the Moodle directory.

This can cause significant problems later, so in order to continue you must ensure that the Moodle directory contains only files for a single version of Moodle.

The recommended way to clean your Moodle directory is as follows:

rename the current Moodle directory to "moodle_old"
create a new Moodle directory containing only files from either a standard Moodle package download, or from the Moodle Git repository
move the original config.php file and any non-standard plugins from the "moodle_old" directory to the new Moodle directory
When you have a clean Moodle directory, refresh this page to resume the Moodle update process.

This warning is often caused by unzipping a standard Moodle package over a previous version of Moodle. While this is OK for minor upgrades, it is strongly discouraged for major Moodle upgrades.

This warning can also be caused by an incomplete checkout or update operation from the Git repository, in which case you may just have to wait for the operation to complete, or perhaps run the appropriate clean-up command and retry the operation.

You can find more information in upgrade documentation at http://docs.moodle.org/31/fi/Upgrading.


I've tried this once by downloading moodle installation files and I moved those file to the moodle-directory and I copied config.php file but it did not worked... Am I doing right according these instructions?
In reply to Pasi Hakkarainen

Vs: Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Pasi Hakkarainen -
Ok... After downgrade to 3.1.18 and downgrade php to 5.6 I am able to run Moodle again...

So... Is there a way to backup "data", install fresh install and restore old data (users, courses, results for examns etc)??
In reply to Pasi Hakkarainen

Re: Vs: Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Ken Task -
Picture of Particularly helpful Moodlers

Evidently you did not do exactly, but, from what it says ... copied over new moodle code onto old moodle code ... now having a mix of new and old code.

To avoid total confusion, it might be best to restore the 3.1.18 again and get that running.

Directions can't be more specific as there are some details that you have to adjust ... and are dependent upon system.

Once you have the 3.1.18 running again ... make a full site backup ... that a tar ball of code, a DB dump of the moodle DB, and for good measure a tar ball of moodledata.

Things for you to research/find/share back ...

What operating system is server?   Linux?  What distro? (Ubuntu/CentOS/?)

I take it you have command line access and can ssh into server?

What is the full path to where the 3.1.18 code resides?  If using linux via ssh .... executing pwd when in the code directory will show present working directory ... which is the path to the code.

'SoS', Ken


In reply to Ken Task

Vs: Re: Vs: Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Pasi Hakkarainen -
Hi!

Situation at the moment: Moodle is up & running v. 3.1.18 (with php version 5.6)

I have fresh Moodle installation v. 3.7.1 (another directory) up&running (with php version 7.3).

I have to change enviroment php version if I am want use Moodle 3.7.1.

  • I do not have ssh/command line/terminal access to the server.
  • I have direct admin web control panel for download db backup
  • I have phpMyAdmin

What is enough for me (if that is possible):

  • Create backup from couple of last courses
  • Create backup (if needed separately) from users with their personal passwords
  • Restore these two things to the 3.7.1 system
I have time for this now about one week and after that I cannot use anymore php version 5.6 because service provider don't accept that anymore. Is this possible or what should I do?
In reply to Pasi Hakkarainen

Re: Vs: Re: Vs: Re: Vs: Re: Upgrade problem from 3.1.18 -> 3.7.1

by Ken Task -
Picture of Particularly helpful Moodlers

Not a cPanel user but have seen it some so this from those experiences.

In your 3.7.1 instance turn on file system repository.
Using cPanel's file browser, in the data directory for the 3.7.1 instance, create a directory in 3.7.1's moodle37data/repository directory called 'coursebackups'.  The name of moodle37data given here for example ... you adjust.

Note it's full path location ... write it down ... you will need it in the 3.1.x.

Back to 3.7.1's admin interface and finish setting up that file system repository by name of 'coursebackups' and select the directory you made ... 'coursebackups'.  Do that in any course you have in the 3.7.1.

Now in the 3.1.8 instance ...

Set up automated backups and set the designated directory to be the full path to the 'coursebackups' directory you made in the 3.7.1's moodle37data/repository/coursebackups
Set the time to run in the near future.

Check your 3.1.x sites backup defaults.  All items checked as included ... users, etc.

Your cron job needs to be running on the 3.1.x ... it will run automated backups at appointed time you set up in config of autobackups.

When autobackup finishes running, check with cPanel that there are .mbz files in the repository you set up for the 3.7.1 instance.

OR ... you could make the backups in the 3.1.x, download them, then restore by uploading in a restore process.   If there are only a few courses to transfer this might be easiest.

'SoS', Ken