mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
27 lines
630 B
PHP
27 lines
630 B
PHP
<?php
|
|
|
|
namespace AIO\Data;
|
|
|
|
use AIO\Auth\PasswordGenerator;
|
|
|
|
readonly class Setup {
|
|
public function __construct(
|
|
private PasswordGenerator $passwordGenerator,
|
|
private ConfigurationManager $configurationManager,
|
|
) {
|
|
}
|
|
|
|
public function Setup() : string {
|
|
if(!$this->CanBeInstalled()) {
|
|
return '';
|
|
}
|
|
|
|
$password = $this->passwordGenerator->GeneratePassword(8);
|
|
$this->configurationManager->SetPassword($password);
|
|
return $password;
|
|
}
|
|
|
|
public function CanBeInstalled() : bool {
|
|
return !file_exists(DataConst::GetConfigFile());
|
|
}
|
|
}
|