[dev] 4.0-git Kronolith (& Ansel) & ensureTypes()

Rick Romero rick at havokmon.com
Sat Dec 18 14:57:52 UTC 2010


Quoting "Michael J.Rubinsky" <mrubinsk at horde.org>:
>> Quoting Rick Romero <rick at havokmon.com>:
>   >
>   >> I'm having an odd issue that cropped up a couple weeks ago.
>   >>
>   >> When I goto Kronolith, I immediaetly get the error:
>   >>
>   >> QUERY FAILED: DUPLICATE ENTRY 'CALENDAR' FOR KEY 2 INSERT INTO
>   >> `RAMPAGE_TYPES` (TYPE_NAME) VALUES ('CALENDAR')
>   >>
>   >> The enries already exist.  Looking through the code, ansel also does a
>   >> check against ensureTypes - but it does it under Tags after you view a
>   >> gallery, so it's not as obvious.  
>   >>
>   >> I tracked it to:  horde/content/lib/Types/Manager.php around line 72:
>   >>
>   >>  unset($typeName[$type]);
>   >>
>   >> should be
>   >>
>   >>  unset($typeName[$id]);
>   >
>   > This code is correct as-is.  It's removing a type name that we know
>   > is present from the list of names to ensure are present. $type should
>   > be the value of the type_name field from the query above that line.
>   >
>   > Some other users were having similar issues that were the result of a
>   > broken php (one of the db methods was returning the wrong structure).
>   >  There is a closed bug about this on bugs.horde.org:
>   > http://bugs.horde.org/ticket/9223
>   >
>   >
>   >
>   >>
>   >> It seems like the types get cached somehow,
>   >
>   > Yes, they are cached globally for all users since these mappings
>   > would rarely, if ever change. You need to clear clear your
>   > Horde_Cache store.
>   >
>   >  so trying to revert after it
>   >> works to get it to fail again has proven difficult... But the  
> above change
>   >> seems to fix the problem on both Kronolith and Ansel (in the Tags area).
>   >> All I know for sure is $type is definitely empty in that loop.
>   >
>   > If $type is empty, then either your data is corrupt (an empty value
>   > in the db), or your php is broken and not returning the valid data
>   > structure.
>   >
>   > Please look at the bug report referenced above, and see if that
>   > sounds like what you are experiencing.
>   >
>   > --mike
>   >
Installed pdo-mysql.  Seems a little much for one-line of code, and FWIW,
the 2nd additional module for MySQL (pecl's MDB2_Driver_MySQL) I've had to
install for 4.0-git (on the same box that already runs horde 3.2.2).

Granted I'm not a dev, but my first thought would be to reduce the number
of loaded modules and just require one extension (if needed at all)...

Rick


More information about the dev mailing list