The import_backup_helper class.  
 More...
|  | 
|  | __construct (remote_resource $remoteresource, stdClass $user, context $context) | 
|  | Constructor for the import backup helper. 
 | 
|  | 
|  | get_stored_file () | 
|  | Return a stored user draft file for processing. 
 | 
|  | 
|  | 
| static | get_context_for_user (int $userid) | 
|  | Looks for a context that this user has permission to upload backup files to. 
 | 
|  | 
|  | 
|  | create_user_draft_stored_file (string $filename, string $path) | 
|  | Create a file in the user drafts ready for use by plugins implementing dndupload_handle(). 
 | 
|  | 
|  | size_exceeds_upload_limit (int $sizeinbytes) | 
|  | Does the size exceed the upload limit for the current import, taking into account user and core settings. 
 | 
|  | 
|  | 
| context | $context | 
|  | $context The context we are trying to restore this file into. 
 | 
|  | 
| remote_resource | $remoteresource | 
|  | $remoteresource A file resource to be restored. 
 | 
|  | 
| user | $user | 
|  | $user The user trying to restore a file. 
 | 
|  | 
| int | $useruploadlimit | 
|  | $useruploadlimit The size limit that this user can upload in this context. 
 | 
|  | 
The import_backup_helper class. 
The import_backup_helper objects provide a means to prepare a backup for for restoration of a course or activity backup file.
- Copyright
- 2020 Adrian Greeve adria.nosp@m.n@mo.nosp@m.odle..nosp@m.com 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | tool_moodlenet\local\import_backup_helper::__construct | ( | remote_resource | $remoteresource, | 
        
          |  |  | stdClass | $user, | 
        
          |  |  | context | $context ) | 
      
 
Constructor for the import backup helper. 
- Parameters
- 
  
    | remote_resource | $remoteresource | A remote file resource |  | stdClass | $user | The user importing a file. |  | context | $context | Context to restore into. |  
 
 
 
◆ create_user_draft_stored_file()
  
  | 
        
          | tool_moodlenet\local\import_backup_helper::create_user_draft_stored_file | ( | string | $filename, |  
          |  |  | string | $path ) |  | protected | 
 
Create a file in the user drafts ready for use by plugins implementing dndupload_handle(). 
- Parameters
- 
  
    | string | $filename | the name of the file on disk |  | string | $path | the path where the file is stored on disk |  
 
- Return values
- 
  
  
 
 
◆ get_context_for_user()
  
  | 
        
          | static tool_moodlenet\local\import_backup_helper::get_context_for_user | ( | int | $userid | ) |  |  | static | 
 
Looks for a context that this user has permission to upload backup files to. 
This gets a list of roles that the user has, checks for the restore:uploadfile capability and then sends back a context that has this permission if available.
This starts with the highest context level and moves down i.e. system -> category -> course.
- Parameters
- 
  
    | int | $userid | The user ID that we are looking for a working context for. |  
 
- Return values
- 
  
    | context | A context that allows the upload of backup files. |  
 
 
 
◆ get_stored_file()
      
        
          | tool_moodlenet\local\import_backup_helper::get_stored_file | ( |  | ) |  | 
      
 
Return a stored user draft file for processing. 
- Return values
- 
  
    | stored_file | The imported file to ultimately be restored. |  
 
 
 
◆ size_exceeds_upload_limit()
  
  | 
        
          | tool_moodlenet\local\import_backup_helper::size_exceeds_upload_limit | ( | int | $sizeinbytes | ) |  |  | protected | 
 
Does the size exceed the upload limit for the current import, taking into account user and core settings. 
- Parameters
- 
  
  
- Return values
- 
  
    | bool | true if exceeded, false otherwise. |  
 
 
 
The documentation for this class was generated from the following file: