public function putSnapshot( $id, $project, $db_path, $files_path ) {
		try {
			$db_result = $this->client->putObject(
				[
					'Bucket'     => self::getBucketName( $this->repository ),
					'Key'        => $project . '/' . $id . '/data.sql.gz',
					'SourceFile' => realpath( $db_path ),
				]
			);

			$files_result = $this->client->putObject(
				[
					'Bucket'     => self::getBucketName( $this->repository ),
					'Key'        => $project . '/' . $id . '/files.tar.gz',
					'SourceFile' => realpath( $files_path ),
				]
			);

			/**
			 * Wait for files first since that will probably take longer
			 */
			$this->client->waitUntil(
				'ObjectExists', [
					'Bucket' => self::getBucketName( $this->repository ),
					'Key'    => $project . '/' . $id . '/files.tar.gz',
				]
			);

			$this->client->waitUntil(
				'ObjectExists', [
					'Bucket' => self::getBucketName( $this->repository ),
					'Key'    => $project . '/' . $id . '/data.sql.gz',
				]
			);
		} catch ( \Exception $e ) {
			if ( ! empty( $files_result ) && 'AccessDenied' === $files_result->data['aws_error_code'] ) {
				Log::instance()->write( 'Access denied. You might not have access to this project.', 0, 'error' );
			}

			Log::instance()->write( 'Error Message: ' . $e->getMessage(), 1, 'error' );
			Log::instance()->write( 'AWS Request ID: ' . $e->getAwsRequestId(), 1, 'error' );
			Log::instance()->write( 'AWS Error Type: ' . $e->getAwsErrorType(), 1, 'error' );
			Log::instance()->write( 'AWS Error Code: ' . $e->getAwsErrorCode(), 1, 'error' );

			return false;
		}

		return true;
	}
public function putSnapshot( $id, $project, $db_path, $files_path ) {
		try {
			$db_result = $this->client->putObject(
				[
					'Bucket'     => self::getBucketName( $this->repository ),
					'Key'        => $project . '/' . $id . '/data.sql.gz',
					'SourceFile' => realpath( $db_path ),
				]
			);

			$files_result = $this->client->putObject(
				[
					'Bucket'     => self::getBucketName( $this->repository ),
					'Key'        => $project . '/' . $id . '/files.tar.gz',
					'SourceFile' => realpath( $files_path ),
				]
			);

			/**
			 * Wait for files first since that will probably take longer
			 */
			$this->client->waitUntil(
				'ObjectExists', [
					'Bucket' => self::getBucketName( $this->repository ),
					'Key'    => $project . '/' . $id . '/files.tar.gz',
				]
			);

			$this->client->waitUntil(
				'ObjectExists', [
					'Bucket' => self::getBucketName( $this->repository ),
					'Key'    => $project . '/' . $id . '/data.sql.gz',
				]
			);
		} catch ( \Exception $e ) {
			if ( ! empty( $files_result ) && 'AccessDenied' === $files_result->data['aws_error_code'] ) {
				Log::instance()->write( 'Access denied. You might not have access to this project.', 0, 'error' );
			}

			Log::instance()->write( 'Error Message: ' . $e->getMessage(), 1, 'error' );
			Log::instance()->write( 'AWS Request ID: ' . $e->getAwsRequestId(), 1, 'error' );
			Log::instance()->write( 'AWS Error Type: ' . $e->getAwsErrorType(), 1, 'error' );
			Log::instance()->write( 'AWS Error Code: ' . $e->getAwsErrorCode(), 1, 'error' );

			return false;
		}

		return true;
	}
public function putSnapshot ( $ id , $ project , $ db_path , $ files_path ) { try { $ db_result = $ this -> client -> putObject ( [ 'Bucket' => self :: getBucketName ( $ this -> repository ) , 'Key' => $ project . '/' . $ id . '/data.sql.gz' , 'SourceFile' => realpath ( $ db_path ) , ] ) ; $ files_result = $ this -> client -> putObject ( [ 'Bucket' => self :: getBucketName ( $ this -> repository ) , 'Key' => $ project . '/' . $ id . '/files.tar.gz' , 'SourceFile' => realpath ( $ files_path ) , ] ) ; /**
			 * Wait for files first since that will probably take longer
			 */ $ this -> client -> waitUntil ( 'ObjectExists' , [ 'Bucket' => self :: getBucketName ( $ this -> repository ) , 'Key' => $ project . '/' . $ id . '/files.tar.gz' , ] ) ; $ this -> client -> waitUntil ( 'ObjectExists' , [ 'Bucket' => self :: getBucketName ( $ this -> repository ) , 'Key' => $ project . '/' . $ id . '/data.sql.gz' , ] ) ; } catch ( \ Exception $ e ) { if ( ! empty ( $ files_result ) && 'AccessDenied' === $ files_result -> data [ 'aws_error_code' ] ) { Log :: instance ( ) -> write ( 'Access denied. You might not have access to this project.' , 0 , 'error' ) ; } Log :: instance ( ) -> write ( 'Error Message: ' . $ e -> getMessage ( ) , 1 , 'error' ) ; Log :: instance ( ) -> write ( 'AWS Request ID: ' . $ e -> getAwsRequestId ( ) , 1 , 'error' ) ; Log :: instance ( ) -> write ( 'AWS Error Type: ' . $ e -> getAwsErrorType ( ) , 1 , 'error' ) ; Log :: instance ( ) -> write ( 'AWS Error Code: ' . $ e -> getAwsErrorCode ( ) , 1 , 'error' ) ; return false ; } return true ; }
Upload a snapshot to S3 given a path to files.tar.gz and data.sql.gz

@param  string $id         Snapshot ID
@param  string $project    Project slug
@param  string $db_path    Path to data.sql.gz
@param  string $files_path Path to files.tar.gz
@return bool|error
Upload a snapshot to S3 given a path to files . tar . gz and data . sql . gz