Commit e5fe80d5 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow check_plugin_sanity to succeed when an artefact type moves from one plugin to another

parent 62fa55e7
......@@ -760,7 +760,12 @@ function artefact_check_plugin_sanity($pluginname) {
if (get_config('installed')) {
if ($taken = get_record_select('artefact_installed_type', 'name = ? AND plugin != ?',
array($type, $pluginname))) {
throw new InstallationException(get_string('artefacttypenametaken', 'error', $type, $taken->plugin));
// Check the other plugin's code in case the duplicate type is being removed from it at the same time
$otherclass = generate_class_name('artefact', $taken->plugin);
safe_require('artefact', $taken->plugin);
if (in_array($type, call_static_method($otherclass, 'get_artefact_types'))) {
throw new InstallationException(get_string('artefacttypenametaken', 'error', $type, $taken->plugin));
}
}
}
if (!class_exists($typeclassname)) {
......
......@@ -1403,8 +1403,10 @@ function xmldb_core_upgrade($oldversion=0) {
$profileicons = get_column('artefact', 'id', 'artefacttype', 'profileicon');
if ($profileicons) {
foreach ($profileicons as $a) {
$size = filesize($artefactdata . 'file/profileicons/originals/' . ($a % 256) . '/' . $a);
insert_record('artefact_file_files', (object) array('artefact' => $a, 'fileid' => $a, 'size' => $size));
$filesize = filesize($artefactdata . 'file/profileicons/originals/' . ($a % 256) . '/' . $a);
$imagesize = getimagesize($artefactdata . 'file/profileicons/originals/' . ($a % 256) . '/' . $a);
insert_record('artefact_file_files', (object) array('artefact' => $a, 'fileid' => $a, 'size' => $filesize));
insert_record('artefact_file_image', (object) array('artefact' => $a, 'width' => $imagesize[0], 'height' => $imagesize[1]));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment