Commit 81d6ccbd authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3304365 by phenaproxima, tedbow, TravisCarden, bnjmnm: Do not check...

Issue #3304365 by phenaproxima, tedbow, TravisCarden, bnjmnm: Do not check excluded folders for symlinks
parent 0bcd417a
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\package_manager\Event;

use Drupal\package_manager\Stage;
use PhpTuf\ComposerStager\Domain\Value\PathList\PathListInterface;
use PhpTuf\ComposerStager\Infrastructure\Value\PathList\PathList;

/**
 * Defines an event that collects ignored paths.
 *
 * Ignored paths are completely ignored by Composer Stager. They are never
 * copied into the staging area from the active directory, or vice-versa.
 */
class CollectIgnoredPathsEvent extends StageEvent implements PathListInterface {

  /**
   * The list of ignored paths.
   *
   * @var \PhpTuf\ComposerStager\Domain\Value\PathList\PathListInterface
   */
  protected PathListInterface $pathList;

  /**
   * {@inheritdoc}
   */
  public function __construct(Stage $stage) {
    parent::__construct($stage);
    $this->pathList = new PathList([]);
  }

  /**
   * {@inheritdoc}
   */
  public function add(array $paths): void {
    $this->pathList->add($paths);
  }

  /**
   * {@inheritdoc}
   */
  public function getAll(): array {
    return $this->pathList->getAll();
  }

}
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ trait ExcludedPathsTrait {
   * @see \Drupal\package_manager\PathExcluder\SiteConfigurationExcluder
   */
  public function excludePath(string $path): void {
    @trigger_error(__METHOD__ . '() is deprecated in automatic_updates:8.x-2.5 and removed in automatic_updates:3.0.0. Use ' . CollectIgnoredPathsEvent::class . ' instead. See https://www.drupal.org/node/3317862.', E_USER_DEPRECATED);
    $this->excludedPaths[] = $path;
  }

+19 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Drupal\package_manager\Event;

use Drupal\package_manager\Stage;

/**
 * Event fired before staged changes are synced to the active directory.
 */
@@ -9,4 +11,21 @@ class PreApplyEvent extends PreOperationStageEvent {

  use ExcludedPathsTrait;

  /**
   * Constructs a PreApplyEvent object.
   *
   * @param \Drupal\package_manager\Stage $stage
   *   The stage which fired this event.
   * @param string[] $ignored_paths
   *   The list of ignored paths.
   */
  public function __construct(Stage $stage, array $ignored_paths = NULL) {
    if ($ignored_paths === NULL) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $ignored_paths argument is deprecated in automatic_updates:8.x-2.5 and will be removed in automatic_updates:3.0.0. See https://www.drupal.org/node/3317862.', E_USER_DEPRECATED);
      $ignored_paths = [];
    }
    parent::__construct($stage);
    $this->excludedPaths = $ignored_paths;
  }

}
+19 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Drupal\package_manager\Event;

use Drupal\package_manager\Stage;

/**
 * Event fired before a staging area is created.
 */
@@ -9,4 +11,21 @@ class PreCreateEvent extends PreOperationStageEvent {

  use ExcludedPathsTrait;

  /**
   * Constructs a PreCreateEvent object.
   *
   * @param \Drupal\package_manager\Stage $stage
   *   The stage which fired this event.
   * @param string[] $ignored_paths
   *   The list of ignored paths.
   */
  public function __construct(Stage $stage, array $ignored_paths = NULL) {
    if ($ignored_paths === NULL) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $ignored_paths argument is deprecated in automatic_updates:8.x-2.5 and will be removed in automatic_updates:3.0.0. See https://www.drupal.org/node/3317862.', E_USER_DEPRECATED);
      $ignored_paths = [];
    }
    parent::__construct($stage);
    $this->excludedPaths = $ignored_paths;
  }

}
+20 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Drupal\package_manager\Event;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\package_manager\Stage;
use Drupal\package_manager\ValidationResult;

/**
@@ -13,6 +14,25 @@ use Drupal\package_manager\ValidationResult;
 */
class StatusCheckEvent extends PreOperationStageEvent {

  use ExcludedPathsTrait;

  /**
   * Constructs a StatusCheckEvent object.
   *
   * @param \Drupal\package_manager\Stage $stage
   *   The stage which fired this event.
   * @param string[] $ignored_paths
   *   The list of ignored paths.
   */
  public function __construct(Stage $stage, array $ignored_paths = NULL) {
    if ($ignored_paths === NULL) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $ignored_paths argument is deprecated in automatic_updates:8.x-2.5 and will be removed in automatic_updates:3.0.0. See https://www.drupal.org/node/3317862.', E_USER_DEPRECATED);
      $ignored_paths = [];
    }
    parent::__construct($stage);
    $this->excludedPaths = $ignored_paths;
  }

  /**
   * Adds warning information to the event.
   *
Loading