Skip to content

Commit

Permalink
Add warning to setup checks if the default mailer is still php
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Jul 4, 2018
1 parent 0cf0bcb commit 6a0c54d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,18 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
})
}
if (data.isPhpMailerUsed) {
messages.push({
msg: t(
'core',
'Use of the the built in php mailer is no longer supported. <a target="_blank" rel="noreferrer noopener" href="{docLink}">Please update your email server settings ↗<a/>.',
{
docLink: data.mailSettingsDocumentation,
}
),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
} else {
messages.push({
msg: t('core', 'Error occurred while checking server setup'),
Expand Down
6 changes: 6 additions & 0 deletions settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ protected function getCronErrors() {
return [];
}

protected function isPhpMailerUsed(): bool {
return $this->config->getSystemValue('mail_smtpmode', 'php') === 'php';
}

/**
* @return DataResponse
*/
Expand Down Expand Up @@ -557,6 +561,8 @@ public function check() {
'missingIndexes' => $this->hasMissingIndexes(),
'isSqliteUsed' => $this->isSqliteUsed(),
'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
'isPhpMailerUsed' => $this->isPhpMailerUsed(),
'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin')
]
);
}
Expand Down
27 changes: 26 additions & 1 deletion tests/Settings/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,22 @@ public function setUp() {
$this->lockingProvider,
$this->dateTimeFormatter,
])
->setMethods(['isReadOnlyConfig', 'hasValidTransactionIsolationLevel', 'hasFileinfoInstalled', 'hasWorkingFileLocking', 'getLastCronInfo', 'getSuggestedOverwriteCliURL', 'getOutdatedCaches', 'getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock();
->setMethods([
'isReadOnlyConfig',
'hasValidTransactionIsolationLevel',
'hasFileinfoInstalled',
'hasWorkingFileLocking',
'getLastCronInfo',
'getSuggestedOverwriteCliURL',
'getOutdatedCaches',
'getCurlVersion',
'isPhpOutdated',
'isOpcacheProperlySetup',
'hasFreeTypeSupport',
'hasMissingIndexes',
'isSqliteUsed',
'isPhpMailerUsed',
])->getMock();
}

public function testIsInternetConnectionWorkingDisabledViaConfig() {
Expand Down Expand Up @@ -352,6 +367,10 @@ public function testCheck() {
->method('linkToDocs')
->with('admin-db-conversion')
->willReturn('http://docs.example.org/server/go.php?to=admin-db-conversion');
$this->urlGenerator->expects($this->at(6))
->method('getAbsoluteURL')
->with('index.php/settings/admin')
->willReturn('https://server/index.php/settings/admin');
$this->checkSetupController
->method('hasFreeTypeSupport')
->willReturn(false);
Expand Down Expand Up @@ -392,6 +411,10 @@ public function testCheck() {
'relativeTime' => '2 hours ago',
'backgroundJobsUrl' => 'https://example.org',
]);
$this->checkSetupController
->expects($this->once())
->method('isPhpMailerUsed')
->willReturn(false);
$this->checker
->expects($this->once())
->method('hasPassedCheck')
Expand Down Expand Up @@ -434,6 +457,8 @@ public function testCheck() {
'isSqliteUsed' => false,
'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion',
'missingIndexes' => [],
'isPhpMailerUsed' => false,
'mailSettingsDocumentation' => 'https://server/index.php/settings/admin',
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
Expand Down

0 comments on commit 6a0c54d

Please sign in to comment.