Skip to main content

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).

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.

Attempting to re-run cron while it is already running

The error message "Attempting to re-run cron while it is already running" in Drupal typically indicates that another instance of the cron job is still running when the system tries to start a new one. Cron is a process that performs various tasks for Drupal, such as indexing content, checking for updates, and performing other scheduled tasks.

Lando set-up running Drupal and Python

Lando is a development environment tool that makes it easier to set up and manage local development environments for web applications. To use Python within a Lando-based development environment, you can follow these general steps:

 

Create a Lando Configuration File

Make sure you have a Lando configuration file (e.g., .lando.yml) in your project's root directory. If you don't have one, you can create it. Here's a basic example:

Using paragraph.getParentEntity() in Drupal Twig templates

In Drupal Twig templates, you can set a variable like paragraph_parent to the parent entity of a paragraph using the paragraph.getParentEntity() method. This is a common approach when you want to access the parent entity (e.g., a node) that contains the paragraph.  Here's how you can do it:

Warning SameSite cookie attribute

In the Drupal Status report, I'm seeing the following message

Not set
This attribute should be explicitly set to Lax, Strict or None. If set to None then the request must be made via HTTPS. See PHP documentation

 

Subscribe to Drupal