From 8d771e2db85ff18e16ec447d9209b576d4498d9c Mon Sep 17 00:00:00 2001 From: Adam Nagy Date: Thu, 9 Jan 2025 17:27:39 +0100 Subject: [PATCH 1/3] EWPP-4991: Use PHP8.3 version. --- .drone.yml | 14 +++++++------- composer.json | 2 +- docker-compose.yml | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 170deb0..2a09f08 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,8 +19,8 @@ services: - DOCUMENT_ROOT=/test/oe_dashboard_agent - COMPOSERVER=--2 mysql: - image: git.fpfis.tech.ec.europa.eu/fpfis/dependency_proxy/containers/percona:5.7 - command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 + image: git.fpfis.tech.ec.europa.eu/fpfis/dependency_proxy/containers/percona:8.0 + command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 --skip-log-bin --innodb-flush-log-at-trx-commit=2 --innodb-read-io-threads=16 --innodb-write-io-threads=16 environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes @@ -61,11 +61,11 @@ pipeline: matrix: include: - - CORE_VERSION: 10.2.0 - PHP_VERSION: 8.1 - - CORE_VERSION: 10.2.0 - PHP_VERSION: 8.2 - CORE_VERSION: 10.3.0 PHP_VERSION: 8.1 - CORE_VERSION: 10.3.0 - PHP_VERSION: 8.2 + PHP_VERSION: 8.3 + - CORE_VERSION: 10.4.0 + PHP_VERSION: 8.1 + - CORE_VERSION: 10.4.0 + PHP_VERSION: 8.3 diff --git a/composer.json b/composer.json index 97b275c..b9727f3 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "drupal/drupal-extension": "^5.0", "drush/drush": "^12.4", "openeuropa/code-review": "^2.0.0-alpha6", - "openeuropa/task-runner-drupal-project-symlink": "^1.0-beta6", + "openeuropa/task-runner-drupal-project-symlink": "^1.0", "phpspec/prophecy-phpunit": "^2", "symfony/phpunit-bridge": "^6.2" }, diff --git a/docker-compose.yml b/docker-compose.yml index ee4cf7e..7938003 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ -version: '2' services: web: - image: fpfis/httpd-php-dev:8.1 + image: fpfis/httpd-php-ci:8.3 working_dir: /var/www/html ports: - 8080:8080 @@ -17,8 +16,8 @@ services: # Enable step debugging for all PHP request. See ./README.md#step-debugging for more information. # XDEBUG_SESSION: 1 mysql: - image: percona/percona-server:5.7 - command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 + image: percona/percona-server:8.0 + command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 --skip-log-bin --innodb-flush-log-at-trx-commit=2 --innodb-read-io-threads=16 --innodb-write-io-threads=16 environment: MYSQL_ALLOW_EMPTY_PASSWORD: "yes" # ports: From 5ebab6cf66daa7834b9f9b224efbea42adf81674 Mon Sep 17 00:00:00 2001 From: Adam Nagy Date: Fri, 10 Jan 2025 10:23:47 +0100 Subject: [PATCH 2/3] EWPP-4991: Fix message assertion after D10.4. --- docker-compose.yml | 2 +- tests/src/Functional/DashboardAgentTest.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7938003..67c556e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: web: - image: fpfis/httpd-php-ci:8.3 + image: fpfis/httpd-php-dev:8.3 working_dir: /var/www/html ports: - 8080:8080 diff --git a/tests/src/Functional/DashboardAgentTest.php b/tests/src/Functional/DashboardAgentTest.php index 8aed2d4..5ad548f 100644 --- a/tests/src/Functional/DashboardAgentTest.php +++ b/tests/src/Functional/DashboardAgentTest.php @@ -204,7 +204,13 @@ public function testUliEndpoint(): void { // Access the ULI and assert we got logged in. $this->drupalGet($uli); - $this->assertSession()->pageTextContains('You have just used your one-time login link. It is no longer necessary to use this link to log in.'); + if (version_compare(\Drupal::VERSION, '10.4.0', '<')) { + // @todo Remove this after we drop support for D10.3. + $this->assertSession()->pageTextContains('You have just used your one-time login link. It is no longer necessary to use this link to log in.'); + } + else { + $this->assertSession()->pageTextContains('You have used a one-time login link. You can set your new password now.'); + } } /** From 04e1164285b24f4d933225e583f5a4703d8716f9 Mon Sep 17 00:00:00 2001 From: Adam Nagy Date: Fri, 17 Jan 2025 16:55:49 +0100 Subject: [PATCH 3/3] EWPP-4991: Use drupal code review component from openeuropa. --- composer.json | 14 ++++++++++++-- grumphp.yml.dist | 22 ++++++++-------------- phpstan.neon.dist | 2 ++ src/Controller/ExtensionsController.php | 19 +++++++++++++++---- 4 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 phpstan.neon.dist diff --git a/composer.json b/composer.json index b9727f3..db5c2c2 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "drupal/datetime_testing": "^1.0-beta4", "drupal/drupal-extension": "^5.0", "drush/drush": "^12.4", - "openeuropa/code-review": "^2.0.0-alpha6", + "openeuropa/code-review-drupal": "^1.0.0-alpha", "openeuropa/task-runner-drupal-project-symlink": "^1.0", "phpspec/prophecy-phpunit": "^2", "symfony/phpunit-bridge": "^6.2" @@ -28,6 +28,14 @@ { "type": "composer", "url": "https://packages.drupal.org/8" + }, + { + "type": "git", + "url": "https://github.com/openeuropa/DrupalDriver.git" + }, + { + "type": "git", + "url": "https://github.com/openeuropa/code-review-drupal.git" } ], "autoload": { @@ -65,7 +73,9 @@ "cweagans/composer-patches": true, "dealerdirect/phpcodesniffer-composer-installer": true, "drupal/core-composer-scaffold": true, - "phpro/grumphp": true + "phpro/grumphp": true, + "phpro/grumphp-shim": true, + "phpstan/extension-installer": true } } } diff --git a/grumphp.yml.dist b/grumphp.yml.dist index c86a910..af65fba 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -1,18 +1,12 @@ imports: - - { resource: vendor/openeuropa/code-review/dist/drupal-conventions.yml } -parameters: - tasks.phpcs.ignore_patterns: - - build/ - - node_modules/ - - vendor/ - tasks.phpcs.triggered_by: - - inc - - install - - module - - php - - theme - - yml - + - { resource: ./vendor/openeuropa/code-review-drupal/dist/oe-component-conventions.yml } grumphp: + tasks: + phpparser: + ignore_patterns: + - vendor/ git_hook_variables: EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web' + +parameters: + tasks.phpstan.configuration: phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..ca9247a --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,2 @@ +includes: + - ./vendor/openeuropa/code-review-drupal/dist/phpstan.drupal.neon diff --git a/src/Controller/ExtensionsController.php b/src/Controller/ExtensionsController.php index 07c78d1..bde1f12 100644 --- a/src/Controller/ExtensionsController.php +++ b/src/Controller/ExtensionsController.php @@ -63,6 +63,13 @@ class ExtensionsController extends ControllerBase { */ protected $updateHookRegistry; + /** + * The theme extension list. + * + * @var \Drupal\Core\Extension\ThemeExtensionList + */ + protected ThemeExtensionList $themeExtensionList; + /** * ExtensionsController constructor. * @@ -78,14 +85,17 @@ class ExtensionsController extends ControllerBase { * The location of the manifest file. * @param \Drupal\Core\Update\UpdateHookRegistry $updateHookRegistry * The update hook registry. + * @param \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list + * The theme extension list. */ - public function __construct(ModuleExtensionList $extension_list_module, ThemeHandlerInterface $theme_handler, LoggerChannelFactoryInterface $logger_factory, EventDispatcherInterface $eventDispatcher, string $manifest_file_location, UpdateHookRegistry $updateHookRegistry) { + public function __construct(ModuleExtensionList $extension_list_module, ThemeHandlerInterface $theme_handler, LoggerChannelFactoryInterface $logger_factory, EventDispatcherInterface $eventDispatcher, string $manifest_file_location, UpdateHookRegistry $updateHookRegistry, ThemeExtensionList $theme_extension_list) { $this->moduleExtensionList = $extension_list_module; $this->themeHandler = $theme_handler; $this->logger = $logger_factory->get('dashboard_agent'); $this->eventDispatcher = $eventDispatcher; $this->manifestFileLocation = $manifest_file_location; $this->updateHookRegistry = $updateHookRegistry; + $this->themeExtensionList = $theme_extension_list; } /** @@ -98,7 +108,8 @@ public static function create(ContainerInterface $container) { $container->get('logger.factory'), $container->get('event_dispatcher'), $container->getParameter('oe_dashboard_agent.manifest_file_location'), - $container->get('update.update_hook_registry') + $container->get('update.update_hook_registry'), + $container->get('extension.list.theme') ); } @@ -122,7 +133,7 @@ public function extensions() { // Get all available themes. try { - $themes = $this->themeHandler->rebuildThemeData(); + $themes = $this->themeExtensionList->reset()->getList(); // Sort themes by name. uasort($themes, [ThemeExtensionList::class, 'sortByName']); } @@ -185,7 +196,7 @@ public function extensions() { } // Add Drupal and PHP versions. - $info['drupal_version'] = \DRUPAL::VERSION; + $info['drupal_version'] = \Drupal::VERSION; $info['php_version'] = phpversion(); $this->addSiteVersion($info);