Solve conflict of var name

This commit is contained in:
Laurent Destailleur 2015-09-07 20:22:44 +02:00
parent c9264fa1bc
commit 9667b6a7c6

View File

@ -47,20 +47,20 @@ function dol_setcache($memoryid,$data)
// 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 $dolmemcache;
if (empty($m) || ! is_object($m)) if (empty($dolmemcache) || ! is_object($dolmemcache))
{ {
$m=new Memcached(); $dolmemcache=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=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1; if (! $result) return -1;
} }
$memoryid=session_name().'_'.$memoryid; $memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false); //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
//print "Add memoryid=".$memoryid; //print "Add memoryid=".$memoryid;
$m->add($memoryid,$data); // This fails if key already exists $dolmemcache->add($memoryid,$data); // This fails if key already exists
$rescode=$m->getResultCode(); $rescode=$dolmemcache->getResultCode();
if ($rescode == 0) if ($rescode == 0)
{ {
return count($data); return count($data);
@ -72,18 +72,18 @@ function dol_setcache($memoryid,$data)
} }
else if (! empty($conf->memcached->enabled) && class_exists('Memcache')) else if (! empty($conf->memcached->enabled) && class_exists('Memcache'))
{ {
global $m; global $dolmemcache;
if (empty($m) || ! is_object($m)) if (empty($dolmemcache) || ! is_object($dolmemcache))
{ {
$m=new Memcache(); $dolmemcache=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=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1; if (! $result) return -1;
} }
$memoryid=session_name().'_'.$memoryid; $memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false); //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result=$m->add($memoryid,$data); // This fails if key already exists $result=$dolmemcache->add($memoryid,$data); // This fails if key already exists
if ($result) if ($result)
{ {
return count($data); return count($data);