Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

namespace VuFind\Config\Feature;

use VuFind\Config\Config;

/**
* Trait providing email settings.
*
Expand All @@ -47,16 +45,13 @@ trait EmailSettingsTrait
/**
* Get sender email address.
*
* @param array|Config $config VuFind configuration
* @param array $config VuFind configuration
* @param ?string $userEmail User's own email address that is used if permitted by settings
*
* @return string
*/
protected function getEmailSenderAddress(array|Config $config, ?string $userEmail = null): string
protected function getEmailSenderAddress(array $config, ?string $userEmail = null): string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are calls to this method in \VuFind\Log\LoggerFactory::addMailHandler and \VuFindConsole\Command\ScheduledSearch\NotifyCommand that still pass a Config object. We'll need to update them before we can change the signature of this method.

{
if ($config instanceof Config) {
$config = $config->toArray();
}
if ($userEmail && ($config['Mail']['user_email_in_from'] ?? false)) {
return $userEmail;
}
Expand Down
9 changes: 2 additions & 7 deletions module/VuFind/src/VuFind/Config/Feature/SecretTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

namespace VuFind\Config\Feature;

use VuFind\Config\Config;

/**
* Trait to import secret from file rather than a hardcoded config.
*
Expand All @@ -47,19 +45,16 @@ trait SecretTrait
* Will look for a _file-suffixed version of the key first,
* and load the data from a separate file if configured to do so.
*
* @param Config|array|null $config The config to read from
* @param array|null $config The config to read from
* @param string $key The key to retrieve
*
* @return string|null
*/
protected function getSecretFromConfig(Config|array|null $config, string $key): ?string
protected function getSecretFromConfig(array|null $config, string $key): ?string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still being called with an object in \VuFind\Search\Factory\BrowZineBackendFactory and \VuFindSearch\Backend\EDS\Backend. Those calls will need to be updated to pass the right format -- this is the reason tests are failing.

{
if ($config === null) {
return null;
}
if ($config instanceof Config) {
$config = $config->toArray();
}
if ($secretFile = $config[$key . '_file'] ?? null) {
if (is_readable($secretFile)) {
$value = file_get_contents($secretFile);
Expand Down
Loading