mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-08 06:48:00 +00:00
Initial import
This commit is contained in:
commit
2295a33590
884 changed files with 93939 additions and 0 deletions
32
php/src/Data/Setup.php
Normal file
32
php/src/Data/Setup.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace AIO\Data;
|
||||
|
||||
use AIO\Auth\PasswordGenerator;
|
||||
|
||||
class Setup
|
||||
{
|
||||
private PasswordGenerator $passwordGenerator;
|
||||
private ConfigurationManager $configurationManager;
|
||||
|
||||
public function __construct(
|
||||
PasswordGenerator $passwordGenerator,
|
||||
ConfigurationManager $configurationManager) {
|
||||
$this->passwordGenerator = $passwordGenerator;
|
||||
$this->configurationManager = $configurationManager;
|
||||
}
|
||||
|
||||
public function Setup() : string {
|
||||
if(!$this->CanBeInstalled()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$password = $this->passwordGenerator->GeneratePassword(6);
|
||||
$this->configurationManager->SetPassword($password);
|
||||
return $password;
|
||||
}
|
||||
|
||||
public function CanBeInstalled() : bool {
|
||||
return !file_exists(DataConst::GetConfigFile());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue