original_string: public static function get_async_backups($renderer, $instanceid) {
          global $DB;
  
          $tabledata = array();
  
          // Get relevant backup ids based on context instance id.
          $select = 'itemid = ? AND execution = ? AND status < ? AND status > ?';
          $params = array($instanceid, backup::EXECUTION_DELAYED, backup::STATUS_FINISHED_ERR, backup::STATUS_NEED_PRECHECK);
          $backups = $DB->get_records_select('backup_controllers', $select, $params, 'timecreated DESC', 'id, backupid, timecreated');
  
          foreach ($backups as $backup) {
              $bc = \backup_controller::load_controller($backup->backupid);  // Get the backup controller.
              $filename = $bc->get_plan()->get_setting('filename')->get_value();
              $timecreated = $backup->timecreated;
              $status = $renderer->get_status_display($bc->get_status(), $bc->get_backupid());
  
              $tablerow = array($filename, userdate($timecreated), '-', '-', '-', $status);
              $tabledata[] = $tablerow;
          }
  
          return $tabledata;
      }
code: public static function get_async_backups($renderer, $instanceid) {
          global $DB;
  
          $tabledata = array();
  
          // Get relevant backup ids based on context instance id.
          $select = 'itemid = ? AND execution = ? AND status < ? AND status > ?';
          $params = array($instanceid, backup::EXECUTION_DELAYED, backup::STATUS_FINISHED_ERR, backup::STATUS_NEED_PRECHECK);
          $backups = $DB->get_records_select('backup_controllers', $select, $params, 'timecreated DESC', 'id, backupid, timecreated');
  
          foreach ($backups as $backup) {
              $bc = \backup_controller::load_controller($backup->backupid);  // Get the backup controller.
              $filename = $bc->get_plan()->get_setting('filename')->get_value();
              $timecreated = $backup->timecreated;
              $status = $renderer->get_status_display($bc->get_status(), $bc->get_backupid());
  
              $tablerow = array($filename, userdate($timecreated), '-', '-', '-', $status);
              $tabledata[] = $tablerow;
          }
  
          return $tabledata;
      }
code_tokens: public static function get_async_backups ( $ renderer , $ instanceid ) { global $ DB ; $ tabledata = array ( ) ; // Get relevant backup ids based on context instance id. $ select = 'itemid = ? AND execution = ? AND status < ? AND status > ?' ; $ params = array ( $ instanceid , backup :: EXECUTION_DELAYED , backup :: STATUS_FINISHED_ERR , backup :: STATUS_NEED_PRECHECK ) ; $ backups = $ DB -> get_records_select ( 'backup_controllers' , $ select , $ params , 'timecreated DESC' , 'id, backupid, timecreated' ) ; foreach ( $ backups as $ backup ) { $ bc = \ backup_controller :: load_controller ( $ backup -> backupid ) ; // Get the backup controller. $ filename = $ bc -> get_plan ( ) -> get_setting ( 'filename' ) -> get_value ( ) ; $ timecreated = $ backup -> timecreated ; $ status = $ renderer -> get_status_display ( $ bc -> get_status ( ) , $ bc -> get_backupid ( ) ) ; $ tablerow = array ( $ filename , userdate ( $ timecreated ) , '-' , '-' , '-' , $ status ) ; $ tabledata [ ] = $ tablerow ; } return $ tabledata ; }
docstring: Get markup for in progress async backups,
  to use in backup table UI.
  
  @param \core_backup_renderer $renderer The backup renderer object.
  @param integer $instanceid The context id to get backup data for.
  @return array $tabledata the rows of table data.
docstring_tokens: Get markup for in progress async backups to use in backup table UI .