Commit 05b8266c authored by catch's avatar catch
Browse files

Issue #3503699 by phenaproxima, catch, quietone, tedbow, smustgrave, gábor...

Issue #3503699 by phenaproxima, catch, quietone, tedbow, smustgrave, gábor hojtsy: Allow Package Manager to operate directly on the live code base
parent 66097f2a
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -427,6 +427,8 @@ rowspans
rtsp
ruleset
sameorigin
sandboxed
sandboxing
savepoints
sayre
schemaapi
+7 −0
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@
 *   for event subscribers to flag errors before the active directory is
 *   modified, because once that has happened, the changes cannot be undone.
 *   This event may be dispatched multiple times during the stage life cycle.
 *   Note that this event is NOT dispatched when the sandbox manager is
 *   operating in direct-write mode.
 *
 * - \Drupal\package_manager\Event\PostApplyEvent
 *   Dispatched after changes in the stage directory have been copied to the
@@ -109,6 +111,11 @@
 *   life cycle, and should *never* be used for schema changes (i.e., operations
 *   that should happen in `hook_update_N()` or a post-update function).
 *
 * Since the apply events are not dispatched in direct-write mode, event
 * subscribers that want to prevent a sandbox from moving through its life cycle
 * in direct-write mode should do it by subscribing to PreCreateEvent or
 * StatusCheckEvent.
 *
 * @section sec_stage_api Stage API: Public methods
 * The public API of any stage consists of the following methods:
 *
+7 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ services:
  Drupal\package_manager\EventSubscriber\ChangeLogger:
    calls:
      - [setLogger, ['@logger.channel.package_manager_change_log']]
  Drupal\package_manager\EventSubscriber\DirectWriteSubscriber: {}
  Drupal\package_manager\ComposerInspector: {}

  # Validators.
@@ -201,3 +202,9 @@ services:
  PhpTuf\ComposerStager\Internal\Translation\Service\SymfonyTranslatorProxyInterface:
    class: PhpTuf\ComposerStager\Internal\Translation\Service\SymfonyTranslatorProxy
    public: false

  Drupal\package_manager\DirectWritePreconditionBypass:
    decorates: 'PhpTuf\ComposerStager\API\Precondition\Service\ActiveAndStagingDirsAreDifferentInterface'
    arguments:
      - '@.inner'
    public: false
+21 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\package_manager\Attribute;

/**
 * Identifies sandbox managers which can operate on the running code base.
 *
 * Package Manager normally creates and operates on a fully separate, sandboxed
 * copy of the site. This is pretty safe, but not always necessary for certain
 * kinds of operations (e.g., adding a new module to the site).
 * SandboxManagerBase subclasses with this attribute are allowed to skip the
 * sandboxing and operate directly on the live site, but ONLY if the
 * `package_manager_allow_direct_write` setting is set to TRUE.
 *
 * @see \Drupal\package_manager\SandboxManagerBase::isDirectWrite()
 */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class AllowDirectWrite {
}
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class ComposerInspector implements LoggerAwareInterface {
   *
   * @var string
   */
  final public const SUPPORTED_VERSION = '^2.6';
  final public const SUPPORTED_VERSION = '^2.7';

  public function __construct(
    private readonly ComposerProcessRunnerInterface $runner,
Loading