"MDL-23819, old wiki has binary data stored in db, which is not supported anymore, so we have to ignore the bad data without breaking upgrade process"
This commit is contained in:
@@ -285,15 +285,25 @@ function wiki_upgrade_migrate_versions() {
|
||||
if ($version->version == 1) {
|
||||
// The oldest version of page in moodle 2.0 is 0 which has empty content
|
||||
// so we need to insert an extra record
|
||||
$content = $version->content;
|
||||
$version->version = 0;
|
||||
$version->content == '';
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
$version->version = 1;
|
||||
$version->content == $content;
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
try {
|
||||
$content = $version->content;
|
||||
$version->version = 0;
|
||||
$version->content = '';
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
$version->version = 1;
|
||||
$version->content = $content;
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
} catch (Exception $e) {
|
||||
echo $OUTPUT->notification('Cannot insert this record');
|
||||
print_object($version);
|
||||
}
|
||||
} else {
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
try {
|
||||
$DB->insert_record('wiki_versions', $version);
|
||||
} catch (Exception $e) {
|
||||
echo $OUTPUT->notification('Cannot insert this record');
|
||||
print_object($version);
|
||||
}
|
||||
}
|
||||
|
||||
$pagesinfo->next();
|
||||
|
||||
Reference in New Issue
Block a user