feat: add PHP ini management system and update infrastructure configs

- Add PHP ini management classes (Access, IniDirective, IniKey, PhpIni)
- Update deployment configurations (Wireguard, Traefik, Monitoring)
- Add DNS stack and Ansible role
- Add deployment debugging playbooks
- Update framework components (FilePath, RedisConnectionPool)
- Update .gitignore and documentation
This commit is contained in:
2025-11-02 15:29:41 +01:00
parent e628d30fa0
commit edcf509a4f
29 changed files with 926 additions and 39 deletions

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace App\Framework\Core\System\Ini;
enum Access: string
{
case USER = "USER";
case PERDIR = "Per Directory";
case SYSTEM = "System";
case ALL = "All";
public static function fromBitmask(int $bitmask): self
{
return match ($bitmask) {
INI_USER => self::USER,
INI_PERDIR => self::PERDIR,
INI_SYSTEM => self::SYSTEM,
INI_ALL => self::ALL,
default => throw new \InvalidArgumentException("Invalid bitmask value: {$bitmask}")
};
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Framework\Core\System\Ini;
final class IniDirective
{
public function __construct(
public string $name,
public string $value,
public string $global,
private int $accessMask,
) {}
public function getAccess(): int
{
$access = Access::fromBitmask($this->accessMask);
return $this->accessMask;
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Framework\Core\System\Ini;
enum IniKey: string
{
case ALLOW_URL_INCLUDE = "allow_url_include";
case ALLOW_URL_FOPEN = "allow_url_fopen";
case ALLOW_URL_FOPEN_UPLOAD = "allow_url_fopen_upload";
case ALLOW_URL_STREAM = "allow_url_stream";
case ALLOW_URL_STREAM_WRAPPER = "allow_url_stream_wrapper";
case ALLOW_URL_WRAPPER = "allow_url_wrapper";
case DEFAULT_SOCKET_TIMEOUT = "default_socket_timeout";
case DISABLE_FUNCTIONS = "disable_functions";
case DISABLE_CLASSES = "disable_classes";
case DISABLE_CLASSES_REFLECTION = "disable_classes_reflection";
case DISABLE_CONSTANTS = "disable_constants";
case DISABLE_ERRORS = "disable_errors";
case DISABLE_INCLUDE_PATH = "disable_include_path";
case DISABLE_PATH_INJECTION = "disable_path_injection";
case DISABLE_PHP = "disable_php";
case DISABLE_REFLECTION = "disable_reflection";
case ENABLE_DL = "enable_dl";
case ENABLE_POST_DATA_BEING_SENT = "enable_post_data_being_sent";
case ENABLE_SESSION = "enable_session";
case ERROR_REPORTING = "error_reporting";
case HTML_ERRORS = "html_errors";
case HTML_ERRORS_404 = "html_errors_404";
case HTML_ERRORS_404_LOG = "html_errors_404_log";
case HTML_ERRORS_404_SKIP = "html_errors_404_skip";
case HTML_ERRORS_404_TITLE = "html_errors_404_title";
case HTML_ERRORS_500 = "html_errors_500";
case HTML_ERRORS_500_LOG = "html_errors_500_log";
case HTML_ERRORS_500_SKIP = "html_errors_500_skip";
case HTML_ERRORS_500_TITLE = "html_errors_500_title";
case HTML_ERRORS_LOG = "html_errors_log";
case HTML_ERRORS_SKIP = "html_errors_skip";
case HTML_ERRORS_TITLE = "html_errors_title";
case HTML_ERRORS_TYPE = "html_errors_type";
case HTML_ERRORS_USE_INCLUDE_PATH = "html_errors_use_include_path";
case HTML_SAFE_EMAILS = "html_safe_emails";
case HTML_SAFE_URLS = "html_safe_urls";
case IGNORE_REPEATED_ERRORS = "ignore_repeated_errors";
case IGNORE_REPEATED_SOURCE = "ignore_repeated_source";
case IGNORE_USER_ABORT = "ignore_user_abort";
case LOG_ERRORS = "log_errors";
case LOG_ERRORS_MAX_LEN = "log_errors_max_len";
case LOG_ERRORS_MSG = "log_errors_msg";
case LOG_ERRORS_TO_STDOUT = "log_errors_to_stdout";
case LOG_ERRORS_USE_INCLUDE_PATH = "log_errors_use_include_path";
case MEMORY_LIMIT = "memory_limit";
case OPCACHE_ENABLE = "opcache.enable";
case OPCACHE_ENABLE_CLI = "opcache.enable_cli";
case OPCACHE_ENABLE_FILE_OVERRIDE = "opcache.enable_file_override";
case OPCACHE_ENABLE_FILE_OVERRIDE_IF_EXISTS = "opcache.enable_file_override_if_exists";
case OPCACHE_ENABLE_FILE_OVERRIDE_FROM_INDEX = "opcache.enable_file_override_from_index";
case OPCACHE_ENABLE_FILE_OVERRIDE_FROM_INDEX_IF_EXISTS = "opcache.enable_file_override_from_index_if_exists";
case OPCACHE_ENABLE_FILE_OVERRIDE_FROM_INDEX_IF_EXISTS_IF_EMPTY = "opcache.enable_file_override_from_index_if_exists_if_empty";
}

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace App\Framework\Core\System;
use Stringable;
final readonly class PhpIni implements Stringable
{
public string $path;
public function __construct(
) {
$path = php_ini_loaded_file();
if($path === false) {
$path = "";
}
$this->path = $path;
}
public function isLoaded(): bool
{
return $this->path !== "";
}
public function __toString(): string
{
return $this->path;
}
}

View File

@@ -453,7 +453,7 @@ final readonly class FilePath implements Stringable
// Check for suspicious patterns (basic path traversal)
if (str_contains($path, '..')) {
// Allow .. in normalized paths, but check final result doesn't escape intended boundaries
// Allow .. in normalized paths, but check that the final result doesn't escape intended boundaries
// This is a basic check - more sophisticated validation can be added
}
}

View File

@@ -23,6 +23,7 @@ final class RedisConnectionPool
*/
public function registerConnection(string $name, RedisConfig $config): void
{
var_dump("<pre>", $config);
$this->configs[$name] = $config;
}