Skip to content

Commit 07d8263

Browse files
authored
Merge pull request #39 from dof-dss/development
Unity release
2 parents bb3ac38 + c0ea316 commit 07d8263

File tree

4 files changed

+37
-60
lines changed

4 files changed

+37
-60
lines changed

.circleci/config.yml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,59 @@
1-
# PHP CircleCI 2.0 configuration file
2-
#
3-
# Check https://circleci.com/docs/2.0/language-php/ for more details
41
version: 2.1
52

3+
default_docker_image: &docker_image
4+
docker:
5+
- image: thecodingmachine/php:8.0-v4-apache-node12
6+
environment:
7+
PROJECT_ROOT: "/home/docker/project"
8+
PHP_EXTENSION_GD: 1
9+
PHP_INI_MEMORY_LIMIT: 1g
10+
611
jobs:
712
# Test that coding standards fit drupal.org definitions.
813
coding_standards:
9-
docker:
10-
- image: circleci/php:8.0-apache-browsers
14+
<<: *docker_image
1115
steps:
1216
- checkout
1317
- run:
1418
name: Fetch phpcs and dependencies
1519
command: |
16-
composer require drupal/coder --prefer-stable --no-interaction --optimize-autoloader
20+
composer require drupal/coder
1721
# Move vendor directory up a level as we don't want to code-check all of that.
1822
mv vendor ../
1923
- run:
2024
name: Fetch phpcs convenience script
2125
command: |
22-
curl https://raw.githubusercontent.com/dof-dss/nidirect-drupal/development/phpcs.sh -o /home/circleci/project/phpcs.sh
23-
chmod +x /home/circleci/project/phpcs.sh
26+
curl https://raw.githubusercontent.com/dof-dss/nidirect-drupal/development/phpcs.sh -o $PROJECT_ROOT/phpcs.sh
27+
chmod +x $PROJECT_ROOT/phpcs.sh
2428
- run:
2529
name: PHPCS analysis
26-
command: /home/circleci/project/phpcs.sh /home/circleci "/home/circleci/project"
30+
command: $PROJECT_ROOT/phpcs.sh ~/ "${PROJECT_ROOT}"
2731

2832
deprecated_code:
29-
docker:
30-
- image: circleci/php:8.0-apache-browsers
33+
<<: *docker_image
3134
steps:
3235
- checkout:
33-
path: /home/circleci/origins_modules
34-
- run:
35-
name: Add OS and PHP extensions/config
36-
command: |
37-
sudo cp /home/circleci/origins_modules/.circleci/docker-php-circleci.ini /usr/local/etc/php/conf.d/
38-
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
39-
sudo apt --allow-releaseinfo-change update
40-
sudo apt install -y libpng-dev
41-
sudo docker-php-ext-install gd
36+
path: ~/nicsdru_unity_modules
4237
- run:
4338
name: Fetch latest Drupal version
4439
command: |
45-
cd /home/circleci
46-
composer create-project drupal-composer/drupal-project:9.x-dev /home/circleci/project --no-interaction
40+
cd $PROJECT_ROOT
41+
composer create-project drupal-composer/drupal-project:9.x-dev $PROJECT_ROOT --no-interaction
4742
- run:
4843
name: Download dependent contrib modules.
4944
command: |
50-
cd /home/circleci/project
51-
composer require drupal/entity_embed mglaman/drupal-check:1.3.0 composer/xdebug-handler:2.0.1 --no-interaction
45+
cd $PROJECT_ROOT
46+
composer require --no-interaction drupal/core-dev drupal/entity_embed mglaman/drupal-check \
47+
drupal/search_api_solr drupal/structure_sync
5248
- run:
5349
name: Move custom code into position
54-
command: mv /home/circleci/origins_modules /home/circleci/project/web/modules/origins
50+
command: |
51+
mv ~/nicsdru_unity_modules $PROJECT_ROOT/web/modules/custom
5552
- run:
5653
name: Deprecated code check
5754
command: |
58-
cd /home/circleci/project/web
59-
../vendor/bin/drupal-check modules/origins -e "*/tests/*"
55+
cd $PROJECT_ROOT/web
56+
../vendor/bin/drupal-check modules/custom
6057
6158
workflows:
6259
version: 2

.circleci/docker-php-circleci.ini

Lines changed: 0 additions & 29 deletions
This file was deleted.

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"type": "drupal-module",
55
"license": "MIT",
66
"require": {
7-
"composer/installers": "^1.6"
7+
"composer/installers": "^1.9"
8+
},
9+
"config": {
10+
"allow-plugins": {
11+
"composer/installers": true,
12+
"dealerdirect/phpcodesniffer-composer-installer": true
13+
}
814
}
915
}

unity_internal_link_checker/unity_internal_link_checker.module

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Drupal\Core\Entity\ContentEntityInterface;
99
use Drupal\Core\Entity\EntityInterface;
10+
use Drupal\Core\Field\FieldItemListInterface;
1011

1112
/**
1213
* Implements hook_entity_presave().
@@ -19,8 +20,8 @@ function unity_internal_link_checker_entity_presave(EntityInterface $entity) {
1920
}
2021
if ($entity instanceof ContentEntityInterface) {
2122
if ($entity->hasField('body')) {
22-
$body = $entity->get('body')->value;
23-
$format = $entity->get('body')->format;
23+
$body = $entity->get('body')->value ?? '';
24+
$format = $entity->get('body')->format ?? '';
2425
// Get list of urls to exclude (these have been added at /admin/config/unity_internal_link_checker/link_checker_form).
2526
$config = \Drupal::config('unity_internal_link_checker.linksettings');
2627
// Make sure the array items are clean.
@@ -43,7 +44,7 @@ function unity_internal_link_checker_entity_presave(EntityInterface $entity) {
4344
}
4445
}
4546
}
46-
$entity->body->setValue(['value' => $body, 'format' => $format]);
47+
$entity->set('body', ['value' => $body, 'format' => $format]);
4748
}
4849
}
4950
}
@@ -98,6 +99,8 @@ function unity_internal_link_checker__urls_to_replace(): string {
9899
$host = $matches[0];
99100
}
100101
}
102+
// Strip 'www' from hostname.
103+
$host = str_replace('www.', '', $host);
101104
// List all domain protocols and extensions for our platform and local environments.
102105
$protocols = ['http://', 'http://www.', 'https://', 'https://www.'];
103106
$extensions = [

0 commit comments

Comments
 (0)