Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit a158c5c3253494b9c216dbec1f0e5e734b790f05 1 parent e0d5a17
@mudrd8mz mudrd8mz authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 mod/page/backup/moodle1/lib.php
View
15 mod/page/backup/moodle1/lib.php
@@ -53,11 +53,18 @@ public function process_legacy_resource(array $data) {
$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;
Please sign in to comment.
Something went wrong with that request. Please try again.