mirror of
https://github.com/moodle/moodle.git
synced 2025-04-18 23:15:38 +02:00
Merge branch 'MDL-45574-master' of https://github.com/sammarshallou/moodle
This commit is contained in:
commit
3566ea16a8
@ -103,7 +103,18 @@ abstract class backup_structure_dbops extends backup_dbops {
|
||||
}
|
||||
}
|
||||
|
||||
public static function annotate_files($backupid, $contextid, $component, $filearea, $itemid) {
|
||||
/**
|
||||
* Adds backup id database record for all files in the given file area.
|
||||
*
|
||||
* @param string $backupid Backup ID
|
||||
* @param int $contextid Context id
|
||||
* @param string $component Component
|
||||
* @param string $filearea File area
|
||||
* @param int $itemid Item id
|
||||
* @param \core\progress\base $progress
|
||||
*/
|
||||
public static function annotate_files($backupid, $contextid, $component, $filearea, $itemid,
|
||||
\core\progress\base $progress = null) {
|
||||
global $DB;
|
||||
$sql = 'SELECT id
|
||||
FROM {files}
|
||||
@ -120,10 +131,19 @@ abstract class backup_structure_dbops extends backup_dbops {
|
||||
$sql .= ' AND itemid = ?';
|
||||
$params[] = $itemid;
|
||||
}
|
||||
if ($progress) {
|
||||
$progress->start_progress('');
|
||||
}
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
foreach ($rs as $record) {
|
||||
if ($progress) {
|
||||
$progress->progress();
|
||||
}
|
||||
self::insert_backup_ids_record($backupid, 'file', $record->id);
|
||||
}
|
||||
if ($progress) {
|
||||
$progress->end_progress();
|
||||
}
|
||||
$rs->close();
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class backup_structure_processor extends base_processor {
|
||||
foreach ($area as $filearea => $info) {
|
||||
$contextid = !is_null($info->contextid) ? $info->contextid : $this->get_var(backup::VAR_CONTEXTID);
|
||||
$itemid = !is_null($info->element) ? $info->element->get_value() : null;
|
||||
backup_structure_dbops::annotate_files($backupid, $contextid, $component, $filearea, $itemid);
|
||||
backup_structure_dbops::annotate_files($backupid, $contextid, $component, $filearea, $itemid, $this->progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user