Moodle upgrade script being triggered by PHP and database upgrade

Moodle upgrade script being triggered by PHP and database upgrade

by Peter Kowski -
Number of replies: 5

Apart from my main moodle installation (which I keep updated to the latest version), I also manage a seperate single course on an old standalone Moodle 2.0.3 installation. Recently the PHP and PostgreSQL was updated on the server that houses these Moodle installations. This action had no consequence for the Moodle 2.4.x installation, but it has triggered an upgrade on the 2.0.3 install when I sign in as admin even though the codebase has not been changed.

When I try and follow through with the upgrade procedure I get this error:

Debug info: ERROR: relation "m_config" already exists
CREATE TABLE m_config (
id BIGSERIAL,
name VARCHAR(255) NOT NULL DEFAULT '',
value TEXT NOT NULL,
CONSTRAINT m_conf_id2_pk PRIMARY KEY (id)
)

Has anybody got any idea what I can do? I don't really want to touch or upgrade the old Moodle in any way.

Average of ratings: -
In reply to Peter Kowski

Re: Moodle upgrade script being triggered by PHP and database 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

My guess is (and it is a guess) that moodle thinks the database has gone away and is trying to create a new one. Are you sure you didn't change any of the database permissions or similar?

In reply to Howard Miller

Re: Moodle upgrade script being triggered by PHP and database upgrade

by Peter Kowski -

About the permissions, I really am not sure as I did not do the upgrade. However, like I mentioned, the other Moodle that sits on the same server didn't report any problems so it doesn look like any permissions have changed (...well globally at least).

I presume somewhere in the database is a flag that lets Moodle know whether it is installed or not? However, the strange thing is that to the students, the course still works fine. It is just when I try and access the admin page it trys to do a new install.

Any ideas on how I can access admin pages without triggering an install?

In reply to Peter Kowski

Re: Moodle upgrade script being triggered by PHP and database upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Think checking the config.php file of both sites might be in order, since you did not do (yourself) the upgrade on the 2.4.x site. Differences?

'spirit of sharing', Ken

 

In reply to Peter Kowski

Re: Moodle upgrade script being triggered by PHP and database 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

Yep admin/index.php (which is why you only see it from admin pages) calls this...

function core_tables_exist() {
    global $DB;

    if (!$tables = $DB->get_tables() ) {    // No tables yet at all.
        return false;

    } else {                                 // Check for missing main tables
        $mtables = array('config', 'course', 'groupings'); // some tables used in 1.9 and 2.0, preferable something from the start and end of install.xml
        foreach ($mtables as $mtable) {
            if (!in_array($mtable, $tables)) {
                return false;
            }
        }
        return true;
    }
}

It's checking for the existence of 'config', 'course' and 'groupings' tables (with their prefixes). I would check they exist and are readable. The only one that could not exist without bringing the whole thing crashing down is 'groupings' I suppose

In reply to Howard Miller

Re: Moodle upgrade script being triggered by PHP and database upgrade

by Peter Kowski -

Yep... all the tables exist and the config.php's seemed in order too! I did however manage to fix the problem by replacing the codebase with a slightly newer version of Moodle (2.0.10). This effectively, properly completed the half finished "update" that Moodle thought it was doing.... an action that was somehow triggered by the PHP/SQL update.

I suspect the error I was getting is that Moodle waas thinking it was upgrading a 2.03 with another 2.03 and suddenly realised it had nothing to do. wide eyes

Thanks to the both of your for your kind replies!