27 lines
780 B
PHP
27 lines
780 B
PHP
<?php
|
|
|
|
require_once('../../php/util.php');
|
|
require_once('../../php/settings.php');
|
|
eval(FileUtil::getPluginConf('multidiskspace'));
|
|
|
|
if (empty($partitionDirectories)) {
|
|
if (User::isLocalMode() && rTorrentSettings::get()->linkExist && file_exists(rTorrentSettings::get()->directory)) {
|
|
$partitionDirectories = [rTorrentSettings::get()->directory => ''];
|
|
} else {
|
|
$partitionDirectories = [$topDirectory => ''];
|
|
}
|
|
}
|
|
$ret = [];
|
|
foreach (array_keys($partitionDirectories) as $dir) {
|
|
$item = [
|
|
"total" => 0,
|
|
"free" => 0,
|
|
];
|
|
if (is_dir($dir)) {
|
|
$item["total"] = disk_total_space($dir);
|
|
$item["free"] = disk_free_space($dir);
|
|
}
|
|
$ret[] = $item;
|
|
}
|
|
CachedEcho::send(JSON::safeEncode($ret), "application/json");
|