You are here

public function S3fsRefreshCacheBatch::getBatch in S3 File System 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Batch/S3fsRefreshCacheBatch.php \Drupal\s3fs\Batch\S3fsRefreshCacheBatch::getBatch()

Initialise a batch builder object.

Return value

\Drupal\Core\Batch\BatchBuilder The instantiated batch builder.

Overrides S3fsRefreshCacheBatchInterface::getBatch

1 call to S3fsRefreshCacheBatch::getBatch()
S3fsRefreshCacheBatch::execute in src/Batch/S3fsRefreshCacheBatch.php
Refreshes the complete list of objects in the S3 bucket.

File

src/Batch/S3fsRefreshCacheBatch.php, line 49

Class

S3fsRefreshCacheBatch
Performs a refresh of the s3fs_file table with data from S3 bucket.

Namespace

Drupal\s3fs\Batch

Code

public function getBatch() {
  return (new BatchBuilder())
    ->setTitle($this
    ->t('Refresh cached list of files S3'))
    ->setFinishCallback([
    S3fsRefreshCacheBatch::class,
    'finished',
  ])
    ->setInitMessage($this
    ->t('The process to refresh the cached list of files is about to start..'))
    ->setProgressMessage($this
    ->t('Processed batch @current out of an unknown total (AWS S3 does not make the total number of files available without looping through all files).'))
    ->setErrorMessage($this
    ->t('Something wrong happened, please check the logs.'));
}