MDL-23478 backup - adding support for fileareas to blocks

This commit is contained in:
Eloy Lafuente 2010-07-23 17:36:38 +00:00
parent 38588c1ddf
commit 4a15bb7660
6 changed files with 23 additions and 1 deletions

View File

@ -195,6 +195,11 @@ abstract class backup_block_task extends backup_task {
*/ */
abstract protected function define_my_steps(); abstract protected function define_my_steps();
/**
* Define one array() of fileareas that each block controls
*/
abstract public function get_fileareas();
/** /**
* Define one array() of configdata attributes * Define one array() of configdata attributes
* that need to be processed by the contenttransformer * that need to be processed by the contenttransformer

View File

@ -38,6 +38,10 @@ class backup_default_block_task extends backup_block_task {
protected function define_my_steps() { protected function define_my_steps() {
} }
public function get_fileareas() {
return array();
}
public function get_configdata_encoded_attributes() { public function get_configdata_encoded_attributes() {
return array(); return array();
} }

View File

@ -1049,6 +1049,11 @@ class backup_block_instance_structure_step extends backup_structure_step {
$positions->set_source_table('block_positions', array('blockinstanceid' => backup::VAR_PARENTID)); $positions->set_source_table('block_positions', array('blockinstanceid' => backup::VAR_PARENTID));
// File anotations (for fileareas specified on each block)
foreach ($this->task->get_fileareas() as $filearea) {
$block->annotate_files('block_' . $this->task->get_blockname(), $filearea, null);
}
// Return the root element (block) // Return the root element (block)
return $block; return $block;
} }

View File

@ -43,7 +43,7 @@ abstract class restore_dbops {
$included = false; $included = false;
// blocks, based in blocks setting and parent activity/course // blocks, based in blocks setting and parent activity/course
if ($task instanceof restore_block_task) { if ($task instanceof restore_block_task) {
if (!$task->get_setting('blocks')) { // Blocks not included, continue if (!$task->get_setting_value('blocks')) { // Blocks not included, continue
continue; continue;
} }
$parent = basename(dirname(dirname($task->get_taskbasepath()))); $parent = basename(dirname(dirname($task->get_taskbasepath())));

View File

@ -36,6 +36,10 @@ class backup_html_block_task extends backup_block_task {
protected function define_my_steps() { protected function define_my_steps() {
} }
public function get_fileareas() {
return array('content');
}
public function get_configdata_encoded_attributes() { public function get_configdata_encoded_attributes() {
return array('text'); // We need to encode some attrs in configdata return array('text'); // We need to encode some attrs in configdata
} }

View File

@ -42,6 +42,10 @@ class backup_rss_client_block_task extends backup_block_task {
$this->add_step(new backup_rss_client_block_structure_step('rss_client_structure', 'rss_client.xml')); $this->add_step(new backup_rss_client_block_structure_step('rss_client_structure', 'rss_client.xml'));
} }
public function get_fileareas() {
return array(); // No associated fileareas
}
public function get_configdata_encoded_attributes() { public function get_configdata_encoded_attributes() {
return array(); // No special handling of configdata return array(); // No special handling of configdata
} }