Follows utopia-php/http#249 migration guide to drop usage of the shims
kept for one-minor-release compat. Affected call sites switch to:
- Handler / hook context: inject 'route' (Route|null from the per-request
DI container) instead of $utopia->getRoute().
- Resource factories (init/resources/request.php): Router::matchRoute()
returning ?RouteMatch instead of $utopia->match($request).
- Error path in app/http.php: $app->getResource('routeMatch')?->route,
guarded with try/catch for the pre-dispatch error case.
- GraphQL resolver inner-request pattern (Resolvers.php): capture
getResource('routeMatch') as the original, Router::matchRoute() for
the inner URL, rebind 'route' / 'routeMatch' on the resolver container
in finally instead of setRoute($original). Http::execute() shim is
retained — the guide explicitly keeps it for this hand-built-route
case.
Redundant re-match in shared/api.php storage-cache branch removed; the
injected $route is already the current one.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pin utopia-php/http to the refactor/coroutine-safe-dispatch branch, which
extracts per-request state into a Dispatcher + immutable RouteMatch so the
shared Http/Router/Route objects are no longer mutated under concurrent
coroutines.
Appwrite-side adjustments:
- app/controllers/shared/api.php: Route::getMatchedPath() was removed from
the library; use Route::getPath() for the /documentsdb vs /vectorsdb
substring check. Both the registered pattern and the matched path contain
the literal segment, so the behaviour is preserved.
- app/controllers/general.php: drop four $route->label('router', true)
writes. The sole reader in the wildcard 404 handler was deleted in
40beecdddc (Feb 2025); the writes were orphaned and mutated the shared
Route definition, which is now frozen under the new dispatch model.
Deprecated shims for Http::match(), Http::getRoute(), Http::setRoute() are
still honoured by the library; remaining call sites can migrate in a
follow-up pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cache write hook now checks HTTP status code before writing to prevent
failed AVIF (or any other) conversions from poisoning the cache.
Bumps utopia-php/image to 0.8.5 which fixes AVIF/HEIC output by using
native Imagick instead of the deprecated magick convert shell command.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three bugs causing storage preview cache to be ineffective:
1. Cache keys included the `token` auth parameter, so requests using
resource tokens always generated unique keys and never hit cache.
Introduced `cache.params` label for routes to opt-in specific params
into the cache key; preview now declares only the transform params.
2. Cache hits never refreshed `accessedAt` in the DB or the filesystem
file mtime, because `$response->send()` in the init hook skips the
shutdown hook. After 30 days the maintenance job evicted still-active
cache entries, and after the original 30-day filesystem TTL the cache
file expired — causing periodic full re-renders. The cache-hit path
now updates both on the APP_CACHE_UPDATE (24h) interval.
3. `updateDocument` in the preview action passed the full file document
instead of a sparse one when updating `transformedAt`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- SessionCreated event now carries only domain data (no isFirstSession)
- Mails listener uses ordered guard clauses, deferring the DB query
until cheaper checks pass
- Drop $user Document allocation in favour of direct array access
- Inline FileName validator and $smtpEnabled into their use sites
- Extract $isBranded to eliminate duplicate APP_BRANDED_EMAIL_BASE_TEMPLATE check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves session alert email side effect out of the account controller
into a dedicated `Mails` listener that reacts to a new `SessionCreated`
bus event. The event is now always dispatched on session creation; the
listener owns all conditional logic (first session, sessionAlerts flag,
email-link sessions, user email presence).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>