Commit 6392aa56 authored by Maria Sorica's avatar Maria Sorica Committed by Robert Lyon
Browse files

Bug 1746259: Move the T&C to the site_content_version table

1. On site update, delete all T&C from the 'site_content'
table and add it to the 'site_content_version' table.

2. Auto accept the site terms and conditions for
the site admins.

behatnotneeded

Change-Id: I07e7da0bd8bbdb3a1e36c3321e0a2b5bb3e89522
parent f1c0934d
......@@ -5656,5 +5656,30 @@ function xmldb_core_upgrade($oldversion=0) {
}
if ($oldversion < 2018013001) {
log_debug('Move the site terms and conditions from the site_content table to the site_content_version table');
if ($records = get_records_array('site_content', 'name', 'termsandconditions')) {
foreach ($records as $data) {
$record = new stdClass;
$record->type = 'termsandconditions';
$record->content = $data->content;
$record->author = $data->mauthor;
$record->institution = $data->institution;
$record->version = '1.0';
$record->ctime = db_format_timestamp(time());
insert_record('site_content_version', $record);
delete_records('site_content', 'id', $data->id);
}
}
log_debug('Auto accept the terms and conditions for all site admins');
$sitecontentid = get_field('site_content_version', 'id', 'type', 'termsandconditions', 'institution', 'mahara');
$admins = get_site_admins();
foreach ($admins as $admin) {
save_user_reply_to_agreement($admin->id, $sitecontentid, 1);
}
}
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 = 2018013000;
$config->version = 2018013001;
$config->series = '18.04';
$config->release = '18.04dev';
$config->minupgradefrom = 2015030409;
......
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