This repository has been archived by the owner on Nov 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use public method that can be mocked
- Loading branch information
1 parent
fd48f7b
commit efd6f90
Showing
3 changed files
with
35 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/** | ||
* @author Christoph Wurst <[email protected]> | ||
* | ||
|
@@ -17,22 +18,32 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\Mail\Service\AutoConfig; | ||
|
||
use Exception; | ||
use OCA\Mail\Service\Logger; | ||
|
||
class IspDb { | ||
|
||
/** @var Logger */ | ||
private $logger; | ||
|
||
/** @var string[] */ | ||
public function getUrls() { | ||
return [ | ||
'https://autoconfig.{DOMAIN}/mail/config-v1.1.xml', | ||
'https://{DOMAIN}/.well-known/autoconfig/mail/config-v1.1.xml', | ||
'https://autoconfig.thunderbird.net/v1.1/{DOMAIN}', | ||
]; | ||
} | ||
|
||
/** | ||
* @param Logger $logger | ||
* @param string[] $ispUrls | ||
*/ | ||
public function __construct(Logger $logger, $ispUrls) { | ||
public function __construct(Logger $logger) { | ||
$this->logger = $logger; | ||
$this->urls = $ispUrls; | ||
} | ||
|
||
private function queryUrl($url) { | ||
|
@@ -85,7 +96,7 @@ public function query($domain, $tryMx = true) { | |
} | ||
|
||
$provider = []; | ||
foreach ($this->urls as $url) { | ||
foreach ($this->getUrls() as $url) { | ||
$url = str_replace("{DOMAIN}", $domain, $url); | ||
$this->logger->debug("IsbDb: querying <$domain> via <$url>"); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters