TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractCustomPreset;
|
||||
use TYPO3\CMS\Install\Configuration\CustomPresetInterface;
|
||||
|
||||
/**
|
||||
* Custom preset is a fallback if no other preset fits
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class CustomPreset extends AbstractCustomPreset implements CustomPresetInterface
|
||||
{
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => '',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => '',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
protected $readonlyConfigurationValues = [
|
||||
'MAIL/transport_sendmail_command' => true,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractFeature;
|
||||
use TYPO3\CMS\Install\Configuration\FeatureInterface;
|
||||
|
||||
/**
|
||||
* Mail feature detects sendmail settings
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class MailFeature extends AbstractFeature implements FeatureInterface
|
||||
{
|
||||
/**
|
||||
* @var string Name of feature
|
||||
*/
|
||||
protected $name = 'Mail';
|
||||
|
||||
/**
|
||||
* @var array List of preset classes
|
||||
*/
|
||||
protected $presetRegistry = [
|
||||
SendmailPreset::class,
|
||||
SmtpPreset::class,
|
||||
CustomPreset::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* Sendmail path handling preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class SendmailPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Sendmail';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 50;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => 'sendmail',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => '',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get configuration values to activate prefix
|
||||
*
|
||||
* @return array Configuration values needed to activate prefix
|
||||
*/
|
||||
public function getConfigurationValues()
|
||||
{
|
||||
$configurationValues = $this->configurationValues;
|
||||
$configurationValues['MAIL/transport_sendmail_command'] = $this->getSendmailPath();
|
||||
if (($this->postValues['Mail']['enable'] ?? false) === 'Sendmail') {
|
||||
$configurationValues['MAIL/transport'] = 'sendmail';
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sendmail path if set
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return !empty($this->getSendmailPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Path where executable was found
|
||||
*
|
||||
* @return string|bool Sendmail path or FALSE if not set
|
||||
*/
|
||||
public function getSendmailPath()
|
||||
{
|
||||
return ini_get('sendmail_path');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is preset is currently active on the system
|
||||
*
|
||||
* @return bool TRUE if preset is active
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
$this->configurationValues['MAIL/transport_sendmail_command'] = $this->getSendmailPath();
|
||||
return parent::isActive();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Install\Configuration\Mail;
|
||||
|
||||
use TYPO3\CMS\Install\Configuration\AbstractPreset;
|
||||
|
||||
/**
|
||||
* SMTP settings handling preset
|
||||
* @internal only to be used within EXT:install
|
||||
*/
|
||||
class SmtpPreset extends AbstractPreset
|
||||
{
|
||||
/**
|
||||
* @var string Name of preset
|
||||
*/
|
||||
protected $name = 'Smtp';
|
||||
|
||||
/**
|
||||
* @var int Priority of preset
|
||||
*/
|
||||
protected $priority = 40;
|
||||
|
||||
/**
|
||||
* @var array Configuration values handled by this preset
|
||||
*/
|
||||
protected $configurationValues = [
|
||||
'MAIL/transport' => 'smtp',
|
||||
'MAIL/transport_sendmail_command' => '',
|
||||
'MAIL/transport_smtp_server' => 'localhost:25',
|
||||
'MAIL/transport_smtp_encrypt' => '',
|
||||
'MAIL/transport_smtp_username' => '',
|
||||
'MAIL/transport_smtp_password' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get configuration values to activate prefix
|
||||
*
|
||||
* @return array Configuration values needed to activate prefix
|
||||
*/
|
||||
public function getConfigurationValues()
|
||||
{
|
||||
$configurationValues = $this->configurationValues;
|
||||
$keys = array_keys($configurationValues);
|
||||
foreach ($keys as $key) {
|
||||
if (!empty($this->postValues['Smtp'][$key])) {
|
||||
$configurationValues[$key] = $this->postValues['Smtp'][$key];
|
||||
}
|
||||
}
|
||||
if (($this->postValues['Mail']['enable'] ?? '') === 'Smtp') {
|
||||
$configurationValues['MAIL/transport'] = 'smtp';
|
||||
}
|
||||
return $configurationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sendmail path if set
|
||||
*
|
||||
* @return bool TRUE if sendmail path if set
|
||||
*/
|
||||
public function isAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user