Code comment
This commit is contained in:
parent
c56c97b1b2
commit
cfccc49235
@ -460,7 +460,7 @@ class Translate
|
|||||||
$tmparray = dol_getcache($usecachekey);
|
$tmparray = dol_getcache($usecachekey);
|
||||||
if (is_array($tmparray) && count($tmparray))
|
if (is_array($tmparray) && count($tmparray))
|
||||||
{
|
{
|
||||||
$this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a valuer already exists into tab_translate, value into tmparaay is not added.
|
$this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added.
|
||||||
//print $newdomain."\n";
|
//print $newdomain."\n";
|
||||||
//var_dump($this->tab_translate);
|
//var_dump($this->tab_translate);
|
||||||
$fileread = 1;
|
$fileread = 1;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
|
|||||||
* Save data into a memory area shared by all users, all sessions on server
|
* Save data into a memory area shared by all users, all sessions on server
|
||||||
*
|
*
|
||||||
* @param string $memoryid Memory id of shared area
|
* @param string $memoryid Memory id of shared area
|
||||||
* @param mixed $data Data to save
|
* @param mixed $data Data to save. It must not be a null value.
|
||||||
* @return int <0 if KO, Nb of bytes written if OK
|
* @return int <0 if KO, Nb of bytes written if OK
|
||||||
* @see dol_getcache()
|
* @see dol_getcache()
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ function dol_setcache($memoryid, $data)
|
|||||||
* Read a memory area shared by all users, all sessions on server
|
* Read a memory area shared by all users, all sessions on server
|
||||||
*
|
*
|
||||||
* @param string $memoryid Memory id of shared area
|
* @param string $memoryid Memory id of shared area
|
||||||
* @return int|mixed <0 if KO, data if OK
|
* @return int|mixed <0 if KO, data if OK, null if not found into cache
|
||||||
* @see dol_setcache()
|
* @see dol_setcache()
|
||||||
*/
|
*/
|
||||||
function dol_getcache($memoryid)
|
function dol_getcache($memoryid)
|
||||||
@ -108,11 +108,9 @@ function dol_getcache($memoryid)
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Using a memcached server
|
// Using a memcached server
|
||||||
if (!empty($conf->memcached->enabled) && class_exists('Memcached'))
|
if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
|
||||||
{
|
|
||||||
global $m;
|
global $m;
|
||||||
if (empty($m) || !is_object($m))
|
if (empty($m) || !is_object($m)) {
|
||||||
{
|
|
||||||
$m = new Memcached();
|
$m = new Memcached();
|
||||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||||
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||||
@ -126,17 +124,14 @@ function dol_getcache($memoryid)
|
|||||||
$rescode = $m->getResultCode();
|
$rescode = $m->getResultCode();
|
||||||
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
||||||
//var_dump($data);
|
//var_dump($data);
|
||||||
if ($rescode == 0)
|
if ($rescode == 0) {
|
||||||
{
|
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
return -$rescode;
|
return -$rescode;
|
||||||
}
|
}
|
||||||
} elseif (!empty($conf->memcached->enabled) && class_exists('Memcache'))
|
} elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) {
|
||||||
{
|
|
||||||
global $m;
|
global $m;
|
||||||
if (empty($m) || !is_object($m))
|
if (empty($m) || !is_object($m)) {
|
||||||
{
|
|
||||||
$m = new Memcache();
|
$m = new Memcache();
|
||||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||||
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||||
@ -148,20 +143,18 @@ function dol_getcache($memoryid)
|
|||||||
$data = $m->get($memoryid);
|
$data = $m->get($memoryid);
|
||||||
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
||||||
//var_dump($data);
|
//var_dump($data);
|
||||||
if ($data)
|
if ($data) {
|
||||||
{
|
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} // Using shmop
|
} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
|
||||||
elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
|
// Using shmop
|
||||||
{
|
|
||||||
$data = dol_getshmop($memoryid);
|
$data = dol_getshmop($memoryid);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user