Amélioration chargement config

This commit is contained in:
Michael RICOIS 2011-03-11 16:30:55 +00:00
parent 6914937f1b
commit 4baebb8aa1

View File

@ -5,9 +5,18 @@ class WsScores
protected $login = '';
protected $password = '';
public function __construct($login = '', $password = '') {
$config = parse_ini_file(PATH_SITE.'/config/scoresws.ini', true);
$this->webservices = $config[ENVIRONNEMENT];
public function __construct($login = '', $password = '')
{
static $file_loaded = false;
static $config = array();
if (!$file_loaded) {
$file = PATH_SITE.'/config/scoresws.ini';
if (is_file($file)) {
$config = parse_ini_file($file, true);
}
$file_loaded = true;
}
$this->webservices = $config[ENVIRONNEMENT];
if (empty($login) == false && empty($password) == false) {
$this->login = $login;
$this->password = $password;