Disk capacity
- Dominant language
- JavaScript
- Stars
- 15
- Forks
- 3
- Avg merge
- 8d 1h
- Merged PRs (30d)
- 1
Description
V rámci nastavení CMS by se hodilo uživateli zobrazovat, jak je na tom kapacitně jeho disk na serveru.
Zkus připravit třídu, která bude poskytovat informace o discích a jakou mají kapacitu. Představuji si to tak, že zavolám něco jako:
```php
Disk::getOverview();
```
A jako response dostanu pole dostupných disků a kapacity. Pozor, pole disků se liší podle operačního systému (na Windows jsou disky `A-Z`, na Linuxu se tzv. mountují).
Možná response:
```
[
// disk => [dostupná kapacita, použitá, celková],
'c' => ['available' => int, 'used' => int, 'total' => int],
]
```
----
Pomocné funkce:
- free space: `disk_free_space()`
- total space: `disk_total_space()`
- Add disk total space detection by project root dir
Na Windows teoreticky takto (nevyzkoušeno):
```php
function getDisks(): array
{
if (str_contains(PHP_OS_FAMILY, 'WIN')) {
$return = [];
foreach (range('A', 'Z') as $disk) {
$return[$disk] = disk_total_space($disk . ':');
}
return $return;
}
return [
'/' => disk_total_space('/')
];
}
```
Contributor guide
Research direction
Start by locating the CMS's PHP service or utility entry point where a Disk class can be added, then review how project-root paths are exposed. Use disk_free_space() and disk_total_space() to define Disk::getOverview(), including available, used, and total values for Windows drive letters and Linux mounts. Done means the response covers the project root and supported operating systems consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100