Skip to content

Commit

Permalink
MDL-32880 - Adding generic block conversion handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Churchward committed Nov 5, 2012
1 parent 5036ed8 commit b346f7e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 84 deletions.
27 changes: 24 additions & 3 deletions backup/converter/moodle1/handlerlib.php
Expand Up @@ -88,10 +88,16 @@ protected static function get_plugin_handlers($type, moodle1_converter $converte
foreach ($plugins as $name => $dir) {
$handlerfile = $dir . '/backup/moodle1/lib.php';
$handlerclass = "moodle1_{$type}_{$name}_handler";
if (!file_exists($handlerfile)) {
continue;
if ($type != "block") {
if (!file_exists($handlerfile)) {
continue;
}
require_once($handlerfile);
} else {
if (!file_exists($handlerfile)) {
$handlerclass = "moodle1_block_generic_handler";
}
}
require_once($handlerfile);

if (!class_exists($handlerclass)) {
throw new moodle1_convert_exception('missing_handler_class', $handlerclass);
Expand Down Expand Up @@ -1988,6 +1994,14 @@ public function on_legacy_resource_end(array $data) {
* Base class for block handlers
*/
abstract class moodle1_block_handler extends moodle1_plugin_handler {

public function get_paths() {
$blockname = strtoupper($this->pluginname);
return array(
new convert_path('block', "/MOODLE_BACKUP/COURSE/BLOCKS/BLOCK/{$blockname}"),
);
}

public function process_block(array $data) {
$newdata = array();
$instanceid = $data['id'];
Expand Down Expand Up @@ -2047,6 +2061,13 @@ public function process_block(array $data) {
}


/**
* Base class for block generic handler
*/
class moodle1_block_generic_handler extends moodle1_block_handler {

}

/**
* Base class for the activity modules' subplugins
*/
Expand Down
81 changes: 0 additions & 81 deletions blocks/participants/backup/moodle1/lib.php

This file was deleted.

0 comments on commit b346f7e

Please sign in to comment.