Skip to content

Commit

Permalink
HSD8-1557 adjust nobots for provisions and launch task
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jan 9, 2024
1 parent 7357d8c commit 80decdb
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 80 deletions.
7 changes: 2 additions & 5 deletions blt/src/Blt/Plugin/Commands/HsCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,8 @@ public function launchSite($site, $options = ['not-live' => FALSE]) {
$this->switchSiteContext($site);
$this->taskDrush()
->alias("$site.prod")
->drush('cset')
->arg('config_split.config_split.not_live')
->arg('status')
->drush('sset')
->arg('nobots')
->arg($options['not-live'] ? 1 : 0)
->option('yes')
->drush('cset')
Expand All @@ -278,8 +277,6 @@ public function launchSite($site, $options = ['not-live' => FALSE]) {
->arg('enabled')
->arg($options['not-live'] ? 0 : 1)
->option('yes')
->drush('pmu')
->arg('nobots')
->drush('state:set')
->arg('xmlsitemap_base_url')
->arg($new_domain)
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@
"CKEditor 5 headings plugin paragraph label change": "patches/ckeditor5-paragraph-rename.patch"
},
"drupal/ds": {
"https://www.drupal.org/project/ds/issues/2939322": "https://www.drupal.org/files/issues/2020-01-07/ds-content_entity-2939322-11.patch",
"https://www.drupal.org/project/ds/issues/3311925": "https://www.drupal.org/files/issues/2022-09-26/fix-ds-with-hook-entity-update.patch"
"https://www.drupal.org/project/ds/issues/2939322": "https://www.drupal.org/files/issues/2020-01-07/ds-content_entity-2939322-11.patch"
},
"drupal/fakeobjects": {
"https://www.drupal.org/project/fakeobjects/issues/3002953": "https://www.drupal.org/files/issues/2020-06-22/fakeobjects-missing_plugin-3002953-5.patch"
Expand Down
62 changes: 33 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions config/default/config_split.config_split.not_live.yml

This file was deleted.

1 change: 1 addition & 0 deletions config/default/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ module:
migrate_source_csv: 0
migrate_tools: 0
mysql: 0
nobots: 0
node: 0
node_revision_delete: 0
oembed_providers: 0
Expand Down
37 changes: 10 additions & 27 deletions docroot/profiles/humsci/su_humsci_profile/src/PostInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Routing\RouteBuilderInterface;
use Drupal\Core\State\StateInterface;

/**
* Class PostInstall service.
Expand All @@ -13,45 +14,27 @@
*/
class PostInstall implements PostInstallInterface {

/**
* Entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* Route builder service.
*
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;

/**
* Config Factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;

/**
* PostInstall constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity type manager service.
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* @param \Drupal\Core\Routing\RouteBuilderInterface $routeBuilder
* Route builder service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* Config factory service.
* @param \Drupal\Core\State\StateInterface $state
* State service.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, RouteBuilderInterface $route_builder, ConfigFactoryInterface $config_factory) {
$this->entityTypeManager = $entity_type_manager;
$this->routeBuilder = $route_builder;
$this->configFactory = $config_factory;
public function __construct(protected EntityTypeManagerInterface $entityTypeManager,protected RouteBuilderInterface $routeBuilder,protected ConfigFactoryInterface $configFactory, protected StateInterface $state) {
}

/**
* {@inheritDoc}
*/
public function runTasks() {
$this->state->set('nobots', TRUE);

$user = $this->entityTypeManager->getStorage('user')->load(1);
$user->addRole('administrator');
$user->setUsername('sws-developers');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,13 @@ function su_humsci_profile_update_9604() {
$importers_collection->delete();
}
}

/**
* Delete "Not Live" config split.
*/
function su_humsci_profile_update_9605() {
\Drupal::entityTypeManager()
->getStorage('config_split')
->load('not_live')
->delete();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
su_humsci_profile.post_install:
class: Drupal\su_humsci_profile\PostInstall
arguments: ['@entity_type.manager', '@router.builder', '@config.factory']
arguments: ['@entity_type.manager', '@router.builder', '@config.factory', '@state']
su_humsci_profile.route_subscriber:
class: Drupal\su_humsci_profile\Routing\RouteSubscriber
arguments: ['@module_handler', '@config.factory']
Expand Down
5 changes: 5 additions & 0 deletions docroot/sites/settings/global.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
$settings['config_readonly'] = TRUE;
}

// Enable nobots on any non-prod site.
if (!EnvironmentDetector::isProdEnv()) {
$settings['nobots'] = TRUE;
}

if (EnvironmentDetector::isAhEnv()) {
require 'acquia.settings.php';
}
Expand Down

0 comments on commit 80decdb

Please sign in to comment.