Repository navigation
Internals Uninstaller Cleanup StorageCleanup
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/uninstaller/cleanup/StorageCleanup.php · Snapshot 8411f4287706.
Uninstallation deletes the package record before attempting each cleanup collaborator. Failures are collected; cleanup continues and can leave partial state.
use uninstaller\interfaces\IPackageCleanup;
use vfs\storage\enums\EOwnerType;
use vfs\storage\interfaces\IFileSystemService;
use vfs\storage\interfaces\IStorageRepository;class StorageCleanup implements IPackageCleanupDeclarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.
| Member | Declaration | Purpose or source contract |
|---|---|---|
| Constructor-promoted | private readonly IStorageRepository $repository |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | private readonly IFileSystemService $fileSystem |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct( private readonly IStorageRepository $repository, private readonly IFileSystemService $fileSystem, ) |
| clean | public function clean(int $id, string $name): array |
public function __construct(
private readonly IStorageRepository $repository,
private readonly IFileSystemService $fileSystem,
);| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$repository |
private readonly IStorageRepository $repository |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$fileSystem |
private readonly IFileSystemService $fileSystem |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
public function clean(int $id, string $name): array| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$id |
int $id |
Record or runtime identifier selected by this operation. |
$name |
string $name |
Named key/label selected by this API; its exact scope is shown by the implementation trace. |
Return expressions (including local callbacks): $errors.
Explicit exceptions: \RuntimeException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Failure handling catches \Throwable.
Implementation, validation guards and interaction order
public function clean(int $id, string $name): array
{
$errors = [];
foreach ($this->repository->fetchByOwnerTypeAndOwner(EOwnerType::PACKAGE, $id) as $entry) {
try {
$path = $entry->getPath();
if ($this->fileSystem->exists($path) && !$this->fileSystem->delete($path)) {
throw new \RuntimeException("Failed to delete storage file: {$path}");
}
// Keep the record on file deletion failure so cleanup can be retried.
if (!$this->repository->delete($entry)) {
throw new \RuntimeException('Failed to purge storage record.');
}
} catch (\Throwable $error) {
$errors[] = 'Storage entry ' . $entry->getId() . ': ' . $error->getMessage();
}
}
return $errors;
}AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes