Corrected file_exists check and little refactor

This commit is contained in:
Marcos García de La Fuente 2014-07-17 21:44:59 +02:00
parent ad4512cb24
commit bcafa2c790

View File

@ -240,16 +240,17 @@ function dol_getprefix()
*/
function dol_include_once($relpath, $classname='')
{
$fullpath = dol_buildpath($relpath);
if (!file_exists($relpath)) {
if (!file_exists($fullpath)) {
dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
return false;
}
if (! empty($classname) && ! class_exists($classname)) {
return include dol_buildpath($relpath);
return include $fullpath;
} else {
return include_once dol_buildpath($relpath);
return include_once $fullpath;
}
}