Moodle

Upgrade of group system failed!

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.8.8
  • Fix Version/s: None
  • Component/s: Groups
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE

Description

  • Upgrading Moodle database from version 1.8.5+ (Build: 20080416) (2007021550) to 1.8.8+ (Build: 20090410) (2007021581)...

Moodle 1.8.5+ (2007021550) to 1.8.8+ (2007021581)

1.8.5;
group/version.php

$group_version = 2007012401;
//$module->requires = 2006120400; // Requires this Moodle version

1.8.8;
group/version.php

$group_version = 2007012401;
//$module->requires = 2006120400; // Requires this Moodle version

For some reason, install_group_db() in group/db/upgrade.php is called which fails in

if ($result and $oldgroups = get_records('groups')) {
foreach ($oldgroups as $oldgroup) { $rec = new Object(); $rec->courseid = $oldgroup->courseid; $rec->groupid = $oldgroup->id; $rec->timeadded = $oldgroup->timemodified; // I think this is not needed since the field is gone? $result = $result && insert_record('groups_courses_groups', $rec); }
}

[Fri May 01 12:13:40 2009] [error] [client ] PHP Notice: Undefined property: stdClass::$courseid in /home/moodledev/1.8.8/docs/group/db/upgrade.php on line 198, referer: https://dev.moodle/1.8.8/admin/upgradesettings.php
[Fri May 01 12:13:40 2009] [error] [client ] PHP Notice: Column 'courseid' cannot be null<br /><br />INSERT INTO mdl_groups_courses_groups ( COURSEID, GROUPID ) VALUES ( null, 1 )<ul style="text-align: left"><li>line 1425 of lib/dmllib.php: call to debugging()</li><li>line 201 of group/db/upgrade.php: call to insert_record()</li><li>line 281 of group/db/upgrade.php: call to install_group_db()</li><li>line 388 of admin/index.php: call to upgrade_group_db()</li></ul> in /home/moodledev/1.8.8/docs/lib/weblib.php on line 6094, referer: https://dev.moodle/1.8.8/admin/upgradesettings.php

Since $oldgroup->courseid is not set since the groups table does not contain the courseid column. The groups_courses_groups table seems to be correctly populated. I believe the problem is caused in upgrade_group_db() which is called from admin/index.php when trying to load the site admin panel. It's not called upon login for an admin during the upgrade screen, but rather when that process is finished and loads the site admin panel. Clicking on "Notifications" there starts the groups db upgrade, which is unnecessary. I think it's a version checking issue, but I haven't been able to track it down.

Activity

Hide
Elvedin Trnjanin added a comment -

In group/db/upgrade.php

function upgrade_group_db($continueto) {
/// This function upgrades the group tables, if necessary
/// It's called from admin/index.php.

global $CFG, $db;

$group_version = ''; // Get code versions
require("$CFG->dirroot/group/version.php");

if (empty($CFG->group_version)) { // New 1.8 groups have never been installed...
...

I'm trying to make sense of it, but can't. Based on the code that follows in install_group_db(), it assumes that mdl_groups has the courseid field and populates mdl_groups_courses_groupings with the groupid and courseid. This was done already in our 1.8.5+. I assume whatever is setting $CFG->group_version came after this version of 1.8.5+ or at least it's doing it incorrectly now.

mysql> select * from mdl_config where name='group_version';
Empty set (0.00 sec)

Rather than tracking down where in the upgrade history this problem started (since it's a Friday), I've resorted to

mysql> insert into mdl_config (name, value) values ("group_version", 2007012401);
Query OK, 1 row affected (0.03 sec)

Result. Upgrade process continues to other parts and completes. Everything seems to be working correctly, nothing in the error logs.

Show
Elvedin Trnjanin added a comment - In group/db/upgrade.php function upgrade_group_db($continueto) { /// This function upgrades the group tables, if necessary /// It's called from admin/index.php. global $CFG, $db; $group_version = ''; // Get code versions require("$CFG->dirroot/group/version.php"); if (empty($CFG->group_version)) { // New 1.8 groups have never been installed... ... I'm trying to make sense of it, but can't. Based on the code that follows in install_group_db(), it assumes that mdl_groups has the courseid field and populates mdl_groups_courses_groupings with the groupid and courseid. This was done already in our 1.8.5+. I assume whatever is setting $CFG->group_version came after this version of 1.8.5+ or at least it's doing it incorrectly now. mysql> select * from mdl_config where name='group_version'; Empty set (0.00 sec) Rather than tracking down where in the upgrade history this problem started (since it's a Friday), I've resorted to mysql> insert into mdl_config (name, value) values ("group_version", 2007012401); Query OK, 1 row affected (0.03 sec) Result. Upgrade process continues to other parts and completes. Everything seems to be working correctly, nothing in the error logs.
Hide
Petr Škoda (skodak) added a comment -

Hello,
the 1.8x groups were a dead end, we have fixed some upgrade issues but later we have ended up reverting everything in 1.9.x No more fixes are planed for the 1.8.x branch, problematic sites will have to be fixed manually.

Thank you for the report.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - Hello, the 1.8x groups were a dead end, we have fixed some upgrade issues but later we have ended up reverting everything in 1.9.x No more fixes are planed for the 1.8.x branch, problematic sites will have to be fixed manually. Thank you for the report. Petr Skoda

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: