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

Bug 1639049: Ensure dummy email is updated in artefact table



For the admin user on a site installed before version 15.04.1

behatnotneeded

Change-Id: I026efdf7e427fabcd75ba725c20f36b07ae50f94
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 7aafaf5a
......@@ -4763,5 +4763,27 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2016111100) {
log_debug('Make sure all places the default admin email is recorded as the same address');
if ($results = get_records_sql_array("SELECT u.id, u.email AS usr_email,
a.id AS artefactid, a.title AS artefact_email,
ae.email as artefact_internal_profile_email, ae.principal
FROM usr u
JOIN artefact a ON a.owner = u.id
JOIN artefact_internal_profile_email ae ON (ae.owner = u.id and ae.artefact = a.id)
WHERE a.artefacttype = 'email' AND (u.email = ? OR a.title = ?)",
array('admin@example.org', 'admin@example.org'))) {
foreach ($results as $result) {
// Using the one in 'artefact_internal_profile_email' table as correct one
if ($result->artefact_email != $result->artefact_internal_profile_email) {
update_record('artefact', array('title' => $result->artefact_internal_profile_email), array('owner' => $result->id, 'artefacttype' => 'email', 'id' => $result->artefactid));
}
if ($result->usr_email != $result->artefact_internal_profile_email && $result->principal == 1) {
update_record('usr', array('email' => $result->artefact_internal_profile_email), array('id' => $result->id));
}
}
}
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2016110500;
$config->version = 2016111100;
$config->series = '17.04';
$config->release = '17.04dev';
$config->minupgradefrom = 2012080604;
......
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