Documentation

UploadSyncBuilder extends AbstractSyncBuilder
in package

Table of Contents

Properties

$acp  : string|Acp
$baseDir  : string
$bucket  : string
$client  : S3Client
$concurrency  : int
$debug  : bool
$delimiter  : string
$forcing  : bool
$keyPrefix  : string
$multipartUploadSize  : int
$params  : array<string|int, mixed>
$sourceConverter  : FilenameConverterInterface
$sourceIterator  : Iterator
$targetConverter  : FilenameConverterInterface

Methods

addRegexFilter()  : $this
Add a filename filter that uses a regular expression to filter out files that you do not wish to transfer.
build()  : AbstractSync
Builds a UploadSync or DownloadSync object
enableDebugOutput()  : $this
Enable debug mode
force()  : $this
Set to true to force transfers even if a file already exists and has not changed
getInstance()  : static
setAcl()  : $this
Set a canned ACL to apply to each uploaded object
setAcp()  : $this
Set an Access Control Policy to apply to each uploaded object
setBaseDir()  : $this
Set the base directory of the files being transferred. The base directory is removed from each file path before converting the file path to an object key or vice versa.
setBucket()  : $this
Set the bucket to use with the sync
setClient()  : $this
Set the Amazon S3 client object that will send requests
setConcurrency()  : $this
Set the number of files that can be transferred concurrently
setDelimiter()  : $this
Specify the delimiter used for the targeted filesystem (default delimiter is "/")
setKeyPrefix()  : $this
Specify a prefix to prepend to each Amazon S3 object key or the prefix where object are stored in a bucket
setMultipartUploadSize()  : $this
Set the multipart upload size threshold. When the size of a file exceeds this value, the file will be uploaded using a multipart upload.
setOperationParams()  : $this
Specify an array of operation parameters to apply to each operation executed by the sync object
setSourceFilenameConverter()  : $this
Set a custom object key provider instead of building one internally
setSourceIterator()  : $this
Set a custom iterator that returns \SplFileInfo objects for the source data
setTargetFilenameConverter()  : $this
Set a custom object key provider instead of building one internally
uploadFromDirectory()  : $this
Set the path that contains files to recursively upload to Amazon S3
uploadFromGlob()  : $this
Set a glob expression that will match files to upload to Amazon S3
addCustomParamListener()  : mixed
Add the custom param listener to a transfer object
addDebugListener()  : mixed
Add a listener to the sync object to output debug information while transferring
assertFileIteratorSet()  : mixed
Ensure that the base file iterator has been provided
createS3Iterator()  : OpendirIterator
Create an Amazon S3 file iterator based on the given builder settings
filterIterator()  : Iterator
Wraps a generated iterator in a filter iterator that removes directories
getDefaultSourceConverter()  : FilenameConverterInterface
getDefaultTargetConverter()  : FilenameConverterInterface
getTargetIterator()  : Iterator
specificBuild()  : AbstractSync
Hook to implement in subclasses
validateRequirements()  : mixed
Validate that the builder has the minimal requirements

Properties

$baseDir

protected string $baseDir

Base directory to remove from each file path before converting to an object name or file name

$concurrency

protected int $concurrency = 10

Number of files that can be transferred concurrently

$forcing

protected bool $forcing = false

Whether or not to only transfer modified or new files

$keyPrefix

protected string $keyPrefix = ''

Prefix at prepend to each Amazon S3 object key

$params

protected array<string|int, mixed> $params = array()

Custom parameters to add to each operation sent while transferring

$sourceIterator

protected Iterator $sourceIterator

Iterator that returns SplFileInfo objects to upload

Methods

addRegexFilter()

Add a filename filter that uses a regular expression to filter out files that you do not wish to transfer.

public addRegexFilter(string $search) : $this
Parameters
$search : string

Regular expression search (in preg_match format). Any filename that matches this regex will not be transferred.

Return values
$this

enableDebugOutput()

Enable debug mode

public enableDebugOutput([bool|resource $enabledOrResource = true ]) : $this
Parameters
$enabledOrResource : bool|resource = true

Set to true or false to enable or disable debug output. Pass an opened fopen resource to write to instead of writing to standard out.

