Skip to main content

How to log mail sent from the site for debugging when the body of the message is encrypted

To view the email before it's sent from Drupal, especially when using Drupal 10 and dealing with encrypted emails or a specific module like Mailhandler, you can take a few steps to intercept or debug the email before it's actually dispatched. The process involves either configuring your configuration for debugging emails or using a development tool/module that captures outgoing emails.

 

Using Drush to run SQL commands

To run a SQL command using Drush, use the following sql-query command

drush sql-query "COMMAND"

As an example, in the following I will remove all of the records in the Watchdog.

 

Delete from watchdog

To empty (clear) the watchdog table, which contains Drupal's log messages, using the above noted command. The command to delete all entries from the watchdog table is as follows:

Drupal logger and serialising objects such as MessageInterface

In Drupal, the logging system is based on the PSR-3 logging standard, which Drupal integrates through the \Psr\Log\LoggerInterface. When you want to log messages, you typically use placeholders in your message string, which are replaced with context array values.

Notice: Only variables should be passed by reference in load_view_block_content()

Working through the following error

Notice: Only variables should be passed by reference in load_view_block_content() (line 391 of /var/www/vhosts/{domain}/httpdocs/themes/custom/{theme}/{theme}.theme.theme)

If you want to read the full error, scroll to the bottom in Appendix.  The related function to this error is

Could not apply patch! Skipping

Attempting to apply a patch in Drupal 10.2.4 that had been working until this version.  Now I'm seeing the following error

Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d '/Users/andrewfletcher/Sites/codebales/modules/contrib/facets' < '/Users/andrewfletcher/Sites/codebales/patches/3336646-function-is-deprecated.patch'" exceeded the timeout of 300 seconds.

 

How to determine the size of a directory in Terminal

To determine the size of a directory using the terminal, you can use the du (disk usage) command. The syntax for this command can vary slightly depending on the operating system you are using, but a common way to use it is as follows:

 

Terminal command to find and replace

In many terminal text editors, you use find command as reference in Terminal commands - find.  How about find and replace.  This action depends on the specific text editor you're using in the terminal.  Here are a few common terminal text editors and how you can find and replace strings within them:

Vim

To find: Press / followed by the search term and then Enter.

Resolving CVE-2022-48624 less issue

To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE, potentially allowing shell command injection.

The current less version is 551, which is vulnerable. You'll need to upgrade "less" to a version at or beyond 606.

Python - OSError: [Errno 24] Too many open files

The "Too many open files" error in Python typically occurs when your program has opened more file descriptors than the operating system allows. This error is often seen in situations where files are not being properly closed after use, leading to the exhaustion of available file descriptors.

 

Subscribe to