function LoggingCommitter::commit

Same name in this branch
  1. 11.x core/modules/package_manager/tests/modules/package_manager_bypass/src/LoggingCommitter.php \Drupal\package_manager_bypass\LoggingCommitter::commit()

File

core/modules/package_manager/src/LoggingCommitter.php, line 35

Class

LoggingCommitter
Logs Composer Stager's Committer process output to a file.

Namespace

Drupal\package_manager

Code

public function commit(PathInterface $stagingDir, PathInterface $activeDir, ?PathListInterface $exclusions = NULL, ?OutputCallbackInterface $callback = NULL, int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
    $path = $this->configFactory
        ->get('package_manager.settings')
        ->get('log');
    if ($path) {
        $callback = new FileProcessOutputCallback($path, $callback);
        $callback(OutputTypeEnum::OUT, sprintf("### Committing changes from %s to %s\n", $stagingDir->absolute(), $activeDir->absolute()));
    }
    $start_time = $this->time
        ->getCurrentMicroTime();
    $this->decorated
        ->commit($stagingDir, $activeDir, $exclusions, $callback, $timeout);
    $end_time = $this->time
        ->getCurrentMicroTime();
    if ($callback) {
        $callback(OutputTypeEnum::OUT, sprintf("### Finished in %0.3f seconds\n", $end_time - $start_time));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.