Helper functions for asynchronous backups and restores.  
 More...
 | 
| 
string  | $backupid | 
|   | $backupid The id of the backup or restore. 
  | 
|   | 
| 
object  | $backuprec | 
|   | $backuprec The backup controller record from the database. 
  | 
|   | 
| 
string  | $type = 'backup' | 
|   | $type The type of async operation. 
  | 
|   | 
| 
object  | $user | 
|   | $user The user who created the backup record. 
  | 
|   | 
Helper functions for asynchronous backups and restores. 
- Copyright
 - 2019 Matt Porritt mattp.nosp@m.@cat.nosp@m.alyst.nosp@m.-au..nosp@m.net 
 
- License
 - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
 
 
◆ __construct()
      
        
          | async_helper::__construct  | 
          ( | 
            | 
          $type,  | 
        
        
           | 
           | 
            | 
          $id  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Class constructor. 
- Parameters
 - 
  
    | string | $type | The type of async operation.  | 
    | string | $id | The id of the backup or restore.  | 
  
   
 
 
◆ get_async_backups()
  
  
      
        
          | static async_helper::get_async_backups  | 
          ( | 
            | 
          $renderer,  | 
         
        
           | 
           | 
            | 
          $instanceid  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Get markup for in progress async backups, to use in backup table UI. 
- Parameters
 - 
  
    | core_backup_renderer | $renderer | The backup renderer object.  | 
    | integer | $instanceid | The context id to get backup data for.  | 
  
   
- Return values
 - 
  
    | array::$tabledata | the rows of table data.  | 
  
   
 
 
◆ get_async_restores()
  
  
      
        
          | static async_helper::get_async_restores  | 
          ( | 
            | 
          $userid | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Get all the current in progress async restores for a user. 
- Parameters
 - 
  
    | int | $userid | Moodle user id.  | 
  
   
- Return values
 - 
  
    | array::$restores | List of current restores in progress.  | 
  
   
 
 
◆ get_backup_file_info()
  
  
      
        
          | static async_helper::get_backup_file_info  | 
          ( | 
            | 
          $filename,  | 
         
        
           | 
           | 
            | 
          $filearea,  | 
         
        
           | 
           | 
            | 
          $contextid  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Get the size, url and restore url for a backup file. 
- Parameters
 - 
  
    | string | $filename | The name of the file to get info for.  | 
    | string | $filearea | The file area for the file.  | 
    | int | $contextid | The context ID of the file.  | 
  
   
- Return values
 - 
  
    | array::$results | The result array containing the size, url and restore url of the file.  | 
  
   
 
 
◆ get_backup_record()
  
  
      
        
          | static async_helper::get_backup_record  | 
          ( | 
            | 
          $id | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Given a backup id return a the record from the database. 
We use this method rather than 'load_controller' as the controller may not exist if this backup/restore has completed.
- Parameters
 - 
  
    | int | $id | The backup id to get.  | 
  
   
- Return values
 - 
  
    | object::$backuprec | The backup controller record.  | 
  
   
 
 
◆ get_restore_name()
  
  
      
        
          | static async_helper::get_restore_name  | 
          ( | 
          \context  | 
          $context | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Get the course name of the resource being restored. 
- Parameters
 - 
  
    | context | $context | The Moodle context for the restores.  | 
  
   
- Return values
 - 
  
    | string::$coursename | The full name of the course.  | 
  
   
 
 
◆ get_restore_url()
  
  
      
        
          | static async_helper::get_restore_url  | 
          ( | 
            | 
          $backupid | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Get the url of a restored backup item based on the backup ID. 
- Parameters
 - 
  
    | string | $backupid | The backup ID to get the restore location url.  | 
  
   
- Return values
 - 
  
    | array::$urlarray | The restored item URL as an array.  | 
  
   
 
 
◆ is_async_enabled()
  
  
      
        
          | static async_helper::is_async_enabled  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Check if asynchronous backup and restore mode is enabled at system level. 
- Return values
 - 
  
    | bool::$async | True if async mode enabled false otherwise.  | 
  
   
 
 
◆ is_async_pending()
  
  
      
        
          | static async_helper::is_async_pending  | 
          ( | 
            | 
          $id,  | 
         
        
           | 
           | 
            | 
          $type,  | 
         
        
           | 
           | 
            | 
          $operation  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Check if there is a pending async operation for given details. 
- Parameters
 - 
  
    | int | $id | The item id to check in the backup record.  | 
    | string | $type | The type of operation: course, activity or section.  | 
    | string | $operation | Operation backup or restore.  | 
  
   
- Return values
 - 
  
    | boolean::$asyncpedning | Is there a pending async operation.  | 
  
   
 
 
◆ send_message()
      
        
          | async_helper::send_message  | 
          ( | 
           | ) | 
           | 
        
      
 
Sends a confirmation message for an aynchronous process. 
- Return values
 - 
  
    | int::$messageid | The id of the sent message.  | 
  
   
 
 
The documentation for this class was generated from the following file:
- backup/util/helper/async_helper.class.php