mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-19 06:53:53 +01:00
LSsession :: loadLSaddon: keep trace of already loaded addon to avoid loading more than once
This commit is contained in:
parent
8b4b227327
commit
9bb52296b7
1 changed files with 9 additions and 3 deletions
|
@ -99,6 +99,9 @@ class LSsession {
|
||||||
// Initialized telltale
|
// Initialized telltale
|
||||||
private static $initialized = false;
|
private static $initialized = false;
|
||||||
|
|
||||||
|
// List of currently loaded LSaddons
|
||||||
|
private static $loadedAddons = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get session info by key
|
* Get session info by key
|
||||||
*
|
*
|
||||||
|
@ -453,15 +456,17 @@ class LSsession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chargement d'un addons d'LdapSaisie
|
* Load a LSaddon (if not already loaded)
|
||||||
*
|
*
|
||||||
* @param[in] $addon Nom de l'addon à charger (Exemple : samba)
|
* @param[in] $addon The addon name (ex: samba)
|
||||||
*
|
*
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com
|
* @author Benjamin Renard <brenard@easter-eggs.com
|
||||||
*
|
*
|
||||||
* @retval boolean true si le chargement a réussi, false sinon.
|
* @retval boolean True if addon loaded, false otherwise
|
||||||
*/
|
*/
|
||||||
public static function loadLSaddon($addon) {
|
public static function loadLSaddon($addon) {
|
||||||
|
if (in_array($addon, self :: $loadedAddons))
|
||||||
|
return true;
|
||||||
if(self :: includeFile(LS_ADDONS_DIR .'LSaddons.'.$addon.'.php')) {
|
if(self :: includeFile(LS_ADDONS_DIR .'LSaddons.'.$addon.'.php')) {
|
||||||
// Load LSaddon config file (without warning if not found)
|
// Load LSaddon config file (without warning if not found)
|
||||||
$conf_file = LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php";
|
$conf_file = LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php";
|
||||||
|
@ -473,6 +478,7 @@ class LSsession {
|
||||||
LSerror :: addErrorCode('LSsession_02',$addon);
|
LSerror :: addErrorCode('LSsession_02',$addon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
self :: $loadedAddons[] = $addon;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue