MDL-23781 lesson - files upgrade fatal error fixed
authorEloy Lafuente <stronk7@moodle.org>
Sun, 22 Aug 2010 21:02:56 +0000 (21:02 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Sun, 22 Aug 2010 21:02:56 +0000 (21:02 +0000)
mod/lesson/db/upgrade.php

index efae241..fff58f4 100644 (file)
@@ -213,7 +213,7 @@ function xmldb_lesson_upgrade($oldversion) {
                     $filepathname = clean_param('/'.$lesson->mediafile, PARAM_PATH);
                     $fullpath = "/$context->id/mod_lesson/mediafile/0$filepathname";
 
-                    if ($fs->get_file_by_hash(sha1($fullpath)) and !$file->is_directory()) {
+                    if ($file = $fs->get_file_by_hash(sha1($fullpath)) and !$file->is_directory()) {
                         // already converted, just update filename
                         $DB->set_field('lesson', 'mediafile', $filepathname, array('id'=>$lesson->id));
                     } else {