Class filename should also work if it's stored outside of Drupal root

Created on 27 June 2016, over 8 years ago
Updated 23 February 2023, almost 2 years ago

The function mailsystem_create_class() is working OK unless the files directory of a site is physically stored outside of the Drupal root. This is the case e.g. if you have Drupal installed in /var/www and the /var/www/sites/default/files is a symbolic link to e.g. /mnt/files

Some hosting strategies are locating the writable directories outside of the Drupal root for security reasons and/or for better permission management and/or for an easier backup strategy.

In this case we end up with the new class in the registry table as '/mnt/files/mailsystem//MimeMailSystem__SmtpMailSystem.mail.inc' or what ever the class name happens to be. But such a class won't be found by Drupal's autoloader as it expects all the classes to be defined relative to the Drupal root.

This module currently tries to achieve this by stripping the Drupal root from the class file name but that fails when that name is outside of the Drupal root.

A pretty simple patch is resolving that issue and of course produces the same result for all the default cases where the files directory is inside of the Drupal root.

I'll submit that patch in a second.

Feature request
Status

RTBC

Version

2.0

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024