[TASK] Remove systemLogLevel example in Router.ts
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Configuration / Mail / SmtpPreset.php
1 <?php
2
3 /*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16 namespace TYPO3\CMS\Install\Configuration\Mail;
17
18 use TYPO3\CMS\Install\Configuration;
19 use TYPO3\CMS\Install\Configuration\AbstractPreset;
20
21 /**
22 * SMTP settings handling preset
23 * @internal only to be used within EXT:install
24 */
25 class SmtpPreset extends AbstractPreset
26 {
27 /**
28 * @var string Name of preset
29 */
30 protected $name = 'Smtp';
31
32 /**
33 * @var int Priority of preset
34 */
35 protected $priority = 40;
36
37 /**
38 * @var array Configuration values handled by this preset
39 */
40 protected $configurationValues = [
41 'MAIL/transport' => 'smtp',
42 'MAIL/transport_sendmail_command' => '',
43 'MAIL/transport_smtp_server' => 'localhost:25',
44 'MAIL/transport_smtp_encrypt' => '',
45 'MAIL/transport_smtp_username' => '',
46 'MAIL/transport_smtp_password' => '',
47 ];
48
49 /**
50 * Get configuration values to activate prefix
51 *
52 * @return array Configuration values needed to activate prefix
53 */
54 public function getConfigurationValues()
55 {
56 $configurationValues = $this->configurationValues;
57 $keys = array_keys($configurationValues);
58 foreach ($keys as $key) {
59 if (!empty($this->postValues['Smtp'][$key])) {
60 $configurationValues[$key] = $this->postValues['Smtp'][$key];
61 }
62 }
63 if ($this->postValues['Mail']['enable'] === 'Smtp') {
64 $configurationValues['MAIL/transport'] = 'smtp';
65 }
66 return $configurationValues;
67 }
68
69 /**
70 * Check if sendmail path if set
71 *
72 * @return bool TRUE if sendmail path if set
73 */
74 public function isAvailable()
75 {
76 return true;
77 }
78 }