From c908995f81dbfc0ef9c7955d54c0ab6258f1302a Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Sun, 18 Jul 2010 14:18:45 +0000 Subject: [PATCH] "MDL-23196, fixed html block upgrade script" --- blocks/html/db/upgrade.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/blocks/html/db/upgrade.php b/blocks/html/db/upgrade.php index 83897144126..9926afdf4d5 100644 --- a/blocks/html/db/upgrade.php +++ b/blocks/html/db/upgrade.php @@ -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();