Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Hardik Shetty -
Number of replies: 7
I am new to Moodle. I am restoring moodle for a client who just came to me with backup and sql file and asked to restore. 
So here is the issue i am restoring it on Hostinger the Code version is 4.3.2 but the sql file they have given is 3.8.1 and there is no backup

here is how I know the code version in version.php

Steps I am doing to install.
1. Install version 4.3.2 of moodle in hostinger since it is in version.php
2. Setting it up via mysite.com/install.php
3. Replacing the main folder and moodledata folder with the backup provided by client
4. changing with older DB with newer uploaded DB in config.php but then I receive this issue

Please advice where I am getting it wrong
Below are the Screens


Average of ratings: -
In reply to Hardik Shetty

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Ken Task -
Picture of Particularly helpful Moodlers
Moodle versions are sensitive about versions of PHP and/or MySQL it runs under.

Can't go from 3.8.1 to 4.3.highest without making a stop in between.
Please see:
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases
and
https://moodledev.io/general/releases/3.8

So in your Hostinger's cPanel there is a little app for setting php versions per domain.

'SoS', Ken

In reply to Ken Task

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Hardik Shetty -
But The Hostinger PHP version and Maria DB version is set perfectly fine
In reply to Hardik Shetty

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Hardik Shetty -
Got this error when i change my moodle version 3.8.1 and php version to 7.3
Error
error/generalexceptionmessage
Debug info:
Error code: generalexceptionmessage
$a contents: syntax error, unexpected ':', expecting ')'
Stack trace:
line 4392 of /lib/outputrenderers.php: ParseError thrown
line 632 of /lib/setup.php: call to require_once()
line 30 of /config.php: call to require_once()
line 30 of /index.php: call to require_once()
In reply to Hardik Shetty

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Ken Task -
Picture of Particularly helpful Moodlers
So you have only a 3.8.1 SQL dump to work with.
You've imported that into a what version of DB server?

* Can your server run moodle 3.8.highest code? (PHP now a factor) * PHP 7.4 MAX
Does your cPanel allow the setting PHP 7.4 for the domain/site?

Am confused ...
The server check shows moodle version is 3.11.8 and but it detects code is running 3.8.1?

Your screen shots show 4.3????

What you need to try to do ... just get the 3.8.x up and running first.
Check plugins and update those - see note on plugins below.

Don't try migration + upgrade at same time.

Think you will have to upgrade to 3.11.highest first - checking what new
requirements there are for moodle
https://moodledev.io/general/releases/3.11

Once at 3.11.highest and things check out ok, do a site backup - that's code + DB dump + moodledata,  - note on plugins - make sure the additional plugins you have (which includes themes) are updated as well ... and have compatible versions for destination version of 4.3 ... if a plugin doesn't have a compat version for 4.3, delete it.

then try the upgrade from 3.11.highest to 4.1.highest.

If you try to go any higher you must remove core mod assignment (2.2) and examview before going to 4.3.

'SoS', Ken

In reply to Ken Task

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Hardik Shetty -
Yes only 3.8.1 and have imported it with MariaDB and DB is working fine no issue there. The moodledata[backup] folder also works fine when I replace old one with the new one this error occurs when I replace the main folder.

yes I can run any version on Moodle as well have option for all version of php currently running on 7.3 as 3.8.1 requires.

To clear your confusion when i install 4.3.2 moodle and replace with my files i get error[Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2]

On the other hand i tried installing 3.8.1 moodle and replace it with my back up i get error:
[Error
error/generalexceptionmessage
Debug info:
Error code: generalexceptionmessage
$a contents: syntax error, unexpected ':', expecting ')'
Stack trace:
line 4392 of /lib/outputrenderers.php: ParseError thrown
line 632 of /lib/setup.php: call to require_once()
line 30 of /config.php: call to require_once()
line 30 of /index.php: call to require_once()]

and for the migration part the client only have backup for 4.3.2 and a sql for 3.8.x and they say they dont have access to the server due to some internal conflict and stuff.... So have to work with this to restore the site
In reply to Hardik Shetty

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> php currently running on 7.3 as 3.8.1 requires.

Since the release 3.8.4 Moodle will also run on PHP 7.4. See MDL-66260.

BTW, PHP 7.4 is a "pivotal" version since everything from 3.8.3 to 4.1 LTS latest will run on PHP 7.4. A good version for the 3.x to 4.x generation change. As the others have mentioned Moodle won't allow any long jump, there is an "earliest from" version. See http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.

N.B. Your hosting offering 3.8 to 4.3 straight upgrades as nothing is highly suspicious to me. I hope, our old havoc maker Softridiculous is not in the game.

In reply to Hardik Shetty

Re: Upgrading Moodle database from version 3.8.1 (Build: 20200113) (2019111801.00) to 4.3.2

by Ken Task -
Picture of Particularly helpful Moodlers
Well, you are learning ... the hard way ... what doesn't work.
The only thing the backup of the moodle 4.3.2 code they gave you is to see what additonal addon folders you can find ... mod/block/theme/quiz question types.  

With only a 3.8.1 sql dump to work with that is key ... and the determining factor on how you approach this.

That dump is imported into a DB.

You have to acquire 3.8.x code and then manually setup config.php from config-dist.php
Copy config-dist.php to config.php - change config.php for type of DB (mariadb), DB user, DB password, location of the 4.3.x moodledata directory (which no longer matches files moodle 3.8.1 mdl_files tables knows about (probably have orphaned files in moodledata/filedir/ - exist there, but no reference in mdl_files table.

With the compatible PHP version + extensions in place, use the command line to upgrade.
In admin/cli/ there is a upgrade.php ....
cd /path/to/moodlecode/
php admin/cli/upgrade.php

That does not require you to login to the moodle - and that is another item ... did they give you the admin credentials? - login/password?

If not, then you'll have to pick a user that exist in mdl_users table that has a manual authentication, and change password via admin/cli/reset_password.php

If that was an admin level user login to the moodle and you should see a site admin menu.

If that user was not an admin level user, you have to log out and in config.php add a line:
$CFG->siteadmins='2,ID# of that user login whose password you changed';

Attempt login again.

If you get that far you can now see what plugins are missing from disk and install those - don't copy from the 4.2.x code you have ... acquire a compat version from Moodle plugins site.

Now you can check the site for function - links to *some* files predict will be broken - only way to fix is to re-upload.

Once site functions ok, now you can begin the march of the moodle.
Go to Site Admin -> Environment check -> update component.
Then use the drop down moodle version list selecting each higher version of moodle to see what that says you need.

When/IF you finish ... you'll still have a semi-broken site when it comes to orphaned files that are present in moodledata/filedir/ but not known to db mdl_files table.
Can't fix that!

Best of luck!
'SoS', Ken


 
Average of ratings: Useful (1)