Help/Need debug of some online instances with the log view

This commit is contained in:
Laurent Destailleur 2017-06-20 16:54:37 +02:00
parent 3873bc7433
commit ec9bbe2b52
4 changed files with 36 additions and 14 deletions

View File

@ -229,6 +229,14 @@ foreach ($syslogModules as $moduleName)
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>'; print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example']; if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/',$value))
{
$filelogparam =' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
$filelogparam.=$langs->trans('Download');
$filelogparam.=$filelog.'</a>)';
print $filelogparam;
}
} }
} }
print '</td>'; print '</td>';

View File

@ -83,7 +83,15 @@ if (! empty($conf->syslog->enabled))
{ {
print '<input type="radio" name="choice" value="logfile"'; print '<input type="radio" name="choice" value="logfile"';
print ($choice && $choice=='logfile') ? ' checked' : ''; print ($choice && $choice=='logfile') ? ' checked' : '';
print '> '.$langs->trans("PurgeDeleteLogFile",$filelog).'<br><br>'; $filelogparam=$filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
{
$filelogparam ='<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam.=basename($filelog);
$filelogparam.='">'.$filelog.'</a>';
}
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
print '<br><br>';
} }
print '<input type="radio" name="choice" value="tempfiles"'; print '<input type="radio" name="choice" value="tempfiles"';

View File

@ -1825,8 +1825,20 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$lire='creer'; $read='write'; $download='upload'; $lire='creer'; $read='write'; $download='upload';
} }
// Wrapping for miscellaneous medias files
if ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
}
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))
{
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
$original_file=$dolibarr_main_data_root.'/'.$original_file;
}
// Wrapping for some images // Wrapping for some images
if (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
@ -2369,13 +2381,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->fckeditor->dir_output.'/'.$original_file; $original_file=$conf->fckeditor->dir_output.'/'.$original_file;
} }
// Wrapping for miscellaneous medias files
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
}
// Wrapping for backups // Wrapping for backups
else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
{ {

View File

@ -26,6 +26,7 @@
* \brief Wrapper to download data files * \brief Wrapper to download data files
* \remarks Call of this wrapper is made with URL: * \remarks Call of this wrapper is made with URL:
* document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier * document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
* document.php?modulepart=logs&file=dolibarr.log
*/ */
define('NOTOKENRENEWAL',1); // Disables token renewal define('NOTOKENRENEWAL',1); // Disables token renewal