Files
nextcloud/php/src/Data/Setup.php
Jean-Yves f7dfdf346a Wip
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
2024-09-26 01:01:59 +02:00

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());
}
}