"MDL-23196, fixed html block upgrade script"

This commit is contained in:
Dongsheng Cai 2010-07-18 14:18:45 +00:00
parent 320e7de869
commit c908995f81

View File

@ -34,22 +34,21 @@ function xmldb_block_html_upgrade($oldversion) {
$dbman = $DB->get_manager();
if ($oldversion < 2010071501 && false) { // TODO: MDL-23196 !!!
if ($oldversion < 2010071501) {
$params = array();
$sql = "SELECT * FROM {block_instances} b WHERE b.blockname = :blockname";
$params['blockname'] = 'html';
$rs = $DB->get_recordset_sql($sql, $params);
foreach ($rs as $record) {
$config = unserialize(base64_decode($record->configdata));
$config = new stdclass;
if (!empty($config) && is_object($config)) {
if (!empty($config->text) && is_array($config->text)) {
$data = clone($config);
$config->text = $data->text['text'];
$config->format = $data->text['format'];
$record->configdata = base64_encode(serialize($config));
$DB->update_record('block_instances', $record);
}
$record->configdata = base64_encode(serialize($config));
$DB->update_record('block_instances', $record);
}
}
$rs->close();