Much difficulty with upgrade

Much difficulty with upgrade

by Patrick Tierney -
Number of replies: 8

Hello:

I have been struggling for weeks to get around a number of issues with my upgrade from version 2.9.1 to v3.x. (I know I should have upgraded well before, but for several reasons, it just wasn't possible.)

A sequence of events has led me to my current state:

  1. I upgraded my server, in particular going from cpanel/EasyApache3 to EasyApache4. Part of this upgrade disabled PHP 5.4.4x
  2. A consequence of this upgrade caused a number of pages in my production site to not display.
  3. This is when I decided to upgrade Moodle to V3.x .  I followed the recommended procedure  verbatim as well as the pertinent parts of Moodle migration.
  4. I started by creating a test site. During the server check of the installation process is when I encountered the two major problems that have caused so much consternation:
    1. PHP 5.4x had been disabled
    2. The database warning regarding the Mysql Antelope and Barracuda formats
  5. I eventually was able to make the changes to eliminate the Antelope vs Barracuda messages, but now when I point to the Antelope formatted databases, all I get is database errors.


The simplest solution would be to somehow extract the courses from the existing database in form that they can be imported to a fresh Moodle install. However, I have no idea how to do it, let alone if it can even be done. I do have shell access if needed as well as phpMyAdmin.

Any thoughts on this predicament would be greatly appreciated.

Patrick

Average of ratings: -
In reply to Patrick Tierney

Re: Much difficulty with upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry to hear of such trials and tribulations. sad

First, before giving up hope, ask your provider if they make images (which are entire account backups that would include your moodle site) of customer accounts/servers.   If they do, find out if there is a image they could restore.  

Site might still be a 2.x, but, if you can login, you can do what you probably should have done before attempting and upgrade ... backup the courses ... download those backups.

BTW, it has always been the case that one should do a full site backup ... that's code directory, DB dump, and the data directory, *before* attempting an upgrade.

If 'first' above is not possible, I can only suggest one thing given your last request:

"The simplest solution would be to somehow extract the courses from the existing database in form that they can be imported to a fresh Moodle install. However, I have no idea how to do it, let alone if it can even be done. I do have shell access if needed as well as phpMyAdmin."

The above might be possible if the database isn't frapped ... you say you have shell (ssh), then there is one thing you might be able to try to get your courses backed up.

Use phpMyAdmin and access your DB.   Look at the mdl_courses table ... you are looking for course ID numbers.  You'll see full name, short names of courses so should be able to associate what course you want to try to backup with an ID number from that table.

Write down those course names and id numbers *** on paper ***.

For purposes of example:

ID  Full Name                                                                        Shortname

4    Build Your Own LAMP Box - short course (byolb)    BYOLB

Then ...

ssh into server

Know a path where you can possibly see a file to download ... can't tell you what that is on your system ... might see a path to your home directory in cPanel ... write down that path (in the example below I'll call that '[mydir]]   ... in my example, am going to use /home/backup/

change into the code directory (I can't tell you the path) admin/cli/

On my server that is /var/www/html/moodle34/admin/cli/

in there one will see a backup.php file ... that backs up a course (using parameters from the config.php file in the code directory for the DB name, the DB user, and the DB password).

The command to issue:

php backup.php --courseid=[ONEOFTHOSECourseIDSYouWroteDown] --destination=/full/path/to/[mydir]/

So here is an example on a funcioning server.

Course:

4    Build Your Own LAMP Box - short course (byolb)    BYOLB

Path: /home/backup/

Command:

php backup.php --courseid=4 --destination=/home/backup/

If your courses are large, it might take some time.   Be patient!

If the stars are aligned just right, one might see something similar to the following:

[root@sos cli]# php backup.php --courseid=4 --destination=/home/backup/
== Performing backup... ==
Writing /home/backup/backup-moodle2-course-4-byolb-20171208-2200.mbz
Backup completed.

I can now download the backup file from /home/backup/ with whatever tool I have to download files and hopefully, that course can be restored.

Good Luck!

'spirit of sharing', Ken

In reply to Ken Task

Re: Much difficulty with upgrade

by Patrick Tierney -

Hello Ken:

Thank you for such a thorough answer and guidance that was easy to follow. It was straightforward to construct the backup command:

root@server [/home/esprimme/public_html/lmsfr]# php /home/esprimme/public_html/lmsfr/admin/cli/backup.php --courseid=40 --destination=/home/esprimme/public_html/lmsfr/mdlfr_backup/


I received the following output:
== Performing backup... ==

You will see that the text after running the backup command does not contain

Writing /home/backup/backup-moodle2-course-4-byolb-20171208-2200.mbz
Backup completed.

I can confirm that no files were written, at least not in the specified target directory.

Your thoughts?

Patrick


BTW...I appreciate you not scolding me, as others who have posted a reply to my post have done, for not having updated my system before. The reason for the delay was quite simple: I was, healthwise, in a daily life and death struggle for two years and I did not have the ability to deal with a major disruption due to an upgrade, just like what has happened over the last few weeks. Again, thanks.

In reply to Patrick Tierney

Re: Much difficulty with upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Am certain, had anyone known of your situation, none would have scolded .... had they known.  Folks in here are not like that!!! ;)

But, glad to hear health must be improving! smile

Now back to the 'task' at hand (no pun intended).

For what I suggested to work the config.php file of the code must have entries for DB host, DB user, DB password and the path to the moodledata.

To see if you can connect to the DB server from the command lline:

mysql -h [DBhost] -u [DBuser] -p[DB[assword] ... then ENTER

The DBvariables above from config.php in moodlecode/root.

If you can connect, see if the database is there.  From the mysql> prompt type:

show databases;

It should show a database by the same name as in the config.php file.

To quit the mysql client, type: \q [ENTER]

Then you need to check if the moodledata directory exist.   Again look in config.php and the path to moodledata you see there should exist.

Let's say path said /home/esprimme/moodledata

to see if it's there: ls /home/esp;rimme/moodledata

That should list things like cache, localcache, temp, filedir, trashdir

Something there?

Then, we also need to know the course ID from the database.

What did you get when in mysql client for:

use DBname;

select * from mdl_courses;

The 'mdl_ above is a prefix and is probably different on your server.

Check those things out and get back ... or, we could take this converstation over to PM in here and then directly to EMail - where you and I communicate directly rather than delayed via forum or PM.

'spirit of sharing', Ken



In reply to Ken Task

Re: Offline communicating

by Patrick Tierney -

"we could take this converstation over to PM in here and then directly to EMail - where you and I communicate directly rather than delayed via forum or PM."

Ken:

Let's try the email thing. I can't figure out how to send you a PM with my email address.

P

In reply to Patrick Tierney

Re: Offline communicating

by Ken Task -
Picture of Particularly helpful Moodlers

Been multitasking and busy today with a small college in WV.

A PM is headed your way with my addy in it.

Ken

In reply to Ken Task

Re: Difficulty with course backup

by Patrick Tierney -

Ken:

I was able to log in to MySQL with no problems however the backup command will not generate a file

The show databases works fine.


Can I restore the database through phpMyAdmin?


P


In reply to Ken Task

Re: Difficulty with upgrade

by Patrick Tierney -

Ken:

"BTW, it has always been the case that one should do a full site backup ... that's code directory, DB dump, and the data directory"

Actually, I did back everything up...Database, Moodle Data, and Moodle code. The database backup was created using MySql's export function. My suspicion is that anything related to restoring the database is pooched because of the mods to accommodate transition from Antelope to Barracuda. A post in the Moodle forums suggested the following addition to my.cnf:

innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake


P

In reply to Patrick Tierney

Re: Much difficulty with upgrade

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just to note... PHP 5.4 is ancient history. It's been unsupported completely for well over two years. The latest versions of Moodle require PHP 7. 

Unfortunately, you will probably have to upgrade to Moodle 3.0 (and PHP 5.6) first and get that working before you can upgrade to Moodle 3.4 and PHP 7. This will all depend on how easy it is to upgrade PHP on your server.