Merge branch 'MDL-54647-master' of git://github.com/damyon/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 16 Aug 2016 00:01:47 +0000 (08:01 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 16 Aug 2016 00:01:47 +0000 (08:01 +0800)
1  2 
lib/filestorage/file_storage.php

@@@ -403,9 -404,16 +405,16 @@@ class file_storage 
              'filename'  => $file->get_contenthash(),
          );
  
+         if ($forcerefresh) {
+             $existing = $this->get_file($context->id, 'core', 'documentconversion', 0, $path, $file->get_contenthash());
+             if ($existing) {
+                 $existing->delete();
+             }
+         }
          $convertedfile = $this->create_file_from_pathname($record, $newtmpfile);
          // Cleanup.
 -        remove_dir($uniqdir);
 +        remove_dir($tmp);
          return $convertedfile;
      }