fix(settings): treat limangold deploy default as refillable from superadmin
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -194,7 +194,6 @@ class SettingsRestoreFromBackupCommand extends Command
|
||||
|
||||
/**
|
||||
* برای پر کردن خالی/غایب: با --fill-from-superadmin اول SA، بعد بکاپ.
|
||||
* پیشفرضهای deploy در بکاپ (مثل limangold.ir) اگر SA مقدار واقعی دارد، نادیده گرفته میشوند.
|
||||
*
|
||||
* @return array{0: ?string, 1: string}
|
||||
*/
|
||||
@@ -202,20 +201,11 @@ class SettingsRestoreFromBackupCommand extends Command
|
||||
{
|
||||
$backupValue = $backupValue === null ? null : trim($backupValue);
|
||||
$superAdminValue = $superAdminValue === null ? null : trim($superAdminValue);
|
||||
$backupIsDefault = $backupValue !== null && $backupValue !== ''
|
||||
&& in_array(rtrim(strtolower($backupValue), '/'), array_map(
|
||||
static fn ($v) => rtrim(strtolower($v), '/'),
|
||||
self::DEPLOY_DEFAULT_VALUES
|
||||
), true);
|
||||
|
||||
if ($preferSuperAdmin && $superAdminValue !== null && $superAdminValue !== '') {
|
||||
return [$superAdminValue, 'superadmin'];
|
||||
}
|
||||
|
||||
if ($backupValue !== null && $backupValue !== '' && ! ($backupIsDefault && $preferSuperAdmin)) {
|
||||
return [$backupValue, 'backup'];
|
||||
}
|
||||
|
||||
if ($backupValue !== null && $backupValue !== '') {
|
||||
return [$backupValue, 'backup'];
|
||||
}
|
||||
@@ -223,6 +213,22 @@ class SettingsRestoreFromBackupCommand extends Command
|
||||
return [null, ''];
|
||||
}
|
||||
|
||||
private function isDeployDefault(string $value): bool
|
||||
{
|
||||
$normalized = rtrim(strtolower(trim($value)), '/');
|
||||
if ($normalized === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (self::DEPLOY_DEFAULT_VALUES as $default) {
|
||||
if ($normalized === rtrim(strtolower($default), '/')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ردیفهای can_edit=0 بکاپ، بدون کلیدهای سوپرادمین و runtime.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user