Philadelphia
Account created on 21 January 2010, almost 15 years ago
  • Senior Drupal Solutions Architect at Purple 
#

Merge Requests

Recent comments

🇺🇸United States djdevin Philadelphia

Spoke too soon, this prevents the entity repository from getting swapped out so the loaded revisions are wrong.

🇺🇸United States djdevin Philadelphia

That approach seems to conflict with jsonapi_cross_bundles but I don't know why

The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "workspaces_parallel.entity_repository", path: "redirect.request_subscriber -> redirect.checker -> access_manager -> paramconverter_manager -> paramconverter.jsonapi.entity_uuid -> workspaces_parallel.entity_repository -> jsonapi.exception_subscriber -> jsonapi.serializer -> serializer.normalizer.resource_identifier.jsonapi_extras -> Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface -> jsonapi_cross_bundles.cross_bundle_resource_type_repository.inner". in Drupal\Component\DependencyInjection\Container->get() (line 149 of core/lib/Drupal/Component/DependencyInjection/Container.php).
🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

This is still an issue, the problem is that the form rebuilds when you add another condition, and then the arguments end up being a string instead of an array.

This only happens if you try to add more than 1 condition to an Entity reference views component.

🇺🇸United States djdevin Philadelphia

I updated the README.md.

🇺🇸United States djdevin Philadelphia

djdevin made their first commit to this issue’s fork.

🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

Thanks!

🇺🇸United States djdevin Philadelphia
🇺🇸United States djdevin Philadelphia

I fixed a few issues from my PoC in #4 and published it here: https://www.drupal.org/project/workspaces_parallel

Caveat, there is no reintegration so any live changes just get overwritten when you publish (only content that was edited within the Workspace).

🇺🇸United States djdevin Philadelphia

Patch worked once rerolled for 10.3.x, not flooding the query log anymore.

There's a tag set on config:system.menu.[name], not sure if that gets flushed if a link changes.

🇺🇸United States djdevin Philadelphia

Seems to still be called a lot, even with a warm cache. Looking at RDS insights it's still a top query under load.

General log is full of the same query, even when trying the page as anon (no page cache, just dynamic cache).

(346 is the current node being viewed)

Could be something with our site but still investigating.

🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

I was unable to test the MR because we haven't updated to 11.x yet and it doesn't apply to 10.3.x The modernizr tweak didn't seem to work for me, but we have a ton of libraries so it could easily be another library with weights.

Something else I'm also seeing related to performance is a ton of these queries (1000s) under heavy traffic:

Very likely old cached JS/CSS calls.

Seems I can just make up some random hash and pass all the query parameters, and it will make several DB calls. Could easily DDOS the site as 4xx errors are usually not cached. Since no JS file is ever created it keeps crunching.

https://drupal/sites/default/files/css/anything.css?delta=0&language=en&...

🇺🇸United States djdevin Philadelphia

Would be happy to have you on. Thanks!

🇺🇸United States djdevin Philadelphia

I just added a print_r(array_column($group['items'], 'data')); right before it gets passed to generateHash and the order is wrong causing the hash mismatch.

🇺🇸United States djdevin Philadelphia

Seeing this in 10.3.1.

Adding a breakpoint on AssetGroupSetHashTrait::generateHash() shows a differently weighted list when it is called on the current page vs. from the .js file, so the hash_equals() in AssetControllerBase fails and it doesn't cache the file.

I don't think generateHash() is the problem because the weights are already wrong for some reason.

Trying to reproduce outside of our specific site, but it's a list of 56 JS files and the middle of the list is out of order, resulting in a different hash.

We do have a lot of library dependencies so something is not taking those into account.

Reverting to 10.2.6 caches it to disk as expected.

🇺🇸United States djdevin Philadelphia

Rebased against 11.x (applies to 10.3.x cleanly as well)

deleteFromDedicatedTables() doesn't have any test coverage - since this isn't a bug I wonder if having coverage through SqlContentEntityStorageSchemaTest is enough?

🇺🇸United States djdevin Philadelphia

Sorry this is actually Drupal 10.3!

But there is an issue in core to not break BC here: https://www.drupal.org/project/drupal/issues/3450244 🐛 Provide BC for ImageStyleDownloadController Needs review

🇺🇸United States djdevin Philadelphia

In our case, merging wasn't necessary, all derivatives are based off of the currently published version so it wasn't a big deal.

This functionality is also necessary for a situation like this:

- Live site
- Promo A
- Promo A takedown
- Promo B

Otherwise you have to wait until the Promo A takedown to start working on the next promo

I removed the constraint then added a hook_entity_prepare_form that would swap out the entity version. When editing, Drupal only loads the most recent revision. It seems to work alright, I'm not sure of any caveats. The order of versioning is kinda wonky since the latest version might not be the content that is going to go out, but just don't look at the revisions page!

It might be useful to add a column on that page to show that a revision belongs to which workspace.


/**
 * Implements hook_entity_prepare_form().
 *
 * Replace the form's entity with one that is associated with the current
 * workspace.
 *
 * Workspace already replaces the entity being viewed based on the workspace.
 * But edit forms always load the most recent revision.
 *
 * This is based on Drupal\workspaces\EntityOperations::entityPreload, altered
 * to work in hook_entity_prepare_form().
 */
function custom_entity_prepare_form(EntityInterface &$entity, $operation, FormStateInterface $form_state) {
  if ($operation == 'edit') {
    $entityTypeManager = \Drupal::entityTypeManager();
    $workspaceManager = \Drupal::service('workspaces.manager');
    $workspaceAssociation = \Drupal::service('workspaces.association');

    // Only run if the entity type can belong to a workspace and we are in a
    // non-default workspace.
    if (!$workspaceManager->shouldAlterOperations($entityTypeManager->getDefinition($entity->getEntityTypeId()))) {
      return;
    }

    // Get a list of revision IDs for entities that have a revision set for the
    // current active workspace. If an entity has multiple revisions set for a
    // workspace, only the one with the highest ID is returned.
    if ($tracked_entities = $workspaceAssociation->getTrackedEntities($workspaceManager->getActiveWorkspace()->id(), $entity->getEntityTypeId(), [$entity->id()])) {
      /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
      $storage = $entityTypeManager->getStorage($entity->getEntityTypeId());

      $vid = key($tracked_entities[$entity->getEntityTypeId()]);

      // Swap out the entity.
      $entity = $storage->loadRevision($vid);

      // Just an indicator we could use in form_alter.
      $form_state->set('pur_workflow_entity_prepare_form', TRUE);
    }
  }
}

[...]

/**
 * Implements hook_validation_constraint_alter().
 *
 * Replace the default workspace constraint with one that does nothing.
 */
function custom_validation_constraint_alter(array &$definitions) {
  if (isset($definitions['EntityWorkspaceConflict'])) {
    $definitions['EntityWorkspaceConflict']['class'] = CustomEntityWorkspaceConflictConstraint::class;
  }
}


🇺🇸United States djdevin Philadelphia

Scale was removed from Quiz core and moved to https://git.drupalcode.org/project/quiz_scale but it is currently unsupported.

It was not really question type, as it could not be scored. Any answer was correct.

If you are looking to collect scale answers, I would use Webform instead.

🇺🇸United States djdevin Philadelphia
🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

Quiz builds on a lot of core/contrib functionality instead of reinventing (if you remember, was done for the D5-D7 versions, resulting in a mountain of technical debt).

Rules is used for evaluating all the feedback items and allows for custom conditions. Agreed it should probably move to something like ECA or core conditions.

entity - Quiz requires some Entity functionality not provided by core, e.g base entity classes/forms/handlers
range - Needed for widgets like grade range (e.g. grade between X and Y)
rules, typed_data - Needed for evaluating Feedback conditions
paragraphs - Needed for all sorts of nested data storage e.g. MCQ questions, Feedbacks, Grade feedback, Taxonomy questions...
entity_reference_revisions - Dependency of paragraphs, also powers Quiz revisioning
views_bulk_operations - Needed for admin functionality e.g. question bank, quiz questions, results
views_data_export, rest, csv_serialization - Needed for reporting/exports of Quiz results

🇺🇸United States djdevin Philadelphia

It sounds like your user does not have permission to create the paragraph type that Quiz uses.

You'll have to grant the ability to create/edit Quiz Question Term Pool paragraphs.

🇺🇸United States djdevin Philadelphia

It's me, hi, I'm the problem, it's me...

We had this code altering JS, removing it also fixes the issue.

function xxx_js_alter(&$javascript, AttachedAssetsInterface $assets) {
  $request = \Drupal::request();
  if ($request->getPathInfo() === '/xxx') {
    unset($javascript['core/misc/drupal.init.js']);
    unset($javascript['core/misc/drupalSettingsLoader.js']);
    unset($javascript['core/misc/drupal.js']);
  }
}

Though I'm not sure why doing that wiped out the rest of the JS, and how adding a dependency on core/once fixes it.

