Skip to content

Commit

Permalink
Merge pull request #156 from palantirnet/drupal9
Browse files Browse the repository at this point in the history
Drupal 9 compatibility
  • Loading branch information
becw authored Jun 26, 2020
2 parents 018b540 + da6405c commit 41f2385
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
working_directory: ~/example
docker:
- image: circleci/php:7.2-node-browsers
- image: circleci/php:7.3-node-browsers
- image: circleci/mysql:5.7-ram
command: --max_allowed_packet=16M
environment:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
# Create a new project using the drupal-skeleton project
- run:
name: Create a new Drupal project
command: composer create-project palantirnet/drupal-skeleton example dev-drupal8 --no-interaction
command: composer create-project palantirnet/drupal-skeleton example dev-drupal9 --no-interaction
working_directory: ~/

# Use this copy of the-build
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## UNRELEASED

### Changed

* `phing install` now uses `drush site-install --existing-config` instead of the [config_installer profile](https://www.drupal.org/project/config_installer) (#145)

### Deprecated

* The `drupal.site.profile` property is no longer used by the default `install` target in `build.xml`. It will be removed in the 3.0 release. (#145)

## 2.3.2

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ drupal:
hash_salt: temporary

# Drupal install profile to use for the drupal-install target.
#
# DEPRECATED - to be removed in 3.0
# This property was used in the 'install' target in the default build.xml, until
# we switched from the config_installer profile to using
# 'drush site-install --existing-config`.
profile: config_installer

# Drupal admin username, if you feel inclined to change it.
Expand Down
2 changes: 1 addition & 1 deletion defaults/install/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<option name="site-name">${projectname}</option>
<option name="account-name">${drupal.site.admin_user}</option>
<option name="account-pass">admin</option>
<param>${drupal.site.profile}</param>
<option name="existing-config" />
</drush>
</target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: the-build utility module
description: 'Base settings from palantirnet/the-build.'
type: module
core: 8.x
core_version_requirement: ^8 || ^9
hide: true

dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ use Drupal\shortcut\Entity\Shortcut;
function the_build_utility_install() {
// Allow visitor account creation with administrative approval.
$user_settings = \Drupal::configFactory()->getEditable('user.settings');
$user_settings->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)->save(TRUE);
$user_settings->set('register', 'admin_only')->save(TRUE);

// Populate the default shortcut set.
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Manage Taxonomy'),
'weight' => -20,
'weight' => -18,
'link' => ['uri' => 'internal:/admin/structure/taxonomy'],
]);
$shortcut->save();

$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Manage Menus'),
'weight' => -19,
'weight' => -17,
'link' => ['uri' => 'internal:/admin/structure/menu'],
]);
$shortcut->save();

$shortcut = Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Status Report'),
'weight' => -18,
'weight' => -16,
'link' => ['uri' => 'internal:/admin/reports/status'],
]);
$shortcut->save();
Expand All @@ -61,7 +61,7 @@ function the_build_utility_install() {

// Begin Comment module.
// Remove the comment fields.
$fields = entity_load_multiple_by_properties('field_storage_config', ['type' => 'comment']);
$fields = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(['type' => 'comment']);
foreach ($fields as $field) {
$field->delete();
}
Expand Down
69 changes: 51 additions & 18 deletions targets/drupal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Or, you can specify the export file directly:
<composer command="require" composer="${composer.composer}">
<arg value="drupal/admin_toolbar" />
<arg value="drupal/config_split" />
<arg value="drupal/devel" />
<arg value="drupal/devel:^3.0" />
<arg value="drupal/workbench" />
<arg value="drupal/workbench_tabs" />
</composer>
Expand All @@ -276,22 +276,9 @@ Or, you can specify the export file directly:
<param>the_build_utility</param>
</drush>

<drush command="config-delete" assume="yes">
<param>core.extension</param>
<param>module.standard</param>
</drush>

<drush command="config-set" assume="yes">
<param>core.extension</param>
<param>module.config_installer</param>
<param>1000</param>
</drush>

<drush command="config-set" assume="yes">
<param>core.extension</param>
<param>profile</param>
<param>config_installer</param>
</drush>
<phingcall target="drupal-change-profile">
<property name="new_profile" value="minimal" />
</phingcall>

<drush command="pm-uninstall" assume="yes">
<param>the_build_utility</param>
Expand All @@ -302,12 +289,58 @@ Or, you can specify the export file directly:
<!-- Whitespace is intentional. -->
<echo>

Drupal has been installed with the install profile "standard". Future installs will be run using config_installer.
Drupal has been installed with the install profile "standard". If you'd prefer a different profile, run the installer yourself:
drush site-install minimal

Future installs via 'phing install' will be run using 'drush site:install --existing-config'.

Your config has been exported to ${drupal.root}/${drupal.site.config_sync_directory}</echo>
</target>


<target name="drupal-change-profile" description="Change the install profile on an existing Drupal site.">
<fail unless="new_profile" />

<!-- Get the name of the current profile. -->
<drush command="config-get" returnProperty="current_profile">
<param>core.extension</param>
<param>profile</param>
<option name="format">csv</option>
</drush>

<!-- If the current profile is enabled in the core extensions list, disable it. -->
<drush command="config-get" returnProperty="current_profile_weight">
<param>core.extension</param>
<param>module.${current_profile}</param>
<option name="format">csv</option>
</drush>

<if>
<not><equals arg1="${current_profile_weight}" arg2="" /></not>
<then>
<drush command="config-delete" assume="yes">
<param>core.extension</param>
<param>module.${current_profile}</param>
</drush>
</then>
</if>

<!-- Enable the new profile. -->
<drush command="config-set" assume="yes">
<param>core.extension</param>
<param>module.${new_profile}</param>
<param>1000</param>
</drush>

<!-- Update the profile setting itself. -->
<drush command="config-set" assume="yes">
<param>core.extension</param>
<param>profile</param>
<param>${new_profile}</param>
</drush>
</target>


<target name="drupal-add-multisite" description="Set up a new Drupal multisite.">
<if>
<equals arg1="${build.host}" arg2="pantheon" />
Expand Down

0 comments on commit 41f2385

Please sign in to comment.