Merge branch 'MDL-29256-resource-format' of git://github.com/mudrd8mz/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 27 Feb 2012 17:53:03 +0000 (18:53 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 27 Feb 2012 17:53:03 +0000 (18:53 +0100)
mod/page/backup/moodle1/lib.php

index f0783ee..c917a16 100644 (file)
@@ -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;