|
4 | 4 | use Chamilo\CoreBundle\Entity\Session; |
5 | 5 | use Chamilo\CoreBundle\Framework\Container; |
6 | 6 | use Chamilo\CoreBundle\Helpers\ChamiloHelper; |
| 7 | +use League\Flysystem\FilesystemOperator; |
7 | 8 |
|
8 | 9 | /** |
9 | 10 | * Responses to AJAX calls. |
|
1447 | 1448 | if (api_is_windows_os()) { |
1448 | 1449 | $message = get_lang('The space used on disk cannot be measured properly on Windows-based systems.'); |
1449 | 1450 | } else { |
1450 | | - $dir = api_get_path(SYS_VAR_PATH); |
1451 | | - $du = exec('du -sh '.$dir, $err); |
| 1451 | + // @TODO Scanning the var folder should be done through oneup_flysystem |
| 1452 | + /** @var FilesystemOperator $assetFS */ |
| 1453 | + //$assetFS = Container::$container->get('oneup_flysystem.asset_filesystem'); |
| 1454 | + /** @var FilesystemOperator $resourceFS */ |
| 1455 | + //$resourceFS = Container::$container->get('oneup_flysystem.resource_filesystem'); |
| 1456 | + /** @var FilesystemOperator $themesFS */ |
| 1457 | + //$themesFS = Container::$container->get('oneup_flysystem.themes_filesystem'); |
| 1458 | + /** @var FilesystemOperator $pluginsFS */ |
| 1459 | + //$pluginsFS = Container::$container->get('oneup_flysystem.plugins_filesystem'); |
| 1460 | + |
| 1461 | + $dir = api_get_path(SYMFONY_SYS_PATH).'var/'; |
| 1462 | + $du = exec('du -s '.$dir, $err); |
1452 | 1463 | list($size, $none) = explode("\t", $du); |
| 1464 | + $size = round($size / (1024*1024), 1); |
1453 | 1465 | unset($none); |
1454 | | - $limit = 0; |
1455 | | - if (isset($_configuration[$accessUrlId]['hosting_limit_disk_space'])) { |
1456 | | - $limit = $_configuration[$accessUrlId]['hosting_limit_disk_space']; |
| 1466 | + $limit = ''; |
| 1467 | + $url = api_get_access_url($accessUrlId)['url']; |
| 1468 | + if (!empty($_configuration[$accessUrlId]['hosting_limit_disk_space'])) { |
| 1469 | + $limit = round($_configuration[$accessUrlId]['hosting_limit_disk_space'] / (1024), 1); |
| 1470 | + $message = sprintf(get_lang('Total space used by portal %s is %sGB (limit is set to %sGB)'), $url, $size, $limit); |
| 1471 | + } else { |
| 1472 | + $message = sprintf(get_lang('Total space used by %s is %sGB'), $url, $size); |
1457 | 1473 | } |
1458 | | - $message = sprintf(get_lang('Total space used by portal %s limit is %s MB'), $size, $limit); |
1459 | 1474 | } |
1460 | 1475 | echo Display::tag('H5', $message, ['style' => 'margin-bottom: 25px;']); |
1461 | 1476 | break; |
|
0 commit comments