mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-64291 GDPR export: Context paths can be very long, not unique
This commit is contained in:
parent
0e1e1e5586
commit
658bf9d554
@ -37,6 +37,11 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class moodle_content_writer implements content_writer {
|
||||
/**
|
||||
* Maximum context name char size.
|
||||
*/
|
||||
const MAX_CONTEXT_NAME_LENGTH = 32;
|
||||
|
||||
/**
|
||||
* @var string The base path on disk for this instance.
|
||||
*/
|
||||
@ -254,15 +259,17 @@ class moodle_content_writer implements content_writer {
|
||||
/**
|
||||
* Determine the path for the current context.
|
||||
*
|
||||
* @return array The context path.
|
||||
* @return array The context path.
|
||||
* @throws \coding_exception
|
||||
*/
|
||||
protected function get_context_path() : Array {
|
||||
protected function get_context_path() : array {
|
||||
$path = [];
|
||||
$contexts = array_reverse($this->context->get_parent_contexts(true));
|
||||
foreach ($contexts as $context) {
|
||||
$name = $context->get_context_name();
|
||||
$id = '_.' . $context->id;
|
||||
$path[] = shorten_filename(clean_param("{$name} {$id}", PARAM_FILE), MAX_FILENAME_SIZE, true);
|
||||
$id = ' _.' . $context->id;
|
||||
$path[] = shorten_text(clean_param($name, PARAM_FILE),
|
||||
self::MAX_CONTEXT_NAME_LENGTH, true, json_decode('"' . '\u2026' . '"')) . $id;
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user