cleaned all unused modules
This commit is contained in:
		@@ -71,17 +71,11 @@
 | 
			
		||||
        "drupal/audiofield": "^1.10",
 | 
			
		||||
        "drupal/auto_entitylabel": "^3.1",
 | 
			
		||||
        "drupal/better_messages": "^2.0@alpha",
 | 
			
		||||
        "drupal/ckeditor_codemirror": "^2.3",
 | 
			
		||||
        "drupal/ckeditor_font": "^1.2",
 | 
			
		||||
        "drupal/ckeditor_uploadimage": "^2.0",
 | 
			
		||||
        "drupal/colorbutton": "^1.3",
 | 
			
		||||
        "drupal/commerce": "^2.0",
 | 
			
		||||
        "drupal/commerce_cart_api": "^1.4",
 | 
			
		||||
        "drupal/commerce_cart_redirection": "^3.0",
 | 
			
		||||
        "drupal/commerce_email": "^1.5",
 | 
			
		||||
        "drupal/commerce_license": "^3.0",
 | 
			
		||||
        "drupal/commerce_migrate": "^3.1",
 | 
			
		||||
        "drupal/commerce_monetico": "^1.0",
 | 
			
		||||
        "drupal/commerce_pricelist": "^2.4",
 | 
			
		||||
        "drupal/commerce_recurring": "^1.0@RC",
 | 
			
		||||
        "drupal/commerce_stripe": "^1.1",
 | 
			
		||||
@@ -92,12 +86,10 @@
 | 
			
		||||
        "drupal/config_pages": "^2.9",
 | 
			
		||||
        "drupal/config_split": "^2.0@beta",
 | 
			
		||||
        "drupal/consumer_image_styles": "^4.0",
 | 
			
		||||
        "drupal/content_sync": "^2.x-dev@dev",
 | 
			
		||||
        "drupal/core-composer-scaffold": "9.5.9",
 | 
			
		||||
        "drupal/core-project-message": "9.5.9",
 | 
			
		||||
        "drupal/core-recommended": "9.5.9",
 | 
			
		||||
        "drupal/ctools": "^4.0",
 | 
			
		||||
        "drupal/debug_bar": "^1.4",
 | 
			
		||||
        "drupal/devel": "^5.0",
 | 
			
		||||
        "drupal/devel_entity_updates": "^4.1",
 | 
			
		||||
        "drupal/editor_advanced_link": "^2",
 | 
			
		||||
@@ -116,18 +108,11 @@
 | 
			
		||||
        "drupal/image_effects": "^3.x-dev@dev",
 | 
			
		||||
        "drupal/js_cache_buster": "^1.0",
 | 
			
		||||
        "drupal/jsonapi_extras": "^3.21",
 | 
			
		||||
        "drupal/jsonrpc": "^2.0",
 | 
			
		||||
        "drupal/login_destination": "^2.x-dev@dev",
 | 
			
		||||
        "drupal/login_history": "^1.x-dev",
 | 
			
		||||
        "drupal/login_tracker": "^2.0",
 | 
			
		||||
        "drupal/mailgun": "^1.x-dev",
 | 
			
		||||
        "drupal/mailjet": "3.0.x-dev@dev",
 | 
			
		||||
        "drupal/mailsystem": "^4.1",
 | 
			
		||||
        "drupal/masquerade": "^2.x-dev@dev",
 | 
			
		||||
        "drupal/maxlength": "^2.1",
 | 
			
		||||
        "drupal/migrate_plus": "^5.x-dev@dev",
 | 
			
		||||
        "drupal/migrate_tools": "^5.x-dev@dev",
 | 
			
		||||
        "drupal/mimemail": "^1.x-dev",
 | 
			
		||||
        "drupal/modules_weight": "^1.8",
 | 
			
		||||
        "drupal/pagerer": "^2.3",
 | 
			
		||||
        "drupal/password_policy": "^4.0",
 | 
			
		||||
@@ -139,7 +124,6 @@
 | 
			
		||||
        "drupal/pwa": "^2.1@beta",
 | 
			
		||||
        "drupal/redirect": "^1.x-dev@dev",
 | 
			
		||||
        "drupal/redis": "^1.5",
 | 
			
		||||
        "drupal/reroute_email": "^2.1",
 | 
			
		||||
        "drupal/restui": "^1.16",
 | 
			
		||||
        "drupal/role_delegation": "^1.1",
 | 
			
		||||
        "drupal/role_expire": "^3.0",
 | 
			
		||||
