You are here

public function S3fsRefreshCacheBatch::execute 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::execute()

Refreshes the complete list of objects in the S3 bucket.

Parameters

array $config: An s3fs configuration array.

Overrides S3fsRefreshCacheBatchInterface::execute

File

src/Batch/S3fsRefreshCacheBatch.php, line 24

Class

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

Namespace

Drupal\s3fs\Batch

Code

public function execute(array $config) {

  // Create batch.
  $batch_builder = $this
    ->getBatch();
  $args = [
    $config,
  ];
  $batch_builder
    ->addOperation([
    S3fsRefreshCacheBatch::class,
    'refreshCacheOperation',
  ], $args);
  batch_set($batch_builder
    ->toArray());
  $batch =& batch_get();

  // Drush integration.
  if (PHP_SAPI === 'cli') {
    $batch['progressive'] = FALSE;
    drush_backend_batch_process();
  }
}