Commit 63896cc8 authored by Robert Lyon's avatar Robert Lyon
Browse files

Updating some hardcoded info in database for artefact.php (Bug #1414862)



there are places where people have added html with view/artefact.php
links - needs to be artefact/artefact.php now

Change-Id: I28a54bbbe5ffb21a6bc0ca94e65cdb1114c9f08d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 754944a6
......@@ -3926,5 +3926,34 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2015012700) {
// Seen as we moved the view/artefact.php file to artefact/artefact.php
// we need to fix upa a few places where users could have hardcoded the url into their data.
// $replacements is key = table, value = column
$replacements = array('view' => 'description',
'artefact' => 'description',
'group' => 'description',
'interaction_forum_post' => 'body',
'notification_internal_activity' => 'message',
'notification_internal_activity' => 'url');
foreach ($replacements as $key => $value) {
execute_sql("UPDATE {" . $key . "} SET " . $value . " = REPLACE(" . $value . ", 'view/artefact.php', 'artefact/artefact.php') WHERE " . $value . " LIKE '%view/artefact.php%'");
}
// we need to handle block_instance configdata in a special way
if ($results = get_records_sql_array("SELECT id FROM {block_instance} WHERE configdata LIKE '%view/artefact.php%'", array())) {
require_once(get_config('docroot') . 'blocktype/lib.php');
foreach ($results as $result) {
$bi = new BlockInstance($result->id);
$configdata = $bi->get('configdata');
foreach ($configdata as $key => $value) {
$configdata[$key] = preg_replace('/view\/artefact.php/', 'artefact/artefact.php', $value);
}
$bi->set('configdata', $configdata);
$bi->commit();
}
}
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2014121600;
$config->version = 2015012700;
$config->series = '15.04';
$config->release = '15.04dev';
$config->minupgradefrom = 2009022600;
......
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