@@ -172,7 +156,6 @@
 | 
			
		||||
        "drupal/vde_drush": "^2.1",
 | 
			
		||||
        "drupal/views_conditional": "^1.x-dev",
 | 
			
		||||
        "drupal/views_data_export": "^1.1",
 | 
			
		||||
        "drupal/views_ef_fieldset": "^1.5",
 | 
			
		||||
        "drupal/views_field_view": "1.x-dev@dev",
 | 
			
		||||
        "drupal/webform": "^6.0",
 | 
			
		||||
        "drupal/workflow": "^1.5",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2415
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2415
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,7 +0,0 @@
 | 
			
		||||
name: 'REST Config'
 | 
			
		||||
type: module
 | 
			
		||||
description: 'Get site configiration through rest api'
 | 
			
		||||
core_version_requirement: ^8.8 || ^9.2
 | 
			
		||||
package: 'Custom'
 | 
			
		||||
dependencies:
 | 
			
		||||
  - rest
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * Contains rest_config.module.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Routing\RouteMatchInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_help().
 | 
			
		||||
 */
 | 
			
		||||
function rest_config_help($route_name, RouteMatchInterface $route_match) {
 | 
			
		||||
  switch ($route_name) {
 | 
			
		||||
    // Main module help for the rest_config module.
 | 
			
		||||
    case 'help.page.rest_config':
 | 
			
		||||
      $output = '';
 | 
			
		||||
      $output .= '<h3>' . t('About') . '</h3>';
 | 
			
		||||
      $output .= '<p>' . t('Get site configiration through rest api') . '</p>';
 | 
			
		||||
      return $output;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,106 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\rest_config\Plugin\rest\resource;
 | 
			
		||||
 | 
			
		||||
use Drupal\Core\Session\AccountProxyInterface;
 | 
			
		||||
use Drupal\rest\ModifiedResourceResponse;
 | 
			
		||||
use Drupal\rest\Plugin\ResourceBase;
 | 
			
		||||
use Drupal\rest\ResourceResponse;
 | 
			
		||||
use Psr\Log\LoggerInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provides a resource to get configurations values.
 | 
			
		||||
 *
 | 
			
		||||
 * @RestResource(
 | 
			
		||||
 *   id = "config_rest_resource",
 | 
			
		||||
 *   label = @Translation("Config rest resource"),
 | 
			
		||||
 *   uri_paths = {
 | 
			
		||||
 *     "canonical" = "/config/{file}/{key}"
 | 
			
		||||
 *   }
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class ConfigRestResource extends ResourceBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * A current user instance.
 | 
			
		||||
   *
 | 
			
		||||
   * @var \Drupal\Core\Session\AccountProxyInterface
 | 
			
		||||
   */
 | 
			
		||||
  protected $currentUser;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Constructs a new ConfigRestResource object.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $configuration
 | 
			
		||||
   *   A configuration array containing information about the plugin instance.
 | 
			
		||||
   * @param string $plugin_id
 | 
			
		||||
   *   The plugin_id for the plugin instance.
 | 
			
		||||
   * @param mixed $plugin_definition
 | 
			
		||||
   *   The plugin implementation definition.
 | 
			
		||||
   * @param array $serializer_formats
 | 
			
		||||
   *   The available serialization formats.
 | 
			
		||||
   * @param \Psr\Log\LoggerInterface $logger
 | 
			
		||||
   *   A logger instance.
 | 
			
		||||
   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
 | 
			
		||||
   *   A current user instance.
 | 
			
		||||
   */
 | 
			
		||||
  public function __construct(
 | 
			
		||||
    array $configuration,
 | 
			
		||||
    $plugin_id,
 | 
			
		||||
    $plugin_definition,
 | 
			
		||||
    array $serializer_formats,
 | 
			
		||||
    LoggerInterface $logger,
 | 
			
		||||
    AccountProxyInterface $current_user) {
 | 
			
		||||
    parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);
 | 
			
		||||
 | 
			
		||||
    $this->currentUser = $current_user;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
 | 
			
		||||
    return new static(
 | 
			
		||||
      $configuration,
 | 
			
		||||
      $plugin_id,
 | 
			
		||||
      $plugin_definition,
 | 
			
		||||
      $container->getParameter('serializer.formats'),
 | 
			
		||||
      $container->get('logger.factory')->get('rest_config'),
 | 
			
		||||
      $container->get('current_user')
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Responds to GET requests.
 | 
			
		||||
   *
 | 
			
		||||
   * @return \Drupal\rest\ResourceResponse
 | 
			
		||||
   *   The HTTP response object.
 | 
			
		||||
   *
 | 
			
		||||
   * @throws \Symfony\Component\HttpKernel\Exception\HttpException
 | 
			
		||||
   *   Throws exception expected.
 | 
			
		||||
   */
 | 
			
		||||
  public function get($file = null, $key = null) {
 | 
			
		||||
 | 
			
		||||
    // You must to implement the logic of your REST Resource here.
 | 
			
		||||
    // Use current user after pass authentication to validate access.
 | 
			
		||||
    if (!$this->currentUser->hasPermission('access content')) {
 | 
			
		||||
      throw new AccessDeniedHttpException();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $data = [];
 | 
			
		||||
    if($file && $key){
 | 
			
		||||
      $config = \Drupal::config($file);
 | 
			
		||||
      if($config){
 | 
			
		||||
        $value = $config->get($key);
 | 
			
		||||
        $data[$key] = $value;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $response = new ResourceResponse($data, 200);
 | 
			
		||||
    $response->addCacheableDependency($data);
 | 
			
		||||
    return $response;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
Copied from https://www.drupal.org/sandbox/onkeltem/2828817 and added the patch from https://www.drupal.org/project/2828817/issues/2919993
 | 
			
		||||
 | 
			
		||||
# About
 | 
			
		||||
 | 
			
		||||
On Drupal 7 we could disable hooks while running migrations:
 | 
			
		||||
 | 
			
		||||
    https://www.drupal.org/node/2136601
 | 
			
		||||
 | 
			
		||||
This module adds a similar feature. You can disable hooks 
 | 
			
		||||
in settings.php or by editing configuratoin object `migrate_booster.settings`.
 | 
			
		||||
 | 
			
		||||
There are two ways to disable hooks: 
 | 
			
		||||
 | 
			
		||||
1) Disable specific hooks and modules: 
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$config['migrate_booster.settings']['hooks'] = [
 | 
			
		||||
  # Entity insert
 | 
			
		||||
  'entity_insert' => [
 | 
			
		||||
    'workbench_moderation',
 | 
			
		||||
    'pathauto',
 | 
			
		||||
    'xmlsitemap',
 | 
			
		||||
  ],
 | 
			
		||||
  # Entity presave
 | 
			
		||||
  'entity_presave' => [
 | 
			
		||||
    'xmlsitemap',
 | 
			
		||||
  ],
 | 
			
		||||
  # Entity predelete
 | 
			
		||||
  'entity_predelete' => [
 | 
			
		||||
    'flag',
 | 
			
		||||
  ],
 | 
			
		||||
];
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
2) Disable all hooks of specific modules:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$config['migrate_booster.settings']['modules'] = [
 | 
			
		||||
  'workbench_moderation',
 | 
			
		||||
  'pathauto',
 | 
			
		||||
  'xmlsitemap',
 | 
			
		||||
];
 | 
			
		||||
```
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
commands:
 | 
			
		||||
  - migrate:import
 | 
			
		||||
  - migrate:rollback
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
services:
 | 
			
		||||
  migrate_booster.commands:
 | 
			
		||||
    class: \Drupal\migrate_booster\Commands\MigrateBoosterCommands
 | 
			
		||||
    arguments: ['@plugin.manager.migration', '@date.formatter', '@entity_type.manager', '@keyvalue']
 | 
			
		||||
    tags:
 | 
			
		||||
      - { name: drush.command }
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Drupal\migrate_booster\MigrateBooster;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_drush_init().
 | 
			
		||||
 */
 | 
			
		||||
function migrate_booster_drush_init() {
 | 
			
		||||
  // Skip when bootstrap level is low (e.g. drush cr)
 | 
			
		||||
  if (!\Drupal::hasContainer()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  MigrateBooster::bootDrush();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_drush_command().
 | 
			
		||||
 */
 | 
			
		||||
function migrate_booster_drush_command() {
 | 
			
		||||
  $items['migrate-booster-reset'] = [
 | 
			
		||||
    'description' => 'Resets migrate booster and implementation cache.',
 | 
			
		||||
    'aliases' => ['mbr'],
 | 
			
		||||
    'drupal dependencies' => ['migrate_booster'],
 | 
			
		||||
  ];
 | 
			
		||||
  return $items;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function drush_migrate_booster_reset() {
 | 
			
		||||
  MigrateBooster::disable();
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
name: Migrate booster
 | 
			
		||||
type: module
 | 
			
		||||
description: Hooks disabler
 | 
			
		||||
core_version_requirement: ^8.8 || ^9.2
 | 
			
		||||
package: Migration
 | 
			
		||||
dependencies:
 | 
			
		||||
  - migrate
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Drupal\migrate_booster\MigrateBooster;
 | 
			
		||||
 | 
			
		||||
/** @noinspection PhpInconsistentReturnPointsInspection */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_module_implements_alter().
 | 
			
		||||
 * @param $implementations
 | 
			
		||||
 * @param $hook
 | 
			
		||||
 * @return null
 | 
			
		||||
 */
 | 
			
		||||
function migrate_booster_module_implements_alter(&$implementations, $hook) {
 | 
			
		||||
  MigrateBooster::alter($implementations, $hook);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
services:
 | 
			
		||||
  migrate_booster.hooks_enabler_subscriber:
 | 
			
		||||
    class: Drupal\migrate_booster\HooksEnablerSubscriber
 | 
			
		||||
    tags:
 | 
			
		||||
      - { name: 'event_subscriber' }
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Drupal\migrate_booster\MigrateBooster;
 | 
			
		||||
use Symfony\Component\Console\Event\ConsoleCommandEvent;
 | 
			
		||||
use Symfony\Component\Console\ConsoleEvents;
 | 
			
		||||
 | 
			
		||||
/** @noinspection PhpUnusedParameterInspection */
 | 
			
		||||
$GLOBALS['dispatcher']->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) {
 | 
			
		||||
  MigrateBooster::bootDrupal();
 | 
			
		||||
});
 | 
			
		||||
@@ -1,61 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace Drupal\migrate_booster\Commands;
 | 
			
		||||
 | 
			
		||||
use Consolidation\AnnotatedCommand\AnnotationData;
 | 
			
		||||
use Drupal\migrate_booster\MigrateBooster;
 | 
			
		||||
use Drush\Commands\DrushCommands;
 | 
			
		||||
use Symfony\Component\Console\Input\InputInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * In addition to a commandfile like this one, you need a drush.services.yml
 | 
			
		||||
 * in root of your module.
 | 
			
		||||
 *
 | 
			
		||||
 * See these files for an example of injecting Drupal services:
 | 
			
		||||
 *   - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php
 | 
			
		||||
 *   - http://cgit.drupalcode.org/devel/tree/drush.services.yml
 | 
			
		||||
 */
 | 
			
		||||
class MigrateBoosterCommands extends DrushCommands {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Resets migrate booster and implementation cache.
 | 
			
		||||
   *
 | 
			
		||||
   * @command migrate:booster:reset
 | 
			
		||||
   *
 | 
			
		||||
   * @validate-module-enabled migrate_booster
 | 
			
		||||
   * @aliases mbr,migrate-booster-reset
 | 
			
		||||
   */
 | 
			
		||||
  public function boosterReset()
 | 
			
		||||
  {
 | 
			
		||||
      // See bottom of https://weitzman.github.io/blog/port-to-drush9 for details on what to change when porting a
 | 
			
		||||
      // legacy command.
 | 
			
		||||
    MigrateBooster::reset();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Enables migrate booster and implementation cache.
 | 
			
		||||
   *
 | 
			
		||||
   * @command migrate:booster:enable
 | 
			
		||||
   *
 | 
			
		||||
   * @validate-module-enabled migrate_booster
 | 
			
		||||
   * @aliases mbe,migrate-booster-enable
 | 
			
		||||
   */
 | 
			
		||||
  public function boosterEnable()
 | 
			
		||||
  {
 | 
			
		||||
    // See bottom of https://weitzman.github.io/blog/port-to-drush9 for details on what to change when porting a
 | 
			
		||||
    // legacy command.
 | 
			
		||||
 | 
			
		||||
    MigrateBooster::enable();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @hook init *
 | 
			
		||||
   */
 | 
			
		||||
  public function initCommand(InputInterface $input, AnnotationData $annotationData) {
 | 
			
		||||
    // Skip when bootstrap level is low (e.g. drush cr)
 | 
			
		||||
    if (!\Drupal::hasContainer()) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    MigrateBooster::bootDrush($input, $annotationData);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,29 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\migrate_booster;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\HttpKernel\KernelEvents;
 | 
			
		||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* Provides a MyModuleSubscriber.
 | 
			
		||||
*/
 | 
			
		||||
class HooksEnablerSubscriber implements EventSubscriberInterface {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
  * {@inheritdoc}
 | 
			
		||||
  */
 | 
			
		||||
  static function getSubscribedEvents() {
 | 
			
		||||
    $events[KernelEvents::REQUEST][] = array('ensureHooksEnabled', 20);
 | 
			
		||||
    return $events;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Triggers on 'kernel.request' event which occurs when Drupal
 | 
			
		||||
   * bootstraps (but not when Drush or Drupal console command runs).
 | 
			
		||||
   */
 | 
			
		||||
  public function ensureHooksEnabled() {
 | 
			
		||||
    MigrateBooster::bootDrupal();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,115 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\migrate_booster;
 | 
			
		||||
 | 
			
		||||
use Consolidation\AnnotatedCommand\AnnotationData;
 | 
			
		||||
use Symfony\Component\Console\Input\InputInterface;
 | 
			
		||||
 | 
			
		||||
class MigrateBooster {
 | 
			
		||||
 | 
			
		||||
  protected static $alterActive;
 | 
			
		||||
  protected static $config;
 | 
			
		||||
  const CID = 'migrate_booster_enabled';
 | 
			
		||||
 | 
			
		||||
  // Startup hooks
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Reacts on HOOK_drush_init().
 | 
			
		||||
   *
 | 
			
		||||
   * Enables/disables booster depending on a drush command invoked.
 | 
			
		||||
   */
 | 
			
		||||
  public static function bootDrush(InputInterface $input, AnnotationData $annotationData) {
 | 
			
		||||
    if (in_array($annotationData['command'], static::getConfig('commands'))) {
 | 
			
		||||
      static::enable();
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      static::disable();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Disables booster on Drupal and Drupal console boots.
 | 
			
		||||
   */
 | 
			
		||||
  public static function bootDrupal() {
 | 
			
		||||
    static::disable();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Enables booster.
 | 
			
		||||
   *
 | 
			
		||||
   * Resets implementation cache and sets $alterActive class variable.
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public static function enable() {
 | 
			
		||||
    static::$alterActive = TRUE;
 | 
			
		||||
    static::reset();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Disables booster.
 | 
			
		||||
   *
 | 
			
		||||
   * Resets implementation cache.
 | 
			
		||||
   */
 | 
			
		||||
  public static function disable() {
 | 
			
		||||
    static::reset();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Resets implementations cache.
 | 
			
		||||
   */
 | 
			
		||||
  public static function reset() {
 | 
			
		||||
    $module_handler = \Drupal::moduleHandler();
 | 
			
		||||
    $module_handler->resetImplementations();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /** @noinspection PhpInconsistentReturnPointsInspection */
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Implements hook_module_implementation_alter().
 | 
			
		||||
   *
 | 
			
		||||
   * Disables configured hooks.
 | 
			
		||||
   * @param $implementations
 | 
			
		||||
   * @param $hook
 | 
			
		||||
   * @return null
 | 
			
		||||
   */
 | 
			
		||||
  public static function alter(&$implementations, $hook) {
 | 
			
		||||
    if (!static::$alterActive) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
    if (!$implementations) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
    }
 | 
			
		||||
    $hooks = static::getConfig('hooks');
 | 
			
		||||
    $modules = static::getConfig('modules');
 | 
			
		||||
    $disabled = [];
 | 
			
		||||
    // Disable by hook + module
 | 
			
		||||
    if (array_key_exists($hook, $hooks)) {
 | 
			
		||||
      $disabled = array_intersect_key($implementations, array_flip($hooks[$hook]));
 | 
			
		||||
    }
 | 
			
		||||
    // Disable by module
 | 
			
		||||
    $disabled += array_intersect_key($implementations, array_flip($modules));
 | 
			
		||||
    $implementations = array_diff_key($implementations, $disabled);
 | 
			
		||||
    /** @noinspection PhpUnusedParameterInspection */
 | 
			
		||||
    array_walk($disabled, function ($el, $key) use ($hook) {
 | 
			
		||||
      error_log('DISABLED: ' . $key . '_' . $hook);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Helper functions
 | 
			
		||||
   *
 | 
			
		||||
   * @param $key
 | 
			
		||||
   * @return array
 | 
			
		||||
   */
 | 
			
		||||
  protected static function getConfig($key) {
 | 
			
		||||
    if (!static::$config) {
 | 
			
		||||
      static::$config = \Drupal::config('migrate_booster.settings')->get();
 | 
			
		||||
    }
 | 
			
		||||
    if ($key && isset(static::$config[$key])) {
 | 
			
		||||
      return static::$config[$key];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return [];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 Submodule web/profiles/d8-starterkit-profile updated: c7e9155544...9bb1e247d4
									
								
							
		Reference in New Issue
	
	Block a user