Repository navigation
Internals Vfs Storage Services LocalFileSystemService
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/vfs/storage/services/LocalFileSystemService.php · Snapshot 8411f4287706.
VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.
use vfs\storage\interfaces\IFileSystemService;class LocalFileSystemService implements IFileSystemServiceNo own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.
| Method | Signature |
|---|---|
| move | public function move(string $sourcePath, string $destinationPath): bool |
| copy | public function copy(string $sourcePath, string $destinationPath): bool |
| delete | public function delete(string $path): bool |
| rename | public function rename(string $sourcePath, string $destinationPath): bool |
| fileSize | public function fileSize(string $path): int |
| lastModified | public function lastModified(string $path): int |
| exists | public function exists(string $path): bool |
| makeDirectory | public function makeDirectory(string $path, int $permissions = 0755, bool $recursive = true): bool |
public function move(string $sourcePath, string $destinationPath): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$sourcePath |
string $sourcePath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$destinationPath |
string $destinationPath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): is_file($sourcePath); false; true.
External effects include unlink, copy.
Implementation, validation guards and interaction order
public function move(string $sourcePath, string $destinationPath): bool
{
if ($sourcePath === $destinationPath) return is_file($sourcePath);
if (!is_file($sourcePath) || file_exists($destinationPath) || is_link($destinationPath)) return false;
// link() creates the destination exclusively, preventing concurrent overwrites.
if (@link($sourcePath, $destinationPath)) {
if (@unlink($sourcePath)) return true;
@unlink($destinationPath);
return false;
}
// Cross-filesystem moves use the same exclusive destination creation.
$mtime = filemtime($sourcePath);
if (!$this->copy($sourcePath, $destinationPath)) return false;
if ($mtime !== false) @touch($destinationPath, $mtime);
if (@unlink($sourcePath)) return true;
@unlink($destinationPath);
return false;
}public function copy(string $sourcePath, string $destinationPath): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$sourcePath |
string $sourcePath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$destinationPath |
string $destinationPath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): false; true.
External effects include unlink.
Implementation, validation guards and interaction order
public function copy(string $sourcePath, string $destinationPath): bool
{
if (!is_file($sourcePath)) return false;
$source = @fopen($sourcePath, 'rb');
if ($source === false) return false;
$target = @fopen($destinationPath, 'xb');
if ($target === false) { fclose($source); return false; }
$expected = fstat($source)['size'];
$written = @stream_copy_to_stream($source, $target);
$flushed = @fflush($target);
fclose($source);
fclose($target);
if ($written === false || $written !== $expected || !$flushed) {
@unlink($destinationPath);
return false;
}
clearstatcache(true, $destinationPath);
return true;
}public function delete(string $path): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
Return expressions (including local callbacks): @unlink($path).
External effects include unlink.
Implementation, validation guards and interaction order
public function delete(string $path): bool { return @unlink($path); }public function rename(string $sourcePath, string $destinationPath): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$sourcePath |
string $sourcePath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$destinationPath |
string $destinationPath |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): $this->move($sourcePath, $destinationPath).
Implementation, validation guards and interaction order
public function rename(string $sourcePath, string $destinationPath): bool { return $this->move($sourcePath, $destinationPath); }public function fileSize(string $path): int| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
Return expressions (including local callbacks): $size.
Explicit exceptions: \RuntimeException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
public function fileSize(string $path): int
{
clearstatcache(true, $path);
$size = @filesize($path);
if ($size === false) throw new \RuntimeException("Unable to determine file size for: {$path}");
return $size;
}public function lastModified(string $path): int| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
Return expressions (including local callbacks): $mtime.
Explicit exceptions: \RuntimeException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
public function lastModified(string $path): int
{
clearstatcache(true, $path);
$mtime = @filemtime($path);
if ($mtime === false) throw new \RuntimeException("Unable to determine last modified time for: {$path}");
return $mtime;
}public function exists(string $path): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
Return expressions (including local callbacks): file_exists($path) || is_link($path).
Implementation, validation guards and interaction order
public function exists(string $path): bool { clearstatcache(true, $path); return file_exists($path) || is_link($path); }public function makeDirectory(string $path, int $permissions = 0755, bool $recursive = true): bool| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
$permissions |
int $permissions = 0755 |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$recursive |
bool $recursive = true |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): true; is_dir($path).
External effects include mkdir.
Implementation, validation guards and interaction order
public function makeDirectory(string $path, int $permissions = 0755, bool $recursive = true): bool
{
if (is_dir($path)) return true;
@mkdir($path, $permissions, $recursive);
return is_dir($path);
}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