Commit a6c082d3 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1788710: Altering db upgrade step to avoid unrelated 'tags' error



When using normal commit() method the block tries to do some artefact
related checks as well, which are not needed.

We will save the block configdata back directly instead

behatnotneeded

Change-Id: I0defae0de6b5f97d75f79c1d9059dadb0a64c686
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 997a1302
......@@ -881,19 +881,20 @@ function xmldb_core_upgrade($oldversion=0) {
foreach ($instances as $instance) {
$blockinstance = new BlockInstance($instance->id);
$configdata = $blockinstance->get('configdata');
// We don't want to do the normal commit() here as plan blocks have associated artefacts
// and this can clash with the 'artefact_tag' to 'tag' change
// As we have not changed which artefacts are attached but only how the configdata is stored
// we will save the new configdata back direct to database instead.
if (isset($configdata['artefactid'])) {
$configdata['artefactids'] = array($configdata['artefactid']);
unset($configdata['artefactid']);
$blockinstance->set('configdata', $configdata);
$blockinstance->commit();
}
else if (is_null($configdata['artefactid'])) {
$configdata['artefactids'] = array();
unset($configdata['artefactid']);
$blockinstance->set('configdata', $configdata);
$blockinstance->commit();
}
$configdata = serialize($configdata);
execute_sql("UPDATE {block_instance} SET configdata = ? WHERE id = ?", array($configdata, $instance->id));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment