mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-28 06:20:14 +00:00
27 lines
602 B
PHP
27 lines
602 B
PHP
<?php
|
|
|
|
namespace AIO\Data;
|
|
|
|
use AIO\Auth\PasswordGenerator;
|
|
use Random\RandomException;
|
|
|
|
readonly class Setup {
|
|
/**
|
|
* @throws InvalidSettingConfigurationException
|
|
* @throws RandomException
|
|
*/
|
|
static function Setup(): string {
|
|
if (!self::CanBeInstalled()) {
|
|
return '';
|
|
}
|
|
|
|
$password = PasswordGenerator::GeneratePassword(8);
|
|
ConfigurationManager::storeConfigFile(ConfigFile::blank($password));
|
|
return $password;
|
|
}
|
|
|
|
static function CanBeInstalled(): bool {
|
|
return !file_exists(DataConst::GetConfigFile());
|
|
}
|
|
}
|