Skip to content

Commit

Permalink
MDL-23478 backup - adding support for fileareas to blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jul 23, 2010
1 parent 38588c1 commit 4a15bb7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions backup/moodle2/backup_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ abstract protected function define_my_settings();
*/
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
Expand Down
4 changes: 4 additions & 0 deletions backup/moodle2/backup_default_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ protected function define_my_settings() {
protected function define_my_steps() {
}

public function get_fileareas() {
return array();
}

public function get_configdata_encoded_attributes() {
return array();
}
Expand Down
5 changes: 5 additions & 0 deletions backup/moodle2/backup_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,11 @@ protected function define_structure() {

$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;
}
Expand Down
2 changes: 1 addition & 1 deletion backup/util/dbops/restore_dbops.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function get_needed_inforef_files($restoreid) {
$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())));
Expand Down
4 changes: 4 additions & 0 deletions blocks/html/backup/moodle2/backup_html_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ protected function define_my_settings() {
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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ protected function define_my_steps() {
$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
}
Expand Down

0 comments on commit 4a15bb7

Please sign in to comment.