Skip to content

Commit d60a391

Browse files
committed
Merge branch '10.x-dev' into 10.x
2 parents 13ef1c7 + 5c856fa commit d60a391

File tree

7 files changed

+70
-12
lines changed

7 files changed

+70
-12
lines changed

.circleci/config.yml

+24-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
default_docker_image: &docker_image
44
docker:
5-
- image: thecodingmachine/php:8.0-v4-apache-node12
5+
- image: thecodingmachine/php:8.2-v4-apache-node12
66
environment:
77
PROJECT_ROOT: "/home/docker/project"
88
PHP_EXTENSION_GD: 1
@@ -38,13 +38,13 @@ jobs:
3838
name: Fetch latest Drupal version
3939
command: |
4040
cd $PROJECT_ROOT
41-
composer create-project drupal-composer/drupal-project:9.x-dev $PROJECT_ROOT --no-interaction
41+
composer create-project drupal-composer/drupal-project:10.x-dev $PROJECT_ROOT --no-interaction
4242
- run:
4343
name: Download dependent contrib modules.
4444
command: |
4545
cd $PROJECT_ROOT
4646
composer require --no-interaction drupal/entity_embed mglaman/drupal-check \
47-
drupal/search_api_solr drupal/structure_sync mglaman/phpstan-drupal:1.1.27
47+
drupal/search_api_solr drupal/structure_sync -W
4848
- run:
4949
name: Move custom code into position
5050
command: |
@@ -55,9 +55,30 @@ jobs:
5555
cd $PROJECT_ROOT/web
5656
../vendor/bin/drupal-check modules/custom
5757
58+
disallowed_functions:
59+
<<: *docker_image
60+
steps:
61+
- checkout:
62+
path: ~/nicsdru_unity_modules
63+
- run:
64+
name: Fetch latest Drupal core and other misc composer tools.
65+
command: |
66+
cd $PROJECT_ROOT
67+
composer create-project drupal/recommended-project:10.1.x-dev $PROJECT_ROOT --no-interaction
68+
composer require --dev phpstan/extension-installer spaze/phpstan-disallowed-calls
69+
- run:
70+
name: Move custom code into position
71+
command: mv ~/nicsdru_unity_modules $PROJECT_ROOT/web/modules/custom
72+
- run:
73+
name: Check for disallowed function calls
74+
command: |
75+
CHECK_DIRS="$CHECK_DIRS ${PROJECT_ROOT}/web/modules/custom"
76+
vendor/bin/phpstan analyse $CHECK_DIRS -c $PROJECT_ROOT/web/modules/custom/.circleci/phpstan.neon
77+
5878
workflows:
5979
version: 2
6080
static_analysis:
6181
jobs:
6282
- coding_standards
6383
- deprecated_code
84+
- disallowed_functions

.circleci/phpstan.neon

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# phpstan.neon
2+
3+
parameters:
4+
fileExtensions:
5+
- module
6+
- theme
7+
- inc
8+
- install
9+
- profile
10+
- engine
11+
paths:
12+
- src
13+
disallowedFunctionCalls:
14+
- function: var_dump
15+
message: 'This is likely not intended to be used outside of local development, please remove it.'
16+
- function: dump
17+
message: 'This is likely not intended to be used outside of local development, please remove it.'
18+
- function: kint
19+
message: 'This is likely not intended to be used outside of local development, please remove it.'
20+
- function: ksm
21+
message: 'This is likely not intended to be used outside of local development, please remove it.'
22+
- function: die
23+
message: 'This is likely not intended to be used outside of local development, please remove it.'
24+
- function: exit
25+
message: 'This is likely not intended to be used outside of local development, please remove it.'
26+
customRulesetUsed: true
27+
reportUnmatchedIgnoredErrors: false
28+
# Ignore phpstan-drupal extension's rules.
29+
ignoreErrors:
30+
- '#\Drupal calls should be avoided in classes, use dependency injection instead#'
31+
- '#Plugin definitions cannot be altered.#'
32+
- '#Missing cache backend declaration for performance.#'
33+
- '#Plugin manager has cache backend specified but does not declare cache tags.#'

unity_breadcrumbs/unity_breadcrumbs.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function unity_breadcrumbs_system_breadcrumb_alter(Breadcrumb &$breadcrumb, Rout
5858

5959
if ($node instanceof NodeInterface) {
6060
// Append the page title to the end of Book pages.
61-
if ($node->book) {
61+
if ($node->get('book')) {
6262
$request = \Drupal::request();
6363
$title = \Drupal::service('title_resolver')
6464
->getTitle($request, $route_match->getRouteObject());

unity_common/unity_common.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function unity_common_preprocess_image_formatter(array &$variables) {
133133
if ($media_entity instanceof MediaInterface && $media_entity->bundle() === 'document') {
134134
$file_storage = \Drupal::entityTypeManager()->getStorage('file');
135135
// Get the underlying file associated with this document entity.
136-
$file = $file_storage->load($media_entity->field_media_file->target_id);
136+
$file = $file_storage->load($media_entity->get('field_media_file')->target_id);
137137

138138
if ($file instanceof FileInterface === FALSE) {
139139
return;

unity_file_migrations/src/EventSubscriber/PostMigrationSubscriber.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager,
5757
LoggerChannelFactory $logger) {
5858
$this->entityTypeManager = $entity_type_manager;
5959
$this->logger = $logger->get('unity_file_migrations');
60-
$this->dbConnD7 = Database::getConnection('default', 'liofa7');
60+
// Open the Liofa legacy database if we are running inside the Liofa
61+
// site and there is a connection to 'liofa7', otherwise just open
62+
// 'default' twice and the Liofa check will fail in onMigratePostImport().
63+
$legacy_db = 'default';
64+
foreach (Database::getAllConnectionInfo() as $key => $targets) {
65+
if ($key == 'liofa7') {
66+
$legacy_db = $key;
67+
}
68+
}
69+
$this->dbConnD7 = Database::getConnection('default', $legacy_db);
6170
$this->dbConnD10 = Database::getConnection('default', 'default');
6271
}
6372

unity_file_migrations/src/MigrationProcessors.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function processNodeStatus(int $nid, string $status) {
137137
// If node was published on D7, make sure that it is published on D8.
138138
$node = $this->nodeStorage->load($nid);
139139
if ($node instanceof NodeInterface) {
140-
$node->status = 1;
140+
$node->set('status', 1);
141141
$node->set('moderation_state', 'published');
142142
$node->save();
143143
}

unity_file_migrations/src/PublicationLinkProcessor.php

-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public static function publicationLinks(array $content) {
6262
$file_target_id = $file->id();
6363
array_push($file_target_ids, $file_target_id);
6464
}
65-
// This is handy for debugging if the filename doesn't match.
66-
else {
67-
var_dump('Nid: ' . $nid . ' filename: ' . $embedded_file_name);
68-
}
69-
7065
}
7166
}
7267
// Return the file ID's and load them into the media field.

0 commit comments

Comments
 (0)