Add import/export and update system
Implement CSV/JSON import and export for domains, notification groups and tags (with masking for sensitive channel data), including size/format validation, in-memory CSV building, and logging. Add tag transfer and bulk transfer actions (admin-only). Introduce a new update system: Add UpdateController and UpdateService, migration 025_add_update_system_v1.1.3.sql, and installer changes to include the new migration and version handling; provide endpoints to check, apply, rollback and configure updates. Update helpers and UI bits: add getUpdateBadgeInfo in LayoutHelper, update notification icons/redirects, and add getMaxUploadSize in ViewHelper. Misc: add NotificationGroup::findByName, tweak .gitignore backups path, and update related views and routes.
This commit is contained in:
@@ -138,6 +138,37 @@ class ViewHelper
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PHP max upload size from ini settings.
|
||||
* Returns the lower of upload_max_filesize and post_max_size as a human-readable string.
|
||||
*
|
||||
* @return string Human-readable size (e.g. "128 MB")
|
||||
*/
|
||||
public static function getMaxUploadSize(): string
|
||||
{
|
||||
$phpUploadMax = self::parseIniSize(ini_get('upload_max_filesize') ?: '2M');
|
||||
$phpPostMax = self::parseIniSize(ini_get('post_max_size') ?: '8M');
|
||||
$phpLimit = min($phpUploadMax, $phpPostMax);
|
||||
|
||||
return self::formatBytes($phpLimit, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a PHP ini size value (e.g. "2M", "128K", "1G") into bytes.
|
||||
*/
|
||||
private static function parseIniSize(string $size): int
|
||||
{
|
||||
$value = (int) $size;
|
||||
$unit = strtolower(substr(trim($size), -1));
|
||||
|
||||
return match ($unit) {
|
||||
'g' => $value * 1073741824,
|
||||
'm' => $value * 1048576,
|
||||
'k' => $value * 1024,
|
||||
default => $value,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate alert message HTML
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user