original_string: public function delete_data_for_user(contextlist_collection $contextlistcollection) {
          $progress = static::get_log_tracer();
  
          $a = (object) [
              'total' => count($contextlistcollection),
              'progress' => 0,
              'component' => '',
              'datetime' => userdate(time()),
          ];
  
          // Delete the data.
          $progress->output(get_string('trace:deletingapproved', 'core_privacy', $a), 1);
          foreach ($contextlistcollection as $approvedcontextlist) {
              if (!$approvedcontextlist instanceof \core_privacy\local\request\approved_contextlist) {
                  throw new \moodle_exception('Contextlist must be an approved_contextlist');
              }
  
              $component = $approvedcontextlist->get_component();
              $a->component = $component;
              $a->progress++;
              $a->datetime = userdate(time());
              $progress->output(get_string('trace:processingcomponent', 'core_privacy', $a), 2);
  
              if (count($approvedcontextlist)) {
                  // The component knows about data that it has.
                  // Have it delete its own data.
                  $this->handled_component_class_callback($approvedcontextlist->get_component(), core_user_data_provider::class,
                      'delete_data_for_user', [$approvedcontextlist]);
              }
  
              // Delete any shared user data it doesn't know about.
              local\request\helper::delete_data_for_user($approvedcontextlist);
          }
          $progress->output(get_string('trace:done', 'core_privacy'), 1);
      }
code: public function delete_data_for_user(contextlist_collection $contextlistcollection) {
          $progress = static::get_log_tracer();
  
          $a = (object) [
              'total' => count($contextlistcollection),
              'progress' => 0,
              'component' => '',
              'datetime' => userdate(time()),
          ];
  
          // Delete the data.
          $progress->output(get_string('trace:deletingapproved', 'core_privacy', $a), 1);
          foreach ($contextlistcollection as $approvedcontextlist) {
              if (!$approvedcontextlist instanceof \core_privacy\local\request\approved_contextlist) {
                  throw new \moodle_exception('Contextlist must be an approved_contextlist');
              }
  
              $component = $approvedcontextlist->get_component();
              $a->component = $component;
              $a->progress++;
              $a->datetime = userdate(time());
              $progress->output(get_string('trace:processingcomponent', 'core_privacy', $a), 2);
  
              if (count($approvedcontextlist)) {
                  // The component knows about data that it has.
                  // Have it delete its own data.
                  $this->handled_component_class_callback($approvedcontextlist->get_component(), core_user_data_provider::class,
                      'delete_data_for_user', [$approvedcontextlist]);
              }
  
              // Delete any shared user data it doesn't know about.
              local\request\helper::delete_data_for_user($approvedcontextlist);
          }
          $progress->output(get_string('trace:done', 'core_privacy'), 1);
      }
code_tokens: public function delete_data_for_user ( contextlist_collection $ contextlistcollection ) { $ progress = static :: get_log_tracer ( ) ; $ a = ( object ) [ 'total' => count ( $ contextlistcollection ) , 'progress' => 0 , 'component' => '' , 'datetime' => userdate ( time ( ) ) , ] ; // Delete the data. $ progress -> output ( get_string ( 'trace:deletingapproved' , 'core_privacy' , $ a ) , 1 ) ; foreach ( $ contextlistcollection as $ approvedcontextlist ) { if ( ! $ approvedcontextlist instanceof \ core_privacy \ local \ request \ approved_contextlist ) { throw new \ moodle_exception ( 'Contextlist must be an approved_contextlist' ) ; } $ component = $ approvedcontextlist -> get_component ( ) ; $ a -> component = $ component ; $ a -> progress ++ ; $ a -> datetime = userdate ( time ( ) ) ; $ progress -> output ( get_string ( 'trace:processingcomponent' , 'core_privacy' , $ a ) , 2 ) ; if ( count ( $ approvedcontextlist ) ) { // The component knows about data that it has. // Have it delete its own data. $ this -> handled_component_class_callback ( $ approvedcontextlist -> get_component ( ) , core_user_data_provider :: class , 'delete_data_for_user' , [ $ approvedcontextlist ] ) ; } // Delete any shared user data it doesn't know about. local \ request \ helper :: delete_data_for_user ( $ approvedcontextlist ) ; } $ progress -> output ( get_string ( 'trace:done' , 'core_privacy' ) , 1 ) ; }
docstring: Delete all user data for approved contexts lists provided in the collection.
  
  This call relates to the forgetting of an entire user.
  
  Note: userid and component are stored in each respective approved_contextlist.
  
  @param contextlist_collection $contextlistcollection the collections of approved_contextlist items on which to call deletion.
  @throws \moodle_exception if the contextlist_collection doesn't contain all approved_contextlist items, or if the component
  for an approved_contextlist isn't a core provider.
docstring_tokens: Delete all user data for approved contexts lists provided in the collection .