You are here

private static function S3fsFileMigrationBatch::updateProgress in S3 File System 4.0.x

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

Updates the progress counter and display.

Parameters

array|\DrushBatchContext $context: Batch context passed by reference.

1 call to S3fsFileMigrationBatch::updateProgress()
S3fsFileMigrationBatch::copyOperation in src/Batch/S3fsFileMigrationBatch.php
Batch operation callback that copy files to S3 File System.

File

src/Batch/S3fsFileMigrationBatch.php, line 284

Class

S3fsFileMigrationBatch
Batch migrate files to a S3 bucket.

Namespace

Drupal\s3fs\Batch

Code

private static function updateProgress(&$context) {

  // Update our progress information.
  $context['results']['progress']++;

  // Show status message each 5 files.
  if ($context['results']['progress'] % 5 == 0) {
    $current_percent_progress = floor($context['results']['progress'] / $context['results']['total'] * 100);
    if ($context['results']['percent_progress'] != $current_percent_progress) {
      $context['results']['percent_progress'] = $current_percent_progress;
    }
    $context['message'] = static::getCopyOperationMessage($context);
  }
}