Files
ignacionelson 6e47d76ba6 ProjectSend 2.0.0
Client file sharing, rebuilt from the ground up: a private area per
client, resumable uploads, folders, groups and categories, sharing with
expiry dates and download limits, comments, file versions, an activity
log, a REST API, and sixteen languages.

This repository begins here. ProjectSend 2 was developed privately, and
that development history is not published — the previous generation
remains available, with its own history, at projectsend/legacy.

Free software under the GNU General Public License v2, or (at your
option) any later version.
2026-08-14 01:38:12 -03:00

52 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Modules\Platform\System;
use App\Modules\Platform\Capabilities\CapabilityRegistry;
use Illuminate\Support\Facades\DB;
/**
* What this installation is running on — the handful of facts anyone
* answering "what have you got?" on a bug report needs.
*
* Shared by the dashboard's System widget and /system/about rather than
* computed twice, because the database version is the one row here that
* is not a constant: it needs a query that can fail on a connection
* that is up enough to serve the page but not to answer `version()`,
* and a second copy of that try/catch would eventually stop matching
* the first.
*/
final class SystemEnvironment
{
public function __construct(
private readonly CapabilityRegistry $capabilities,
) {}
/**
* @return array{version: string, edition: string, php: string, laravel: string, database: string}
*/
public function toArray(): array
{
return [
'version' => (string) config('projectsend.version'),
'edition' => $this->capabilities->edition()->value,
'php' => PHP_VERSION,
'laravel' => app()->version(),
'database' => $this->database(),
];
}
private function database(): string
{
try {
$version = (string) (DB::selectOne('select version() as v')->v ?? '');
} catch (\Throwable) {
$version = '';
}
return trim(DB::connection()->getDriverName().' '.$version);
}
}