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='') 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); dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
return false; return false;
} }
if (! empty($classname) && ! class_exists($classname)) { if (! empty($classname) && ! class_exists($classname)) {
return include dol_buildpath($relpath); return include $fullpath;
} else { } else {
return include_once dol_buildpath($relpath); return include_once $fullpath;
} }
} }