Skip to content

Commit

Permalink
Merge pull request #77 from SU-SWS/hotfix-5.3.1
Browse files Browse the repository at this point in the history
Hotfix for google analytics patch removal
  • Loading branch information
imonroe authored Jan 15, 2025
2 parents 95586be + fd9c77e commit 87f07cf
Show file tree
Hide file tree
Showing 33 changed files with 1,360 additions and 1,019 deletions.
9 changes: 5 additions & 4 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ proxy:
- adminer.casbs.lndo.site
services:
appserver:
composer_version: '2'
build_as_root:
- apt-get update && apt-get install -y libmagickwand-dev
- export PHP_IMAGICK_NS=autodetect && pecl install -n imagick
- docker-php-ext-enable imagick
# - apt-get update && apt-get install -y libmagickwand-dev
# - export PHP_IMAGICK_NS=autodetect && pecl install -n imagick
# - docker-php-ext-enable imagick
- pecl install pcov
- docker-php-ext-enable pcov
build:
- composer install
# - composer install
volumes:
- ~/.acquia:/var/www/.acquia
ssl: true
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@
},
"enable-patching": true,
"patches": {
"drupal/google_analytics": {
"https://www.drupal.org/project/google_analytics/issues/3373921": "https://www.drupal.org/files/issues/2023-08-07/google-analytics-issues-3373921-cannot-install-from-existing-config-11.patch"
},
"drupal/hook_event_dispatcher": {
"https://www.drupal.org/project/hook_event_dispatcher/issues/3354751": "https://www.drupal.org/files/issues/2024-03-14/hook_event_dispatcher-4.x-3354751-7.patch"
},
Expand Down
1,748 changes: 874 additions & 874 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docroot/modules/custom/stanford_media/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Stanford Media

11.1.3
--------------------------------------------------------------------------------
_Release Date: 2024-12-02_

- Show bundle list in 'Bulk Upload' button

11.1.2
--------------------------------------------------------------------------------
_Release Date: 2024-10-29_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Media Duplicate Validation'
type: module
description: 'Media Validation plugins to help prevent duplication of media items'
core_version_requirement: ^10 || ^11
version: 11.1.2
version: 11.1.3
package: media
dependencies:
- drupal:media
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function addPage($entity_type_id) {
$page['#bundles']['bulk'] = [
'label' => $this->t('Upload File(s)'),
'description' => $this->t('Add one or more files to the Media Library.'),
'add_link' => new Link($this->t('Bulk Upload'), $url),
'add_link' => new Link($this->t('Bulk Upload: @bulk_bundles', ['@bulk_bundles' => implode(', ', $bulk_bundles)]), $url),
];

return $page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Provides media module configuration and plugins.
core_version_requirement: ^10.2 || ^11
package: media
type: module
version: 11.1.2
version: 11.1.3
dependencies:
- dropzonejs:dropzonejs
- drupal:breakpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: project
- name: Build project
Expand All @@ -31,7 +31,7 @@ jobs:
composer global require su-sws/stanford-caravan:10.x-dev
~/.config/composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage
- name: Save Test Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: unit-tests-results
Expand All @@ -53,7 +53,7 @@ jobs:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: project
- name: Build project
Expand All @@ -63,7 +63,7 @@ jobs:
composer global require su-sws/stanford-caravan:11.x-dev
~/.config/composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage
- name: Save Test Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: unit-tests-results
Expand Down Expand Up @@ -91,15 +91,15 @@ jobs:
# - 33306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# with:
# path: project
# - name: Run tests
# run: |
# composer global require su-sws/stanford-caravan:11.x-dev
# ~/.config/composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=acceptance
# - name: Save Test Results
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: acceptance-tests-results
Expand Down Expand Up @@ -130,15 +130,15 @@ jobs:
# - 33306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# with:
# path: project
# - name: Run tests
# run: |
# composer global require su-sws/stanford-caravan:11.x-dev
# ~/.config/composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=functional
# - name: Save Test Results
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: functional-tests-results
Expand Down
12 changes: 12 additions & 0 deletions docroot/modules/custom/stanford_migrate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Stanford Migrate

8.6.9
--------------------------------------------------------------------------------
_Release Date: 2025-01-09_

- Allow install with migrate_file > 3.0 for D11 support.

8.6.8
--------------------------------------------------------------------------------
_Release Date: 2024-12-13_

- Fix access check for CSV upload form/

8.6.7
--------------------------------------------------------------------------------
_Release Date: 2024-10-04_
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/custom/stanford_migrate/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": ">=8.0",
"drupal/core": "^10.3 || ^11",
"drupal/empty_fields": "^1.0@beta",
"drupal/migrate_file": "^2.0",
"drupal/migrate_file": "^2.0 || ^3.0",
"drupal/migrate_plus": "^6.0",
"drupal/migrate_source_csv": "^3.4",
"drupal/migrate_tools": "^6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function loadOverrides($names) {
foreach ($names as $name) {

// Only override migration entities.
if (substr($name, 0, 23) == 'migrate_plus.migration.') {
if (str_starts_with($name, 'migrate_plus.migration.')) {
$migration_id = pathinfo($name, PATHINFO_EXTENSION);

// If the state value is not set, don't do any overriding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

namespace Drupal\stanford_migrate\Form;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\State\StateInterface;
use Drupal\file\FileUsage\FileUsageInterface;
use Drupal\migrate\MigrateMessage;
Expand Down Expand Up @@ -58,31 +56,11 @@ public static function create(ContainerInterface $container) {
*/
public function __construct(protected MigrationPluginManagerInterface $migrationManager, protected StateInterface $state, protected FileUsageInterface $fileUsage, EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;

/** @var \Drupal\migrate_plus\Entity\MigrationInterface $migration */
$migration = $this->getRequest()->attributes->get('migration');
$this->migrationPlugin = $this->migrationManager->createInstance($migration->id());
}

/**
* Check if the user should have access to the form.
*
* @param \Drupal\Core\Session\AccountInterface $account
* Current user.
*
* @return \Drupal\Core\Access\AccessResult
* Allowed if the migration is a csv importer.
*/
public function access(AccountInterface $account): AccessResult {
$source_plugin = $this->migrationPlugin->getSourcePlugin();
// If the migration doesn't import csv, there's no reason to allow the form.
if ($source_plugin->getPluginId() != 'csv') {
return AccessResult::forbidden();
}
$migration_id = $this->migrationPlugin->id();
return AccessResult::allowedIfHasPermission($account, "import $migration_id migration");
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getAllIds() {
* Modify the parent method by adding the current feed url into the source
* data. This can then be used by process plugins.
*/
public function next() {
public function next(): void {
$this->currentSourceIds = NULL;
$this->currentRow = NULL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function getSourceData(string $url, string|int $item_selector = ''): a
* Paged url results.
*/
protected static function getPagedUrls(string $url): array {
$query = parse_url($url, PHP_URL_QUERY);
$query = parse_url($url, PHP_URL_QUERY) ?: '';
$base_url = trim(str_replace($query, '', $url), '?');
parse_str($query, $query_parts);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Adds more functionality to migrate and migrate plus modules'
type: module
core_version_requirement: ^10.3 || ^11
package: 'Stanford'
version: 8.6.7
version: 8.6.9
dependencies:
- drupal:migrate
- empty_fields:empty_fields
Expand Down
25 changes: 21 additions & 4 deletions docroot/modules/custom/stanford_migrate/stanford_migrate.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
* Contains stanford_migrate.module.
*/

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\migrate\Plugin\MigrateSourceInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Drupal\migrate_plus\Entity\Migration;
use Drupal\node\NodeInterface;
use Drupal\ultimate_cron\CronJobInterface;
use Drupal\migrate_plus\Entity\MigrationInterface as MigrationEntityInterface;

/**
* Implements hook_help().
Expand Down Expand Up @@ -59,7 +62,8 @@ function stanford_migrate_migrate_prepare_row(Row $row, MigrateSourceInterface $
* @return array|\Drupal\migrate_plus\Entity\MigrationInterface|mixed
* Migration entity or null/false if none found.
*
* @deprecated in 8.2.3 and is removed in 9.0.0. Use \Drupal::service('stanford_migrate')->getNodesMigration() instead.
* @deprecated in 8.2.3 and is removed in 9.0.0. Use
* \Drupal::service('stanford_migrate')->getNodesMigration() instead.
*/
function stanford_migrate_get_migration(NodeInterface $node) {
return \Drupal::service('stanford_migrate')->getNodesMigration($node);
Expand Down Expand Up @@ -150,7 +154,7 @@ function stanford_migrate_entity_form_display_alter(EntityFormDisplayInterface $
* Implements hook_preprocess_HOOK().
*/
function stanford_migrate_preprocess_field(&$variables) {
if ($variables['element']['#third_party_settings']['stanford_migrate']['readonly'] ?? false) {
if ($variables['element']['#third_party_settings']['stanford_migrate']['readonly'] ?? FALSE) {
// Wrap the readonly form fields with classes so that they can be identified
// more easily to the user.
$variables['attributes']['class'][] = 'messages';
Expand Down Expand Up @@ -205,6 +209,17 @@ function stanford_migrate_entity_type_alter(array &$entity_types) {
}
}

/**
* Implements hook_ENTITY_TYPE_access().
*/
function stanford_migrate_migration_access(MigrationEntityInterface $entity, $operation, AccountInterface $account) {
if ($operation != 'csv') {
return AccessResult::neutral();
}
$migration_id = $entity->id();
return AccessResult::allowedIfHasPermission($account, "import $migration_id migration");
}

/**
* Implements hook_ENTITY_TYPE_delete().
*/
Expand Down Expand Up @@ -297,7 +312,8 @@ function stanford_migrate_ultimate_cron_task(CronJobInterface $cron_entity) {
* @param bool $batch
* Execute the migration using a batch process.
*
* @deprecated in 8.2.3 and is removed in 9.0.0. Use \Drupal::service('stanford_migrate')->executeMigration() instead.
* @deprecated in 8.2.3 and is removed in 9.0.0. Use
* \Drupal::service('stanford_migrate')->executeMigration() instead.
*
* @see \Drupal\migrate_tools\Drush\MigrateToolsCommands::executeMigration()
*/
Expand All @@ -313,7 +329,8 @@ function stanford_migrate_execute_migration(MigrationInterface $migration, strin
* An array keyed by migration group, each value containing an array of
* migrations or an empty array if no migrations match the input criteria.
*
* @deprecated in 8.2.3 and is removed in 9.0.0. Use \Drupal::service('stanford_migrate')->getMigrationList() instead.
* @deprecated in 8.2.3 and is removed in 9.0.0. Use
* \Drupal::service('stanford_migrate')->getMigrationList() instead.
*
* @see \Drupal\migrate_tools\Drush\MigrateToolsCommands::migrationsList()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ entity.migration.csv_upload:
_title: 'Upload CSV'
_migrate_group: true
requirements:
_custom_access: 'Drupal\stanford_migrate\Form\StanfordMigrateCsvImportForm::access'
_entity_access: 'migration.csv'
_module_dependencies: migrate_source_csv
options:
parameters:
Expand All @@ -38,7 +38,7 @@ entity.migration.csv_template:
_controller: '\Drupal\stanford_migrate\Controller\MigrationCsvTemplate::getEmptyTemplate'
_title: 'CSV Template'
requirements:
_custom_access: 'Drupal\stanford_migrate\Form\StanfordMigrateCsvImportForm::access'
_entity_access: 'migration.csv'
_module_dependencies: migrate_source_csv
options:
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Drupal\migrate_plus\Entity\MigrationInterface;
use Drupal\Tests\stanford_migrate\Kernel\StanfordMigrateKernelTestBase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
* Class StanfordMigrateCsvImportFormTest.
Expand Down Expand Up @@ -44,33 +45,6 @@ public function setup(): void {
$this->installSchema('file', ['file_usage']);
}

/**
* Migrations that aren't csv importers are denied access.
*/
public function testNonCsvAccess() {
$this->setMigrationRequest(Migration::load('stanford_migrate'));

$form_object = \Drupal::entityTypeManager()
->getFormObject('migration', 'csv-upload');
$account = $this->createMock(AccountInterface::class);
$this->assertFalse($form_object->access($account)->isAllowed());
}

/**
* CSV Importers have permission access.
*/
public function testCsvPermissionAccess() {
$this->setCsvMigrationRequest();

$account = $this->createMock(AccountInterface::class);
$form_object = \Drupal::entityTypeManager()
->getFormObject('migration', 'csv-upload');
$this->assertFalse($form_object->access($account)->isAllowed());

$account->method('hasPermission')->willReturn(TRUE);
$this->assertTrue($form_object->access($account)->isAllowed());
}

/**
* Test the functionality of the form.
*/
Expand Down Expand Up @@ -157,6 +131,8 @@ protected function setMigrationRequest(MigrationInterface $migration) {
'migration' => $migration,
];
$request = new Request([], [], $attributes);
$session = $this->createMock(SessionInterface::class);
$request->setSession($session);
\Drupal::requestStack()->push($request);
}

Expand Down
Loading

0 comments on commit 87f07cf

Please sign in to comment.