mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-23478 backup - adding support for fileareas to blocks
This commit is contained in:
parent
38588c1ddf
commit
4a15bb7660
@ -195,6 +195,11 @@ abstract class backup_block_task extends backup_task {
|
||||
*/
|
||||
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
|
||||
* that need to be processed by the contenttransformer
|
||||
|
@ -38,6 +38,10 @@ class backup_default_block_task extends backup_block_task {
|
||||
protected function define_my_steps() {
|
||||
}
|
||||
|
||||
public function get_fileareas() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function get_configdata_encoded_attributes() {
|
||||
return array();
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
// 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 $block;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ abstract class restore_dbops {
|
||||
$included = false;
|
||||
// blocks, based in blocks setting and parent activity/course
|
||||
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;
|
||||
}
|
||||
$parent = basename(dirname(dirname($task->get_taskbasepath())));
|
||||
|
@ -36,6 +36,10 @@ class backup_html_block_task extends backup_block_task {
|
||||
protected function define_my_steps() {
|
||||
}
|
||||
|
||||
public function get_fileareas() {
|
||||
return array('content');
|
||||
}
|
||||
|
||||
public function get_configdata_encoded_attributes() {
|
||||
return array('text'); // We need to encode some attrs in configdata
|
||||
}
|
||||
|
@ -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'));
|
||||
}
|
||||
|
||||
public function get_fileareas() {
|
||||
return array(); // No associated fileareas
|
||||
}
|
||||
|
||||
public function get_configdata_encoded_attributes() {
|
||||
return array(); // No special handling of configdata
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user