Files
multidiskspace/init.php
T
2026-11-09 02:00:13 +04:00

31 lines
1.2 KiB
PHP

<?php
eval(FileUtil::getPluginConf($plugin["name"]));
if (empty($partitionDirectories)) {
if (User::isLocalMode() && rTorrentSettings::get()->linkExist && file_exists(rTorrentSettings::get()->directory)) {
$partitionDirectories = [rTorrentSettings::get()->directory => ''];
} else {
$partitionDirectories = [$topDirectory => ''];
}
}
$diskOk = function_exists('disk_total_space') && function_exists('disk_free_space');
if ($diskOk) {
foreach (array_keys($partitionDirectories) as $dir) {
if ((disk_total_space($dir) === false) || (disk_free_space($dir) === false)) {
$diskOk = false;
}
}
}
if (!$diskOk) {
$jResult .= "plugin.disable();";
} else {
$jResult .= "plugin.interval = " . $diskUpdateInterval . "; plugin.notifySpaceLimit = " . ($notifySpaceLimit * 1024 * 1024) . ";";
$jResult .= "plugin.freeBytesInMeter = " . ($freeBytesInMeter ? 1 : 0) . ";";
$jResult .= "plugin.diskCount = " . count($partitionDirectories) . ";";
$jResult .= "plugin.diskNames = " . json_encode(array_values($partitionDirectories)) . ";";
$theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
}