Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-34738 fix for the problem found during testing : dat files not ac…

…cepted on some servers
  • Loading branch information...
commit 7263fd6c53db77da7b947a83b75b07994f512215 1 parent bd43383
Jean-Michel Vedrine authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 question/format/blackboard/format.php
View
12 question/format/blackboard/format.php
@@ -43,6 +43,18 @@ public function provide_import() {
return true;
}
+ /**
+ * Check if the given file is capable of being imported by this plugin.
+ * As {@link file_storage::mimetype()} now uses finfo PHP extension if available,
+ * the value returned by $file->get_mimetype for a .dat file is not the same on all servers.
+ * So if the parent method fails we must use mimeinfo on the filename.
+ * @param stored_file $file the file to check
+ * @return bool whether this plugin can import the file
+ */
+ public function can_import_file($file) {
+ return parent::can_import_file($file) || mimeinfo('type', $file->get_filename()) == $this->mime_type();
+ }
+
public function mime_type() {
return mimeinfo('type', '.dat');
}
Please sign in to comment.
Something went wrong with that request. Please try again.