Skip to content

Commit

Permalink
Adding hosting_limit_disk_space in main/admin/system_status.php?secti…
Browse files Browse the repository at this point in the history
…on=chamilo
  • Loading branch information
jmontoyaa committed May 17, 2016
1 parent 58dd388 commit 3c862d2
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions main/inc/lib/diagnoser.lib.php
Expand Up @@ -29,10 +29,10 @@ public function show_html()
{
$sections = array('chamilo', 'php', 'database', 'webserver');

if (!in_array(trim($_GET['section']), $sections)) {
$current_section = 'chamilo';
} else {
if (isset($_GET['section']) && in_array(trim($_GET['section']), $sections)) {
$current_section = $_GET['section'];
} else {
$current_section = 'chamilo';
}

$html = '<div class="tabbable"><ul class="nav nav-tabs">';
Expand Down Expand Up @@ -78,6 +78,7 @@ public function get_chamilo_data()
api_get_path(SYS_APP_PATH) .'upload/users/',
api_get_path(SYS_PATH) .'main/default_course_document/images/',
);

foreach ($writable_folders as $index => $folder) {
$writable = is_writable($folder);
$status = $writable ? self :: STATUS_OK : self :: STATUS_ERROR;
Expand All @@ -95,10 +96,60 @@ public function get_chamilo_data()

$exists = file_exists(api_get_path(SYS_CODE_PATH).'install');
$status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK;
$array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
$array[] = $this->build_setting(
$status,
'[FILES]',
get_lang('DirectoryExists') . ': /install',
'http://be2.php.net/file_exists',
$exists,
0,
'yes_no', get_lang('DirectoryShouldBeRemoved')
);

$app_version = api_get_setting('chamilo_database_version');
$array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version');

$array[] = $this->build_setting(
self :: STATUS_INFORMATION,
'[DB]',
'chamilo_database_version',
'#',
$app_version,
0,
null,
'Chamilo DB version'
);

$access_url_id = api_get_current_access_url_id();

if ($access_url_id === 1) {
global $_configuration;
$message2 = '';
if ($access_url_id === 1) {
if (api_is_windows_os()) {
$message2 .= get_lang('SpaceUsedOnSystemCannotBeMeasuredOnWindows');
} else {
$dir = api_get_path(SYS_PATH);
$du = exec('du -sh ' . $dir, $err);
list($size, $none) = explode("\t", $du);
$limit = $_configuration[$access_url_id]['hosting_limit_disk_space'];
$message2 .= sprintf(get_lang('TotalSpaceUsedByPortalXLimitIsYMB'), $size, $limit);
}
}

$array[] = $this->build_setting(
self :: STATUS_OK,
'[FILES]',
'hosting_limit_disk_space',
'#',
$size,
0,
null,
$message2
);
}




return $array;
}
Expand Down

0 comments on commit 3c862d2

Please sign in to comment.