Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117878758
D5343.1775341838.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D5343.1775341838.diff
View Options
diff --git a/src/app/Backends/DAV.php b/src/app/Backends/DAV.php
--- a/src/app/Backends/DAV.php
+++ b/src/app/Backends/DAV.php
@@ -182,11 +182,10 @@
*
* @return bool True on success, False otherwise
*/
- public static function healthcheck(): bool
+ public static function healthcheck($username, $password): bool
{
- $dav = new self();
- $dav->setUrl(\config('services.dav.uri'));
- return $dav->options() != false;
+ $homes = self::getInstance($username, $password)->discover();
+ return !empty($homes);
}
/**
diff --git a/src/app/Console/Commands/Status/Health.php b/src/app/Console/Commands/Status/Health.php
--- a/src/app/Console/Commands/Status/Health.php
+++ b/src/app/Console/Commands/Status/Health.php
@@ -73,7 +73,7 @@
private function checkDAV()
{
try {
- return DAV::healthcheck();
+ return DAV::healthcheck($this->option('user'), $this->option('password'));
} catch (\Exception $exception) {
$this->line($exception);
return false;
@@ -196,10 +196,11 @@
$steps = $this->option('check');
if (empty($steps)) {
$steps = [
- 'DB', 'Redis', 'Roundcube', 'Meet', 'DAV', 'Mollie', 'OpenExchangeRates',
+ 'DB', 'Redis', 'Roundcube', 'Meet',
];
if (!empty($this->option('user'))) {
array_unshift($steps, 'Auth');
+ array_unshift($steps, 'DAV');
array_unshift($steps, 'SMTP');
}
if (\config('app.with_ldap')) {
@@ -211,6 +212,12 @@
if (\config('app.with_files')) {
array_unshift($steps, 'Storage');
}
+ if (\config('services.mollie.key')) {
+ array_unshift($steps, 'Mollie');
+ }
+ if (\config('services.openexchangerates.api_key')) {
+ array_unshift($steps, 'OpenExchangeRates');
+ }
}
foreach ($steps as $step) {
diff --git a/src/tests/Feature/Console/Status/HealthTest.php b/src/tests/Feature/Console/Status/HealthTest.php
--- a/src/tests/Feature/Console/Status/HealthTest.php
+++ b/src/tests/Feature/Console/Status/HealthTest.php
@@ -8,29 +8,30 @@
use App\Support\Facades\Roundcube;
use App\Support\Facades\Storage;
use Tests\TestCase;
+use App\Utils;
class HealthTest extends TestCase
{
/**
* Test the command
- *
- * @group meet
- * @group mollie
*/
public function testHandle(): void
{
\config(['app.with_ldap' => true]);
\config(['app.with_imap' => true]);
+ $userPassword = Utils::generatePassphrase();
+ $user = $this->getTestUser('user@health-test.com', ['password' => $userPassword]);
+
DAV::shouldReceive('healthcheck')->once()->andReturn(true);
IMAP::shouldReceive('healthcheck')->once()->andReturn(true);
LDAP::shouldReceive('healthcheck')->once()->andReturn(true);
Roundcube::shouldReceive('healthcheck')->once()->andReturn(true);
Storage::shouldReceive('healthcheck')->once()->andReturn(true);
- $code = \Artisan::call("status:health");
+ $code = \Artisan::call("status:health --check DB --check Redis --check Roundcube --check DAV --check IMAP --check LDAP --check Storage --user {$user->email} --password $userPassword");
$output = trim(\Artisan::output());
-
+ $this->assertStringNotContainsString("Error", $output);
$this->assertSame(0, $code);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 10:30 PM (11 h, 35 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18831435
Default Alt Text
D5343.1775341838.diff (3 KB)
Attached To
Mode
D5343: Turn the DAV healthcheck into something that actually detects a dav server
Attached
Detach File
Event Timeline