🇺🇸United States djdevin Philadelphia

I tried the MR and those suggestions to no avail. I noticed the problem was no longer happening for me so I backtracked over any changes and found out that I added a dependency on a completely different library, to a completely different library (on core/once) which causes some change in how the JS gets grouped.

As a test, I just added a dependency on core/once to the broken external library (which has no dependencies) and that also worked.

some-external-library:
  js:
    //domain.com/ext.js: { type: external, minified: true }
    //domain.com/ext2.js: { type: external, minified: true }
  dependencies:
    # Why is this needed? We don't know.
    - core/once

Can't figure it out but at least I know removing that seemingly innocuous library dependency triggers the issue.

The working JS output looks like:

When the JS is broken it looks like: with that last aggregated file being blank. Regular pages are unaffected, only broken in this case where we are calling getJsAssets() manually for some decoupled functionality.
🇺🇸United States djdevin Philadelphia

D10 fixes + PHP 8.2 fix

🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

We saw thousands of these after upgrading to D10, but they subsided after a while and are far less frequent now. (once a minute or so).

Guessing it's very old browser caches or bots. Would be nice if it wasn't in the logs though.

🇺🇸United States djdevin Philadelphia

Doing a similar thing on another project but could not find a core issue. Code is similar to that JS collection in DSF.

I noticed that it only broke when trying to include external libraries.

🇺🇸United States djdevin Philadelphia

Works, even fixes a few other modules from bugging out because they assume that {node} is always a Node and not a string.

🇺🇸United States djdevin Philadelphia

If your point value is <0 then it can't be correct. Instead of +8 to -4 you should do 0 to 12.

I think you should make all your questions "correct" and then assign different point values to them under "Score if correct". Then add feedback at the end of the quiz based on the grade range they get.

🇺🇸United States djdevin Philadelphia

Arbitrary conditions on toggles in general would be great, like blocks, so certain toggles could be enabled on a list of paths, certain node type, query string parameter, etc.

🇺🇸United States djdevin Philadelphia

"Number of random questions" is ignored when you use categorized random questions. So your configuration is correct!

🇺🇸United States djdevin Philadelphia

That's actually how it should work. Are you sure you are finishing the previous attempt? A new attempt should pull in new questions from the pool of questions tagged with those terms.

🇺🇸United States djdevin Philadelphia

This works but when using Bynder (or another media provider) the alt text is lost because $source_field isn't an image.

This is not the fault of the patch as it was missing before. But I changed the patch around so that it would find the first image field on the media.

Not sure if this is the best approach but it does fix the alt text. Responsive thumbnails still seem to work.

🇺🇸United States djdevin Philadelphia

Had the same issue with Bynder , probably functions the same way.

Patch fixes the issue.

🇺🇸United States djdevin Philadelphia

Looks good. Thanks!

🇺🇸United States djdevin Philadelphia

Yes I believe that's related to PHP 8.2. 8.0 should be more forgiving if you can roll back to that until Quiz is fully PHP 8.2/Drupal 10 compliant.

🇺🇸United States djdevin Philadelphia

Very likely this is 🐛 Nesting level too deep - recursive dependency on going to next question Fixed .

Try updating the module to the latest -dev release.

It's possible a PHP upgrade could have caused the issue.

🇺🇸United States djdevin Philadelphia

Quiz requires Views, many of the admin interfaces and reports are built with it.

Maybe you were on 4.x before? It's been a module requirement since 5.x.

There's no plans to make Quiz function without Views, it eliminated a mountain of custom D5-era code that was being used to create lists and bulk operations.

🇺🇸United States djdevin Philadelphia

Queued test for D10.

🇺🇸United States djdevin Philadelphia

I scheduled some D10 automated tests. If those pass we can commit the changes.

🇺🇸United States djdevin Philadelphia

Close to 100% of the time, that's an issue with the keys that you put in from Authorize.net. Check them and try again.

Make sure if you are copy/pasting them that there are no spaces or extra characters.

🇺🇸United States djdevin Philadelphia

Hey there,

Unfortunately I have no plans of porting it to Backdrop, my efforts are on D9+ projects. Hopefully someone will pick it up if there's enough interest.

🇺🇸United States djdevin Philadelphia

Fixed, thanks!

🇺🇸United States djdevin Philadelphia

djdevin created an issue.

🇺🇸United States djdevin Philadelphia

Yes, there's a default on the field configuration.

But this isn't reproducible in the UI. Only when creating new entities with PHP. I'm guessing some sort of web service call could also trigger this.

Production build 0.71.5 2024