function LoggingBeginner::begin

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

File

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

Class

LoggingBeginner
Logs Composer Stager's Beginner process output to a file.

Namespace

Drupal\package_manager

Code

public function begin(PathInterface $activeDir, PathInterface $stagingDir, ?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("### Beginning in %s\n", $stagingDir->absolute()));
    }
    $start_time = $this->time
        ->getCurrentMicroTime();
    $this->decorated
        ->begin($activeDir, $stagingDir, $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.