Commit 9b33bc51 authored by Ben Mullins's avatar Ben Mullins Committed by Tim Plunkett
Browse files

Issue #3284945 by bnjmnm, srishtiiee, tim.plunkett, rkoller, fjgarlin, tedbow,...

Issue #3284945 by bnjmnm, srishtiiee, tim.plunkett, rkoller, fjgarlin, tedbow, chrisfromredfin, phenaproxima: Install endpoints that leverage Package Manager + core APIs
parent b1abfee8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
        "ext-simplexml": "*"
    },
    "require-dev": {
        "drupal/automatic_updates": "2.x-dev@dev"
        "drupal/automatic_updates": "^2.3"
    },
    "config": {
        "optimize-autoloader": true,
+3 −0
Original line number Diff line number Diff line
@@ -8,3 +8,6 @@ project_browser.admin_settings:
      sequence:
        type: string
        label: 'Source'
    allow_ui_install:
      type: boolean
      label: 'Allow installing packages from within the UI'
+3 −0
Original line number Diff line number Diff line
@@ -41,3 +41,6 @@ project_browser.install.readiness:
    _title: 'UI Install Readiness'
  requirements:
    _permission: 'administer modules'

route_callbacks:
  - '\Drupal\project_browser\Routing\ProjectBrowserRoutes::routes'
+3 −0
Original line number Diff line number Diff line
@@ -34,3 +34,6 @@ services:
      - { name: cache.bin }
    factory: cache_factory:get
    arguments: [project_browser]
  project_browser.tempstore.shared:
    class: Drupal\Core\TempStore\SharedTempStoreFactory
    arguments: ['@keyvalue.expirable', '@lock', '@request_stack', '@current_user', 600]
+22 −0
Original line number Diff line number Diff line
@@ -42,4 +42,26 @@ final class Installer extends Stage {
    }
  }

  /**
   * Checks if the stage tempstore lock was created by Project Browser.
   *
   * This is one of several checks performed to determine if it is acceptable
   * to destroy the current stage. Project Browser's unlock functionality uses
   * the "force" option so a stage can be destroyed even if it was created by
   * a different user or during a different session. However, a stage could have
   * been created by another module, such as Automatic Updates. In those cases
   * Project Browser should not have the ability to destroy the stage.
   *
   * This method confirms the staging lock was created by
   * Drupal\project_browser\ComposerInstaller\Installer, and will only permit
   * destroying the stage if true.
   *
   * @return bool
   *   True if the stage tempstore lock was created by Project Browser.
   */
  public function lockCameFromProjectBrowserInstaller(): bool {
    $lock_data = $this->tempStore->get(static::TEMPSTORE_LOCK_KEY);
    return !empty($lock_data[1]) && $lock_data[1] === self::class;
  }

}
Loading