mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
"MDL-23196, fixed html block upgrade script"
This commit is contained in:
parent
320e7de869
commit
c908995f81
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user