[dev] 4.0-git Kronolith (& Ansel) & ensureTypes()
Michael J Rubinsky
mrubinsk at horde.org
Sat Dec 18 15:45:36 UTC 2010
On Dec 18, 2010, at 9:57 AM, Rick Romero <rick at havokmon.com> wrote:
> 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)...
I'm not exactly sure what you are complaining about here. It's not just one line of code that requires the library. The PDO mysql extension is a PHP requirement to interface with mysql via the PHP PDO library (which Horde_Db is using in your configuration). The MDB2 requirement (which, fwiw, was a Horde 3 requirement for both Ansel and Shares) is similar, and a result of the pear library's design, not Horde. MDB2 use in Horde is being removed, however (in favor of the new Horde_Db library), so that point is moot. We just haven't refactored every bit of code yet. Basically, the module requirement boils down to "if you want PHP to interface with your DB, you need the modules that provide that support."
--
Mike
Sent form my iPad...
> Rick
> --
> Horde developers mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
More information about the dev
mailing list