1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Peter Jones -
Number of replies: 7

Hi guys

I've been trying to upgrade from 1.9 to 2.2, as per the the documentation, but have been having zero luck: http://docs.moodle.org/22/en/Upgrading. I would be grateful if anyone could spot where I am going wrong, as I am beginning to think I'm going mad. The instructions in the aforementioned URL simply do not work.

To breifly explain:

  1. My PHP status and settings are ready, MySQL is ready. All files backed up (I have reverted several failed upgrade attempts).
  2. I re-named the old moodle dir., and uploaded the complete standard install package (Moodle 2.2.7+ stable) as per the instructions on a seperate dir.
  3. I make a copy of the config.php in the old 1.9 dir., and move it into the new 2.2 dir.
  4. I attempt to run the installer from /admin/. I am then presented with an error relating to MySQL. I discovered that if I instead use the 'config.dist.php' file, fill out the relevant details, and also notably changing dbtype='mysqli' instead of the default dbtype='mysql', and saving it as config.php, the error finally disappears.
  5. However, I am now told that the /moodledata/ folder does not exist. So, fine, I copy across the moodledata folder from the 1.9 site, to the fresh 2.2 dir.
  6. The Moodle installation begins. Note- not at upgrade, just a blank, empty installation. It doesn't detect the contents of my database at all, it just uses it and overwrites it as a fresh install of Moodle! I even tried deleting the install.php and /install/ dir, but this makes no difference.

How do I upgrade? Have I downloaded the wrong package?

Thank you.

Average of ratings: -
In reply to Peter Jones

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Bret Miller -
Picture of Particularly helpful Moodlers

Assuming you're trying to make a copy of your site, you need both a copy of the moodledata folder and a copy of the database. Then config.php needs to be set to point at the copies of both the database and moodledata so that it will see the older version of Moodle and prompt to upgrade instead of making a new install.

In reply to Bret Miller

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Peter Jones -

Hi Bret, many thanks for the reply.

Perhaps I have missing something, but where in any of the Upgrade docs does it say you need to have copies of the database + moodledata folder?

To clarify, I'm not making a copy of my site, I'm just trying to upgrade the current Moodle system from 1.9 to 2.2.

The upgrade documents state you must download the version you want/are capable of upgrading to (in my case, 2.2), rename your current moodle folder to something else, upload the new moodle files into a folder named as it was previously, then copy across the config.php from the old installation to start the upgrade.

The config.php file from 1.9 does not work when you copy it across (with all of the current details) into the new 2.2 directory. I had to use the format of the config file found in config-dist.php for 2.2, and place in the values accordingly (that file is just a shell, obviously.)

But instead of loading the Upgrade procedure, it just treats it as a new installation, almost like it's ignoring the config.php, and attempts a blank installation of 2.2.

Cheers

In reply to Peter Jones

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Bret Miller -
Picture of Particularly helpful Moodlers

So it sounds like you're doing things correctly. Essentially, to upgrade, Moodle needs to see the old version database and moodledata directory, so if it's not kicking into an upgrade, it's probably not seeing the database as a Moodle install.

If you have shell access to the server, you might try running the cli upgrade instead. I run: php admin/cli/upgrade.php --non-interactive

That way there's no doubt what you're trying to do and the messages on the screen should identify any reason it thinks it can't upgrade. Somewhere in the 1.x series, I had an upgrade time out on me making a mess of the install. So after restoring everything, I figured out how to use the cli commands to do the upgrade, which eliminates the possibility of it timing out. Since then I haven't had any problems with the actual upgrade process. But I also realize that not everyone has shell access, so it may not be possible for you to do it that way.

The one thing I don't see i your dialog here is which 1.9 version you're upgrading from. I've seen other posts with various problems upgrading from older 1.9 versions, so if you aren't on 1.9.19 or 1.9.19+, it'd be a strong recommendation to do that upgrade first.

That's a long shot. But since Moodle 2.2.7 isn't recognizing the database as a Moodle version, it's worth a shot.

In reply to Bret Miller

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Peter Jones -

I am using 1.9.3, so I'm assuming that's a new enough version (?).

I'm convinced it is something related to either the config.php file, or something else not causing the upgrade files to be doing their thing. You simply cannot take a 1.9 config.php file and dump it into a fresh 2.0+ moodle root dir and expect the upgrade process to kick in, and I'm baffled as to why this isn't mentioned in the upgrade wiki. The 2.0+ config.php file has extra function calls in it, for a start.

However, if I use the config-dist.php code provided in the 2.2.7, replacing the values as necessary to mirror those in my current config.php, the upgrade doesn't start, it just starts a standard installation. I've tried deleting various /install/ and install.php files before starting this process, but it also makes no difference.

I see you mention "Moodle needs to see the old version database and moodledata directory" - does this mean I should alter the new config.php file to reference the moodledata directory that is sitting in the OLD dir.? Again, the wiki does not mention you have to do that, but is it worth a try...?

eg:

$CFG->dirroot   = realpath('/home/DOMAIN/public_html/2.2.7-moodle');
$CFG->dataroot  = realpath('/home/DOMAIN/public_html/1.9-moodle/moodledata');

??

In reply to Peter Jones

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Bret Miller -
Picture of Particularly helpful Moodlers

Upgrading to 1.9.19+ first might just solve your problem. There have been a number of issues upgrading from older 1.9.x versions.

In reply to Bret Miller

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Peter Jones -

Thanks very much Bret, I was now able to at least begin the upgrade process by attempting an upgrade to 1.9.19+. I think it should be made clearer in the upgrade docs that doing this is probably a necessity, rather than an optional thing! But anyway..

Unfortunately, the upgrade itself failed during the database update. I got the following error:

1146: Table 'logistic_moodle01.truemnet_host' doesn't exist
(logistic_moodle01 is my database, by the way)

I haven't been able to find what truemnet_host is anywhere on the forum - do you have any ideas what I should do?? I may start up a new thread if anyone things this is deviating from the original now.

Thanks

In reply to Peter Jones

Re: 1.9 to 2.2 - upgrade sequence doesn't load, fresh install does

by Bret Miller -
Picture of Particularly helpful Moodlers

OK, so we might be getting past my expertise here. Moodle does have an mnet_host table. The standard moodle table prefix would be mdl_, so normally the table would be called mdl_mnet_host. That it is looking for truemnet_host would tell me that your config.php has $CFG-prefix='true' instead of $CFG-prefx='mdl_'. Is that the case?

If so, I'm not at all sure what you do about a missing mdl_mnet_host table. I'm hoping someone else on here does...

If not, maybe there's a bug in the current 1.9.19+ that is causing the upgrade issue. It's been a long time since I've been on 1.9... That the prefix being used is "true" makes me think a variable got used the wrong way somewhere in the code.