Skip to content

Commit

Permalink
MDL-45418 Files: Adding upgrade steps for publisher docs
Browse files Browse the repository at this point in the history
Conflicts:
	lib/db/upgrade.php
	version.php
  • Loading branch information
jsnfwlr authored and stronk7 committed Jun 10, 2014
1 parent 855d8a2 commit b5725a9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
20 changes: 20 additions & 0 deletions lib/db/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit b5725a9

Please sign in to comment.