MDL-62134 tool_dataprivacy: Add a manager_observer

This commit is contained in:
Andrew Nicols
2018-05-16 11:52:46 +08:00
parent 22c0a30888
commit 8760b7335b
6 changed files with 139 additions and 35 deletions
@@ -33,7 +33,6 @@ use moodle_exception;
use moodle_url;
use tool_dataprivacy\api;
use tool_dataprivacy\data_request;
use tool_dataprivacy\manager;
defined('MOODLE_INTERNAL') || die();
@@ -88,7 +87,9 @@ class process_data_request_task extends adhoc_task {
$approvedclcollection = api::get_approved_contextlist_collection_for_request($requestpersistent);
// Export the data.
$manager = new manager();
$manager = new \core_privacy\manager();
$manager->set_observer(new \tool_dataprivacy\manager_observer());
$exportedcontent = $manager->export_user_data($approvedclcollection);
$fs = get_file_storage();
@@ -110,7 +111,9 @@ class process_data_request_task extends adhoc_task {
$approvedclcollection = api::get_approved_contextlist_collection_for_request($requestpersistent);
// Delete the data.
$manager = new manager();
$manager = new \core_privacy\manager();
$manager->set_observer(new \tool_dataprivacy\manager_observer());
$manager->delete_data_for_user($approvedclcollection);
}