Update: ersetzten Plugin-Ordner ignorieren; Uploads trotz open_basedir
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m17s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m35s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m43s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 5m14s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 5m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 5m11s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m40s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m17s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m35s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m43s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 5m14s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 5m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 5m11s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m40s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
30d2e42ee3
commit
6bede3e2ee
103 changed files with 477 additions and 397 deletions
|
|
@ -72,9 +72,14 @@ class ProfileController extends Controller
|
|||
// zu wenig Speicher) – verständliche Meldung statt „500 Interner Fehler“.
|
||||
report($e);
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'avatar' => 'Das Bild konnte nicht gespeichert werden. Bitte ein anderes Foto versuchen oder die Administration informieren (Details unter „Systemzustand“ und im Fehlerprotokoll).',
|
||||
]);
|
||||
$message = 'Das Bild konnte nicht gespeichert werden. Bitte ein anderes Foto versuchen oder die Administration informieren (Details unter „Systemzustand“ und im Fehlerprotokoll).';
|
||||
|
||||
// Administration sieht den technischen Grund direkt
|
||||
if ($request->user()->can('updates.manage')) {
|
||||
$message .= ' Technischer Grund: '.class_basename($e).': '.$e->getMessage();
|
||||
}
|
||||
|
||||
throw ValidationException::withMessages(['avatar' => $message]);
|
||||
}
|
||||
|
||||
return back()->with('status', 'avatar-updated');
|
||||
|
|
|
|||
|
|
@ -77,6 +77,16 @@ class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
// Der Updater löscht nie (docs/specs/self-updater.md): Der Ordner eines
|
||||
// umbenannten mitgelieferten Plugins bleibt liegen und wird hier ignoriert.
|
||||
foreach ($this->manifests as $manifest) {
|
||||
foreach ($manifest->core ? $manifest->replaces : [] as $old) {
|
||||
if (($this->manifests[$old] ?? null)?->core) {
|
||||
unset($this->manifests[$old]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($this->manifests);
|
||||
|
||||
return $this->manifests;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ final class PluginManifest
|
|||
public readonly array $requires,
|
||||
public readonly ?string $updateUrl,
|
||||
public readonly bool $enabledByDefault = true,
|
||||
/** Frühere Kürzel, die dieses Plugin ersetzt (deren Ordner bleiben nach Updates liegen). */
|
||||
public readonly array $replaces = [],
|
||||
) {}
|
||||
|
||||
public static function fromDirectory(string $path, bool $core): self
|
||||
|
|
@ -92,6 +94,7 @@ final class PluginManifest
|
|||
requires: is_array($data['requires'] ?? null) ? $data['requires'] : [],
|
||||
updateUrl: is_string($data['update_url'] ?? null) ? $data['update_url'] : null,
|
||||
enabledByDefault: (bool) ($data['enabled_by_default'] ?? true),
|
||||
replaces: array_values(array_filter((array) ($data['replaces'] ?? []), 'is_string')),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Avatars
|
|||
|
||||
public function store(User $user, UploadedFile $file): void
|
||||
{
|
||||
$this->storeFromPath($user, $file->getRealPath());
|
||||
Images::withLocalCopy($file, fn (string $path) => $this->storeFromPath($user, $path));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -54,6 +54,35 @@ class Images
|
|||
*
|
||||
* @return string Pfad im Speicher „uploads“
|
||||
*/
|
||||
/**
|
||||
* Führt $callback mit dem Pfad einer lokalen Kopie des Uploads aus.
|
||||
*
|
||||
* Die Datei wird erst per move_uploaded_file ins eigene storage verschoben:
|
||||
* Auf Shared Hosting sperrt open_basedir oft das direkte Lesen im
|
||||
* PHP-Upload-Verzeichnis (getRealPath() liefert dann false).
|
||||
*
|
||||
* @template T
|
||||
*
|
||||
* @param callable(string): T $callback
|
||||
* @return T
|
||||
*/
|
||||
public static function withLocalCopy(UploadedFile $file, callable $callback): mixed
|
||||
{
|
||||
$directory = storage_path('app/tmp');
|
||||
|
||||
if (! is_dir($directory)) {
|
||||
@mkdir($directory, 0775, true);
|
||||
}
|
||||
|
||||
$path = $file->move($directory, 'upload-'.Str::random(16))->getPathname();
|
||||
|
||||
try {
|
||||
return $callback($path);
|
||||
} finally {
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeContentImage(UploadedFile $file, string $directory): string
|
||||
{
|
||||
$disk = Storage::disk('uploads');
|
||||
|
|
@ -65,10 +94,12 @@ class Images
|
|||
return $name.'.gif';
|
||||
}
|
||||
|
||||
self::raiseMemoryLimitFor($file->getRealPath());
|
||||
$image = ImageManager::usingDriver(Driver::class)->decodePath($file->getRealPath());
|
||||
$image->scaleDown(width: 2000);
|
||||
$disk->put($name.'.webp', $image->encode(new WebpEncoder(quality: 84))->toString());
|
||||
self::withLocalCopy($file, function (string $path) use ($disk, $name) {
|
||||
self::raiseMemoryLimitFor($path);
|
||||
$image = ImageManager::usingDriver(Driver::class)->decodePath($path);
|
||||
$image->scaleDown(width: 2000);
|
||||
$disk->put($name.'.webp', $image->encode(new WebpEncoder(quality: 84))->toString());
|
||||
});
|
||||
|
||||
return $name.'.webp';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.12.2';
|
||||
public const VERSION = '0.12.3';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue