Acquia\CloudApi\Client\CloudApi::getDatabaseBackupLocation PHP Method

getDatabaseBackupLocation() public method

Get the location from which a backup can be downloaded.
public getDatabaseBackupLocation ( $site, $env, $db, $backup )
$site the site name (ex: tangle001, gardener, etc.)
$env the environment name (ex: prod, dev)
$db the database name (ex: 'g76')
$backup the backup id (ex: 217005)
    public function getDatabaseBackupLocation($site, $env, $db, $backup)
    {
        $method = 'GET';
        $resource = sprintf('/sites/%s/envs/%s/dbs/%s/backups/%s/download', $this->getSiteName($site), $env, $db, $backup);
        $options = array('include_header' => TRUE);
        $result = $this->callAcapi($site, $method, $resource, array(), array(), $options);
        // Now parse the HTTP header, find the location.
        $matches = array();
        if (1 == preg_match('/^Location: (.*)$/m', $result['content'], $matches)) {
            $result['result'] = $matches[1];
        } else {
            throw new CloudApiException(sprintf('BACKUP_NOT_FOUND: Could not find backup %s', $backup));
        }
        return $result['result'];
    }