MDL-45418 Files: Adding upgrade steps for publisher docs
Conflicts: lib/db/upgrade.php version.php
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
855d8a2c49
commit
b5725a9727
@@ -3669,5 +3669,12 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2014060300.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014061000.00) {
|
||||
// Fixing possible wrong MIME type for Publisher files.
|
||||
$filetypes = array('%.pub'=>'application/x-mspublisher');
|
||||
upgrade_mimetypes($filetypes);
|
||||
upgrade_main_savepoint(true, 2014061000.00);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -456,3 +456,23 @@ function upgrade_availability_item($groupmembersonly, $groupingid,
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the mime-types for files that exist in the database, based on their
|
||||
* file extension.
|
||||
*
|
||||
* @param array $filetypes Array with file extension as the key, and mimetype as the value
|
||||
*/
|
||||
function upgrade_mimetypes($filetypes) {
|
||||
global $DB;
|
||||
$select = $DB->sql_like('filename', '?', false);
|
||||
foreach ($filetypes as $extension=>$mimetype) {
|
||||
$DB->set_field_select(
|
||||
'files',
|
||||
'mimetype',
|
||||
$mimetype,
|
||||
$select,
|
||||
array($extension)
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2014060500.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2014061000.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user