feat : FOLIO_REPO_URL et branche configurables depuis l'admin (dashboard)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -68,6 +68,24 @@ function apacheAccessLog(): string
|
||||
return (string)($_ENV['APACHE_ACCESS_LOG'] ?? getenv('APACHE_ACCESS_LOG') ?: '*-access.log');
|
||||
}
|
||||
|
||||
function folioRepoUrl(): string
|
||||
{
|
||||
$fromSettings = siteSettings()['folio_repo_url'] ?? '';
|
||||
if ($fromSettings !== '') {
|
||||
return rtrim($fromSettings, '/');
|
||||
}
|
||||
return rtrim((string)($_ENV['FOLIO_REPO_URL'] ?? getenv('FOLIO_REPO_URL') ?: ''), '/');
|
||||
}
|
||||
|
||||
function folioUpdateBranch(): string
|
||||
{
|
||||
$fromSettings = siteSettings()['folio_update_branch'] ?? '';
|
||||
if ($fromSettings !== '') {
|
||||
return $fromSettings;
|
||||
}
|
||||
return (string)($_ENV['FOLIO_UPDATE_BRANCH'] ?? getenv('FOLIO_UPDATE_BRANCH') ?: 'main');
|
||||
}
|
||||
|
||||
/** @return list<array{label:string,patterns:list<string>}> */
|
||||
function asGroups(): array
|
||||
{
|
||||
@@ -78,7 +96,7 @@ function asGroups(): array
|
||||
function saveSiteSettings(array $data): bool
|
||||
{
|
||||
$current = siteSettings();
|
||||
$stringKeys = ['site_title', 'site_claim', 'site_lang', 'site_license_label', 'site_license_url', 'apache_access_log'];
|
||||
$stringKeys = ['site_title', 'site_claim', 'site_lang', 'site_license_label', 'site_license_url', 'apache_access_log', 'folio_repo_url', 'folio_update_branch'];
|
||||
foreach ($stringKeys as $key) {
|
||||
if (array_key_exists($key, $data)) {
|
||||
$val = trim((string)$data[$key]);
|
||||
|
||||
@@ -67,7 +67,7 @@ class UpdateChecker
|
||||
*/
|
||||
private function checkRemoteVersion(): ?string
|
||||
{
|
||||
$repoUrl = rtrim((string) ($_ENV['FOLIO_REPO_URL'] ?? getenv('FOLIO_REPO_URL') ?: ''), '/');
|
||||
$repoUrl = folioRepoUrl();
|
||||
if ($repoUrl === '') {
|
||||
return null;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class UpdateChecker
|
||||
|
||||
public function getBranch(): string
|
||||
{
|
||||
return (string) ($_ENV['FOLIO_UPDATE_BRANCH'] ?? getenv('FOLIO_UPDATE_BRANCH') ?: 'main');
|
||||
return folioUpdateBranch();
|
||||
}
|
||||
|
||||
public function getLastChecked(): ?int
|
||||
|
||||
Reference in New Issue
Block a user