Drupal Case Studies & Practical Application 5 — Questions and Answers
Question 1: A Drupal site with 500,000 nodes experiences slow cache invalidation after content saves. Which caching strategy change reduces this bottleneck?
- Disable Dynamic Page Cache to avoid tag tracking overhead
- Use cache tags with granular entity-level tags and a reverse proxy like Varnish that supports cache tag invalidation (Correct answer)
- Store all cached pages in the database instead of memory
- Increase Drupal's cache lifetime to 24 hours to reduce invalidation frequency
Correct answer: Use cache tags with granular entity-level tags and a reverse proxy like Varnish that supports cache tag invalidation
Drupal's cache tag system paired with a reverse proxy (Varnish + xkey/purge module) enables surgical per-entity cache invalidation without purging unrelated pages.
Question 2: A university's Drupal site was hacked and backdoor PHP files were found in the public files directory. What hardening measure directly prevents this attack vector?
- Restrict PHP execution in the public files directory via server configuration (e.g., deny .php in Nginx) (Correct answer)
- Set the files directory to read-only using file system permissions
- Enable Drupal's File Security module to scan uploads
- Move the files directory inside the Drupal docroot
Correct answer: Restrict PHP execution in the public files directory via server configuration (e.g., deny .php in Nginx)
Configuring the web server to deny execution of PHP (and other scripts) inside the public files directory prevents uploaded malicious files from being executed.
Question 3: A marketing team wants to A/B test two versions of a landing page hero image in Drupal without developer involvement. Which contrib module enables this?
- Layout Builder Restrictions module
- Acquia Optimize (formerly Acquia Lift) or the AB Test module for per-node variant testing (Correct answer)
- Pathauto with dual aliases
- Block Visibility Groups with user cookie conditions
Correct answer: Acquia Optimize (formerly Acquia Lift) or the AB Test module for per-node variant testing
The AB Test module (or enterprise tools like Acquia Optimize) allows defining content variants and split traffic between them, manageable by editors.
Question 4: A Drupal site must send transactional emails reliably without relying on the server's local sendmail. What is the recommended Drupal solution?
- Configure PHP's mail() function to use a local queue
- Use the SMTP Authentication Support module to route mail through an external SMTP provider (Correct answer)
- Install Postfix on the server and point Drupal's mail system to it
- Use the Mailchimp module for all transactional email
Correct answer: Use the SMTP Authentication Support module to route mail through an external SMTP provider
The SMTP Authentication Support module lets Drupal send mail via an authenticated external SMTP service (SendGrid, Mailgun, etc.) for reliable delivery.
Question 5: During a Drupal upgrade from 9 to 10, a custom module fails because it calls a deprecated function removed in Drupal 10. What tool helps identify all such deprecations before upgrading?
- Drupal Check (drupal-check) static analysis tool (Correct answer)
- Drush's `drush php-eval` to test functions interactively
- The Update Manager module's deprecation report
- Running PHPUnit tests against the Drupal 10 codebase
Correct answer: Drupal Check (drupal-check) static analysis tool
Drupal Check scans custom and contrib code for deprecated API calls and produces a report of what must be updated before the upgrade.
Question 6: A news site's editorial workflow requires that all articles be reviewed by a legal team before publication. How is this modeled in Drupal's Content Moderation module?
- Create a custom workflow with states: Draft → Legal Review → Published, and assign the 'Legal Review' state transition permission only to the legal role (Correct answer)
- Use Drupal's built-in two-step review workflow without modification
- Set the node 'Promoted to front page' checkbox as a proxy for legal approval
- Install the Workbench Moderation module which includes a legal review state by default
Correct answer: Create a custom workflow with states: Draft → Legal Review → Published, and assign the 'Legal Review' state transition permission only to the legal role
Content Moderation's workflow configuration lets you define custom states and restrict which roles can perform each transition, enabling a legal review gate.
Question 7: A Drupal site using Paragraphs for page building has become slow to edit because nodes contain 50+ paragraph items. What is the recommended performance improvement?
- Switch all paragraphs to use 'Closed' default widget mode so only expanded paragraphs load their form elements (Correct answer)
- Replace Paragraphs with a flat custom field group
- Increase PHP max_execution_time to 300 seconds
- Disable JavaScript validation on the node edit form
Correct answer: Switch all paragraphs to use 'Closed' default widget mode so only expanded paragraphs load their form elements
Setting paragraphs to load in 'Closed' mode by default means only the paragraph summary renders until the editor opens it, dramatically reducing edit-form load time.
A Drupal site with 500,000 nodes experiences slow cache invalidation after content saves.
Which caching strategy change reduces this bottleneck?