Fix: add function getStaticMember() for compatibility with PHP 5.2
This commit is contained in:
parent
a3dd1672d8
commit
f3d4cca46a
@ -145,6 +145,31 @@ if (! function_exists('json_decode'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter description here ...
|
||||||
|
*
|
||||||
|
* @param string $class
|
||||||
|
* @param string $member
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function getStaticMember($class, $member)
|
||||||
|
{
|
||||||
|
if (is_object($class)) $class = get_class($class);
|
||||||
|
$classObj = new ReflectionClass($class);
|
||||||
|
$result = null;
|
||||||
|
|
||||||
|
foreach($classObj->getStaticProperties() as $prop => $value)
|
||||||
|
{
|
||||||
|
if($prop == $member)
|
||||||
|
{
|
||||||
|
$result = $value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a DoliDB instance (database handler).
|
* Return a DoliDB instance (database handler).
|
||||||
|
|||||||
@ -284,8 +284,8 @@ if (! empty($force_install_message))
|
|||||||
include_once($dir."/".$file);
|
include_once($dir."/".$file);
|
||||||
|
|
||||||
// Version min of database
|
// Version min of database
|
||||||
$versionbasemin=$class::$versionmin;
|
$versionbasemin=getStaticMember($class, 'versionmin');
|
||||||
$note='('.$class::$label.' >= '.versiontostring($versionbasemin).')';
|
$note='('.getStaticMember($class, 'label').' >= '.versiontostring($versionbasemin).')';
|
||||||
|
|
||||||
// Switch to mysql if mysqli is not present
|
// Switch to mysql if mysqli is not present
|
||||||
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
|
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user