Return values
$this

force()

Set to true to force transfers even if a file already exists and has not changed

public force([bool $force = false ]) : $this
Parameters
$force : bool = false

Set to true to force transfers without checking if it has changed

Return values
$this

setAcl()

Set a canned ACL to apply to each uploaded object

public setAcl(string $acl) : $this
Parameters
$acl : string

Canned ACL for each upload

Return values
$this

setAcp()

Set an Access Control Policy to apply to each uploaded object

public setAcp(Acp $acp) : $this
Parameters
$acp : Acp

Access control policy

Return values
$this

setBaseDir()

Set the base directory of the files being transferred. The base directory is removed from each file path before converting the file path to an object key or vice versa.

public setBaseDir(string $baseDir) : $this
Parameters
$baseDir : string

Base directory, which will be deleted from each uploaded object key

Return values
$this

setBucket()

Set the bucket to use with the sync

public setBucket(string $bucket) : $this
Parameters
$bucket : string

Amazon S3 bucket name

Return values
$this

setClient()

Set the Amazon S3 client object that will send requests

public setClient(S3Client $client) : $this
Parameters
$client : S3Client

Amazon S3 client

Return values
$this

setConcurrency()

Set the number of files that can be transferred concurrently

public setConcurrency(int $concurrency) : $this
Parameters
$concurrency : int

Number of concurrent transfers

Return values
$this

setDelimiter()

Specify the delimiter used for the targeted filesystem (default delimiter is "/")

public setDelimiter(string $delimiter) : $this
Parameters
$delimiter : string

Delimiter to use to separate paths

Return values
$this

setKeyPrefix()

Specify a prefix to prepend to each Amazon S3 object key or the prefix where object are stored in a bucket

public setKeyPrefix(string $keyPrefix) : $this

Can be used to upload files to a pseudo sub-folder key or only download files from a pseudo sub-folder

Parameters
$keyPrefix : string

Prefix for each uploaded key

Return values
$this

setMultipartUploadSize()

Set the multipart upload size threshold. When the size of a file exceeds this value, the file will be uploaded using a multipart upload.

public setMultipartUploadSize(int $size) : $this
Parameters
$size : int

Size threshold

Return values
$this

setOperationParams()

Specify an array of operation parameters to apply to each operation executed by the sync object

public setOperationParams(array<string|int, mixed> $params) : $this
Parameters
$params : array<string|int, mixed>

Associative array of PutObject (upload) GetObject (download) parameters

Return values
$this

setSourceFilenameConverter()

Set a custom object key provider instead of building one internally

public setSourceFilenameConverter(FileNameConverterInterface $converter) : $this
Parameters
$converter : FileNameConverterInterface

Filename to object key provider

Return values
$this

setSourceIterator()

Set a custom iterator that returns \SplFileInfo objects for the source data

public setSourceIterator(Iterator $iterator) : $this
Parameters
$iterator : Iterator
Return values
$this

setTargetFilenameConverter()

Set a custom object key provider instead of building one internally

public setTargetFilenameConverter(FileNameConverterInterface $converter) : $this
Parameters
$converter : FileNameConverterInterface

Filename to object key provider

Return values
$this

uploadFromDirectory()

Set the path that contains files to recursively upload to Amazon S3

public uploadFromDirectory(string $path) : $this
Parameters
$path : string

Path that contains files to upload

Return values
$this

addDebugListener()

Add a listener to the sync object to output debug information while transferring

protected addDebugListener(AbstractSync $sync, mixed $resource) : mixed
Parameters
$sync : AbstractSync

Sync object to listen to

$resource : mixed

Where to write debug messages

filterIterator()

Wraps a generated iterator in a filter iterator that removes directories

protected filterIterator(Iterator $iterator) : Iterator
Parameters
$iterator : Iterator

Iterator to wrap

Tags
throws
UnexpectedValueException
Return values
Iterator

getTargetIterator()

protected getTargetIterator() : Iterator
Return values
Iterator

validateRequirements()

Validate that the builder has the minimal requirements

protected validateRequirements() : mixed
Tags
throws
RuntimeException

if the builder is not configured completely


        
On this page

Search results