Merge pull request #14673 from atm-john/11.0_fix_loadlang_cron
FIX Cron load lang
This commit is contained in:
commit
ae857e7008
@ -163,18 +163,19 @@ class Translate
|
|||||||
*
|
*
|
||||||
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
|
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
|
||||||
*
|
*
|
||||||
* @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files:
|
* @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files:
|
||||||
* If $domain is "file@module" instead of "file" then we look for module lang file
|
* If $domain is "file@module" instead of "file" then we look for module lang file
|
||||||
* in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang
|
* in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang
|
||||||
* then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang
|
* then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang
|
||||||
* @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US)
|
* @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US)
|
||||||
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
|
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
|
||||||
* @param int $forcelangdir To force a different lang directory
|
* @param int $forcelangdir To force a different lang directory
|
||||||
* @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf.
|
* @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf.
|
||||||
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
* @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found
|
||||||
|
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||||
* @see loadLangs()
|
* @see loadLangs()
|
||||||
*/
|
*/
|
||||||
public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0)
|
public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0)
|
||||||
{
|
{
|
||||||
global $conf,$db;
|
global $conf,$db;
|
||||||
|
|
||||||
@ -205,7 +206,8 @@ class Translate
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check cache
|
// Check cache
|
||||||
if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain
|
if (! empty($this->_tab_loaded[$newdomain])
|
||||||
|
&& ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)) ) // File already loaded and found and not forced for this domain
|
||||||
{
|
{
|
||||||
//dol_syslog("Translate::Load already loaded for newdomain=".$newdomain);
|
//dol_syslog("Translate::Load already loaded for newdomain=".$newdomain);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -1057,7 +1057,8 @@ class Cronjob extends CommonObject
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$result = $langs->load($this->module_name);
|
$result = $langs->load($this->module_name);
|
||||||
$result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing
|
$result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1);
|
||||||
|
|
||||||
if ($result < 0) // If technical error
|
if ($result < 0) // If technical error
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR);
|
dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user