[horde] Sharing user information between hooks

Jens Wahnes wahnes at uni-koeln.de
Fri Oct 30 17:13:38 UTC 2015


On Thu, Oct 29 2015, at 16:53:10 +0000, Michael J Rubinsky wrote:

> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>> Quoting Jens Wahnes <wahnes at uni-koeln.de>:
>>> On Mon, Oct 26 2015, at 15:01:38 +0000, Michael J Rubinsky wrote:
>>>> This should be: $GLOBALS['injector']->getInstance('Horde_HashTable');
>>> Thank you for pointing this out.  It feels much better to have code
>>> that interfaces with the rest of the system the way it is intended to
>>> work. :)
>>>
>>> However, even when using the "getInstance('Horde_HashTable')" code, the
>>> old problem remains that the prefix for memcache keys
>>> ($conf['hashtable']['params']['prefix'] from conf.php) is not used.
>>> Not such a big problem since I can work around that, after all, but
>>> still leaves me with a feeling I'm not calling the Horde code
>>> correctly.  Can you shed some light on that?

>> I'll take a look. I'm not *that* familiar with the memcache code. I  
>> see some places where we *might* be missing prepending the keys, but  
>> I'm not sure.

> Actually, the only place that this might be wrong is in the lock/unlock 
> methods. Setting/deleting should work as expected.  
> Horde_HashTable_Base:: has set/delete/get etc... methods that call a  
> hkey() method which adds the prefix. After the prefix is added, the  
> concrete _set/_delete etc... methods are called using the already  
> prefixed keys. You'll have to check there to see why it's not working.

Thanks for looking this up, but I don't know how would I go about that. 
Should I add some code to these classes to write additional info to the
log file?  Or can this be done through some external PHP debugging
methods?  I've heard of xdebug, but I've never really used it so far.

> Alternatively, check that the expected config values are being grabbed  
> in Horde_Core_Factory_Hashtable.

To me, that seems to be the case.  In the debug info I get (I added a
statement "Horde::debug($memcache)"), the prefix info is present. 
Here's an excerpt from that:


object(Horde_HashTable_Memcache)#125 (4) {
  ["_memcache":protected]=>
  object(Horde_Memcache)#121 (6) {
    ["_locks":protected]=>
    array(0) {
    }
    ["_logger":protected]=>
    object(Horde_Core_Log_Wrapper)#95 (0) {
    }
    ["_memcache":protected]=>
    object(Memcache)#124 (2) {
      ["connection"]=>
      resource(11) of type (memcache connection)
      ["_failureCallback"]=>
      array(2) {
        [0]=>
        *RECURSION*
        [1]=>
        string(8) "failover"
      }
    }
    ["_noexist":protected]=>
    array(0) {
    }
    ["_params":protected]=>
    array(10) {
      ["compression"]=>
      bool(true)
      ["hostspec"]=>
      array(2) {
        [0]=>
        string(9) "localhost"
        [1]=>
        string(26) "foo.bar.example.com"
      }
      ["large_items"]=>
      bool(true)
      ["persistent"]=>
      bool(true)
      ["port"]=>
      array(2) {
        [0]=>
        string(5) "11211"
        [1]=>
        string(5) "11211"
      }
      ["prefix"]=>
      string(8) "HordeSam"
      ["weight"]=>
      array(2) {
        [0]=>
        string(2) "90"
        [1]=>
        string(2) "10"
      }
      ["c_threshold"]=>
      int(1200)
      ["umask"]=>
      int(63)
      ["logger"]=>
      object(Horde_Core_Log_Wrapper)#95 (0) {
      }
    }


When I grepped through the log file, I could see that there is only one
other type of memcache keys which do not seem to include the set
prefix.  They are related to IMAP access and look like this:

2015-10-30T15:00:26+01:00 DEBUG: HORDE [imp] Horde_HashTable_Memcache: Retrieved keys (horde_imap_client|user1|INBOX|localhost|143|10289) [pid 16337 on line 233 of "/usr/share/pear/Horde/HashTable/Base.php"]

Does this give anyone a clue, maybe?  What's so special about
Horde_Imap_Client?  All other entries do have the prefix.  They all
look just like this one:

2015-10-30T15:00:26+01:00 DEBUG: HORDE [imp] Horde_HashTable_Memcache: Retrieved keys (HordeSamperm_sql_exists_2kronolith,HordeSamperm_sql_exists_2kronolith_t) [pid 16337 on line 233 of "/usr/share/pear/Horde/HashTable/Base.php"]


Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.horde.org/archives/horde/attachments/20151030/8cd8697d/attachment.bin>


More information about the horde mailing list