Skip to main content

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 check or compare files recorded in the files tables against actual file in the directory

Have you had the situation where you needed to compare the files recorded in the database (e.g., file_managed table) against the actual files in the file system directory (sites/default/files/...). This is useful for scenarios where you want to ensure that the database records and the physical files are in sync.  To do this perform the following steps:

Fatal error: Maximum execution time of 30 seconds exceeded in ...

When reloading a page, you may encounter the following error:

Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/content/core/lib/Drupal/Core/{some file .php} on line n

 

Solution

To resolve this issue, you need to adjust the max_execution_time parameter in the php.ini file.

Use the following command to locate your php.ini file:

To use Pinecone, OpenAI and a language model chain to answer questions in documents

Overview of the elements

Set Up API Keys

  • Obtain API keys for Pinecone and OpenAI.
  • Store the keys securely. Consider using a credentials.py file (as mentioned in a previous response).

 

Install Required Libraries

Install the necessary Python libraries, such as Pinecone's Python client (pinecone-client) and OpenAI's Python client (openai).

Lando - ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Lando is a local development environment tool, and it might not directly support the installation of system-wide packages like libGL. However, you can make sure that the required dependencies are included in your application's environment by modifying its configuration.

 

Here's a general approach to include libGL in your Lando configuration

 

Drupal and AWS - over 300 simultaneous database connections

The issue of over 300 simultaneous database connections in the context of AWS and Drupal can have several potential causes. Here are some common factors to consider:

Server Configuration

Check your server configuration to ensure it can handle the expected number of simultaneous connections. This includes parameters like max_connections in your database server configuration.

Subscribe to 10.x