Commit 95ae5c09 authored by Nigel McNie's avatar Nigel McNie
Browse files

Unify how LEAP import and export poll for artefact plugins.

It now works the way it worked for import. If the file exists, it has to implement the class. If the plugin doesn't want to implement it, it doesn't provide the file.
parent 248b91b8
......@@ -93,16 +93,14 @@ class PluginExportLeap extends PluginExport {
$this->zipfile = 'mahara-export-leap-user'
. $this->get('user')->get('id') . '-' . $this->export_time . '.zip';
// some plugins might want to do their own special thing
foreach (plugins_installed('artefact', true) as $plugin) {
try {
$plugin = $plugin->name;
safe_require('export', 'leap/' . $plugin);
foreach (plugins_installed('artefact') as $plugin) {
$plugin = $plugin->name;
if (safe_require('export', 'leap/' . $plugin, 'lib.php', 'require_once', true)) {
$classname = 'LeapExport' . ucfirst($plugin);
if (class_exists($classname) && call_static_method($classname, 'override_entire_export')) {
$this->specialcases[$plugin] = array();
}
}
catch (Exception $e) { } #throw $e; } # not required
}
}
......
......@@ -124,13 +124,8 @@ class PluginImportLeap extends PluginImport {
$entryid = (string)$entry->id;
$this->trace(" * $entryid ({$entry->title})");
// TODO: do we need the disabled ones too? Export uses the disabled ones
foreach (plugins_installed('artefact', true) as $plugin) {
foreach (plugins_installed('artefact') as $plugin) {
$plugin = $plugin->name;
// TODO: unify this with how export does it. This
// implementation says: if artefact/x/import/leap/lib.php
// exists, it must implement the class. But it doesn't have to
// exist if the plugin doesn't wanna do leap import support.
if (safe_require('import', 'leap/' . $plugin, 'lib.php', 'require_once', true)) {
$classname = 'LeapImport' . ucfirst($plugin);
if (!is_subclass_of($classname, 'LeapImportArtefactPlugin')) {
......
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