From a158c5c3253494b9c216dbec1f0e5e734b790f05 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Tue, 21 Feb 2012 11:12:00 +0100 Subject: [PATCH] MDL-29256 Fixed incorrect calculation of contentformat Legacy Resource modules of the type Web page force the HTML format for their content. The format stored in the reference field is valid only for legacy resources of the type Plain text page. See page_20_migrate() function. --- mod/page/backup/moodle1/lib.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mod/page/backup/moodle1/lib.php b/mod/page/backup/moodle1/lib.php index f0783ee413e..c917a1693e1 100644 --- a/mod/page/backup/moodle1/lib.php +++ b/mod/page/backup/moodle1/lib.php @@ -53,11 +53,18 @@ class moodle1_mod_page_handler extends moodle1_resource_successor_handler { $page['intro'] = $data['intro']; $page['introformat'] = $data['introformat']; $page['content'] = $data['alltext']; - $page['contentformat'] = (int)$data['reference']; - // this is unexpected but just in case (the same step applied during upgrade) - if ($page['contentformat'] < 0 or $page['contentformat'] > 4) { - $page['contentformat'] = FORMAT_MOODLE; + if ($data['type'] === 'html') { + // legacy Resource of the type Web page + $page['contentformat'] = FORMAT_HTML; + + } else { + // legacy Resource of the type Plain text page + $page['contentformat'] = (int)$data['reference']; + + if ($page['contentformat'] < 0 or $page['contentformat'] > 4) { + $page['contentformat'] = FORMAT_MOODLE; + } } $page['legacyfiles'] = RESOURCELIB_LEGACYFILES_ACTIVE;