public static function is_async_pending($id, $type, $operation) {
        global $DB, $USER, $CFG;
        $asyncpending = false;

        // Only check for pending async operations if async mode is enabled.
        require_once($CFG->dirroot . '/backup/util/interfaces/checksumable.class.php');
        require_once($CFG->dirroot . '/backup/backup.class.php');

        if (self::is_async_enabled()) {
            $select = 'userid = ? AND itemid = ? AND type = ? AND operation = ? AND execution = ? AND status < ? AND status > ?';
            $params = array(
                $USER->id,
                $id,
                $type,
                $operation,
                backup::EXECUTION_DELAYED,
                backup::STATUS_FINISHED_ERR,
                backup::STATUS_NEED_PRECHECK
            );
            $asyncpending = $DB->record_exists_select('backup_controllers', $select, $params);
        }
        return $asyncpending;
    }
public static function is_async_pending($id, $type, $operation) {
        global $DB, $USER, $CFG;
        $asyncpending = false;

        // Only check for pending async operations if async mode is enabled.
        require_once($CFG->dirroot . '/backup/util/interfaces/checksumable.class.php');
        require_once($CFG->dirroot . '/backup/backup.class.php');

        if (self::is_async_enabled()) {
            $select = 'userid = ? AND itemid = ? AND type = ? AND operation = ? AND execution = ? AND status < ? AND status > ?';
            $params = array(
                $USER->id,
                $id,
                $type,
                $operation,
                backup::EXECUTION_DELAYED,
                backup::STATUS_FINISHED_ERR,
                backup::STATUS_NEED_PRECHECK
            );
            $asyncpending = $DB->record_exists_select('backup_controllers', $select, $params);
        }
        return $asyncpending;
    }
public static function is_async_pending ( $ id , $ type , $ operation ) { global $ DB , $ USER , $ CFG ; $ asyncpending = false ; // Only check for pending async operations if async mode is enabled. require_once ( $ CFG -> dirroot . '/backup/util/interfaces/checksumable.class.php' ) ; require_once ( $ CFG -> dirroot . '/backup/backup.class.php' ) ; if ( self :: is_async_enabled ( ) ) { $ select = 'userid = ? AND itemid = ? AND type = ? AND operation = ? AND execution = ? AND status < ? AND status > ?' ; $ params = array ( $ USER -> id , $ id , $ type , $ operation , backup :: EXECUTION_DELAYED , backup :: STATUS_FINISHED_ERR , backup :: STATUS_NEED_PRECHECK ) ; $ asyncpending = $ DB -> record_exists_select ( 'backup_controllers' , $ select , $ params ) ; } return $ asyncpending ; }
Check if there is a pending async operation for given details.

@param int $id The item id to check in the backup record.
@param string $type The type of operation: course, activity or section.
@param string $operation Operation backup or restore.
@return boolean $asyncpedning Is there a pending async operation.
Check if there is a pending async operation for given details .