Minor - add readable option.

1.10.x
Julio Montoya 11 years ago
parent 7a17480fa2
commit 3b9936065b
  1. 33
      main/install/install.lib.php

@ -232,7 +232,6 @@ function detect_browser_language()
return 'english';
}
/* FILESYSTEM RELATED FUNCTIONS */
/**
@ -254,6 +253,25 @@ function check_writable($folder, $suggestion = false)
}
}
/**
* This function checks if the given folder is readable
* @param string $folder Full path to a folder
* @param bool $suggestion Whether to show a suggestion or not
* @return string
*/
function checkReadable($folder, $suggestion = false)
{
if (is_writable($folder)) {
return Display::label(get_lang('Readable'), 'success');
} else {
if ($suggestion) {
return Display::label(get_lang('NotReadable'), 'info');
} else {
return Display::label(get_lang('NotReadable'), 'important');
}
}
}
/**
* This function is similar to the core file() function, except that it
* works with line endings in Windows (which is not the case of file())
@ -893,11 +911,20 @@ function display_requirements(
$courseTestLabel = Display::label(get_lang('No'), 'important');
}
$oldConf = '';
if (file_exists(api_get_path(SYS_CODE_PATH).'inc/conf/configuration.php')) {
$oldConf = '<tr>
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'inc/conf</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'inc/conf').'</td>
</tr>';
}
echo '<table class="table">
<tr>
<td class="requirements-item">'.api_get_path(CONFIGURATION_PATH).'</td>
<td class="requirements-value">'.check_writable(api_get_path(CONFIGURATION_PATH)).'</td>
</tr>
'.$oldConf.'
<tr>
<td class="requirements-item">'.api_get_path(SYS_UPLOAD_PATH).'users/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_UPLOAD_PATH).'users/').'</td>
@ -938,6 +965,10 @@ function display_requirements(
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'lang/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'lang/', true).' <br />('.get_lang('SuggestionOnlyToEnableSubLanguageFeature').')</td>
</tr>
<tr>
<td class="requirements-item">'.api_get_path(SYS_PATH).'vendor/</td>
<td class="requirements-value">'.checkReadable(api_get_path(SYS_PATH).'vendor').'</td>
</tr>
<tr>
<td class="requirements-item">'.get_lang('CourseTestWasCreated').'</td>
<td class="requirements-value">'.$courseTestLabel.' </td>

Loading…
Cancel
Save