Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LoggingCommitter.php

class LoggingCommitter

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

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.

Hierarchy

  • class \Drupal\package_manager\LoggingCommitter implements \PhpTuf\ComposerStager\API\Core\CommitterInterface

Expanded class hierarchy of LoggingCommitter

File

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

Namespace

Drupal\package_manager
View source
class LoggingCommitter implements CommitterInterface {
    public function __construct(CommitterInterface $decorated, ConfigFactoryInterface $configFactory, TimeInterface $time) {
    }
    
    /**
     * {@inheritdoc}
     */
    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));
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
LoggingCommitter::commit public function
LoggingCommitter::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal