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

Bug #989195: Fixing mistake with upgrade for resume



Now that we are using tinymce for descriptions

behatnotneeded

Change-Id: I154c8314f05d0eb141f38efcbe5f6b3bebc51c78
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent cf544b51
...@@ -60,23 +60,35 @@ function xmldb_artefact_resume_upgrade($oldversion=0) { ...@@ -60,23 +60,35 @@ function xmldb_artefact_resume_upgrade($oldversion=0) {
$count = 0; $count = 0;
$limit = 1000; $limit = 1000;
for ($i = 0; $i <= $total; $i += $limit) { for ($i = 0; $i <= $total; $i += $limit) {
switch ($type) {
case 'employmenthistory':
$description = 'positiondescription';
break;
case 'educationhistory':
$description = 'qualdescription';
break;
default:
$description = 'description';
}
$sql = " $sql = "
SELECT r.id, r.description SELECT r.id, r." . $description . "
FROM {artefact_resume_" . $type . "} r FROM {artefact_resume_" . $type . "} r
ORDER BY r.id"; ORDER BY r.id";
$resumes = get_records_sql_array($sql, array(), $i, $limit); $resumes = get_records_sql_array($sql, array(), $i, $limit);
foreach ($resumes as $item) { if ($resumes) {
// Escape HTML tags in "description" foreach ($resumes as $item) {
$item->description = hsc($item->description); // Escape HTML tags in "description"
set_field('artefact_resume_' . $type, 'description', $item->description, 'id', $item->id); $item->{$description} = hsc($item->{$description});
$count += $limit; set_field('artefact_resume_' . $type, $description, $item->{$description}, 'id', $item->id);
} $count += $limit;
if (($count % $limit) == 0 || $count >= $total) { }
if ($count > $total) { if (($count % $limit) == 0 || $count >= $total) {
$count = $total; if ($count > $total) {
$count = $total;
}
log_debug("$count/$total");
set_time_limit(30);
} }
log_debug("$count/$total");
set_time_limit(30);
} }
} }
} }
......
Supports Markdown
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