MDL-21432 backup - Small change in API after discussion in MDL-22245
This commit is contained in:
@@ -309,7 +309,7 @@ class backup_course_structure_step extends backup_structure_step {
|
||||
JOIN {tag_instance} ti ON ti.tagid = t.id
|
||||
WHERE ti.itemtype = ?
|
||||
AND ti.itemid = ?', array(
|
||||
$this->is_sqlparam('course'),
|
||||
backup_helper::is_sqlparam('course'),
|
||||
backup::VAR_PARENTID));
|
||||
|
||||
$module->set_source_sql('SELECT m.name AS modulename
|
||||
@@ -795,9 +795,9 @@ class backup_users_structure_step extends backup_structure_step {
|
||||
WHERE bi.backupid = ?
|
||||
AND bi.itemname = ?
|
||||
AND c.contextlevel = ?', array(
|
||||
$this->is_sqlparam($this->get_backupid()),
|
||||
$this->is_sqlparam('userfinal'),
|
||||
$this->is_sqlparam(CONTEXT_USER)));
|
||||
backup_helper::is_sqlparam($this->get_backupid()),
|
||||
backup_helper::is_sqlparam('userfinal'),
|
||||
backup_helper::is_sqlparam(CONTEXT_USER)));
|
||||
|
||||
// All the rest on information is only added if we arent
|
||||
// in an anonymized backup
|
||||
@@ -816,7 +816,7 @@ class backup_users_structure_step extends backup_structure_step {
|
||||
JOIN {tag_instance} ti ON ti.tagid = t.id
|
||||
WHERE ti.itemtype = ?
|
||||
AND ti.itemid = ?', array(
|
||||
$this->is_sqlparam('user'),
|
||||
backup_helper::is_sqlparam('user'),
|
||||
backup::VAR_PARENTID));
|
||||
|
||||
$preference->set_source_table('user_preferences', array('userid' => backup::VAR_PARENTID));
|
||||
@@ -948,7 +948,7 @@ class backup_inforef_structure_step extends backup_structure_step {
|
||||
FROM {backup_ids_temp}
|
||||
WHERE backupid = ?
|
||||
AND itemname = ?",
|
||||
array(backup::VAR_BACKUPID, $this->is_sqlparam($itemname)));
|
||||
array(backup::VAR_BACKUPID, backup_helper::is_sqlparam($itemname)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +271,16 @@ abstract class backup_helper {
|
||||
}
|
||||
return $fs->create_file_from_pathname($fr, $filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function simply marks one param to be considered as straight sql
|
||||
* param, so it won't be searched in the structure tree nor converted at
|
||||
* all. Useful for better integration of definition of sources in structure
|
||||
* and DB stuff
|
||||
*/
|
||||
public static function is_sqlparam($value) {
|
||||
return array('sqlparam' => $value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -95,17 +95,6 @@ abstract class backup_structure_step extends backup_step {
|
||||
|
||||
// Protected API starts here
|
||||
|
||||
/**
|
||||
* This function simply marks one param to be considered as straight sql
|
||||
* param, so it won't be searched in the structure tree nor converted at
|
||||
* all. Useful for better integration of definition of sources in structure
|
||||
* and DB stuff.
|
||||
*/
|
||||
protected function is_sqlparam($value) {
|
||||
return array('sqlparam' => $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that will return the structure to be processed by this backup_step.
|
||||
* Must return one backup_nested_element
|
||||
|
||||
@@ -45,7 +45,7 @@ class backup_rss_client_block_structure_step extends backup_block_structure_step
|
||||
list($in_sql, $in_params) = $DB->get_in_or_equal($feedids);
|
||||
// Define all the in_params as sqlparams
|
||||
foreach ($in_params as $key => $value) {
|
||||
$in_params[$key] = $this->is_sqlparam($value);
|
||||
$in_params[$key] = backup_helper::is_sqlparam($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user