original_string: public static function expire($expiredrequests) {
          global $DB;
  
          $ids = array_keys($expiredrequests);
  
          if (count($ids) > 0) {
              list($insql, $inparams) = $DB->get_in_or_equal($ids);
              $initialparams = array(api::DATAREQUEST_STATUS_EXPIRED, time());
              $params = array_merge($initialparams, $inparams);
  
              $update = "UPDATE {" . self::TABLE . "}
                            SET status = ?, timemodified = ?
                          WHERE id $insql";
  
              if ($DB->execute($update, $params)) {
                  $fs = get_file_storage();
  
                  foreach ($expiredrequests as $id => $userid) {
                      $usercontext = \context_user::instance($userid);
                      $fs->delete_area_files($usercontext->id, 'tool_dataprivacy', 'export', $id);
                  }
              }
          }
      }
code: public static function expire($expiredrequests) {
          global $DB;
  
          $ids = array_keys($expiredrequests);
  
          if (count($ids) > 0) {
              list($insql, $inparams) = $DB->get_in_or_equal($ids);
              $initialparams = array(api::DATAREQUEST_STATUS_EXPIRED, time());
              $params = array_merge($initialparams, $inparams);
  
              $update = "UPDATE {" . self::TABLE . "}
                            SET status = ?, timemodified = ?
                          WHERE id $insql";
  
              if ($DB->execute($update, $params)) {
                  $fs = get_file_storage();
  
                  foreach ($expiredrequests as $id => $userid) {
                      $usercontext = \context_user::instance($userid);
                      $fs->delete_area_files($usercontext->id, 'tool_dataprivacy', 'export', $id);
                  }
              }
          }
      }
code_tokens: public static function expire ( $ expiredrequests ) { global $ DB ; $ ids = array_keys ( $ expiredrequests ) ; if ( count ( $ ids ) > 0 ) { list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ ids ) ; $ initialparams = array ( api :: DATAREQUEST_STATUS_EXPIRED , time ( ) ) ; $ params = array_merge ( $ initialparams , $ inparams ) ; $ update = "UPDATE {" . self :: TABLE . "}
                            SET status = ?, timemodified = ?
                          WHERE id $insql" ; if ( $ DB -> execute ( $ update , $ params ) ) { $ fs = get_file_storage ( ) ; foreach ( $ expiredrequests as $ id => $ userid ) { $ usercontext = \ context_user :: instance ( $ userid ) ; $ fs -> delete_area_files ( $ usercontext -> id , 'tool_dataprivacy' , 'export' , $ id ) ; } } } }
docstring: Expire a given set of data requests.
  Update request status and delete the files.
  
  @param array $expiredrequests [requestid => userid]
  
  @return void
docstring_tokens: Expire a given set of data requests . Update request status and delete the files .