PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Internationalization » Translation2 » Bug #2563

[PATCH] Admin_DB add/update cleanup

Details

Request #2563[PATCH] Admin_DB add/update cleanup
Submitted2004-10-18 21:53 UTC
Fromieure at php dot net
StatusClosed
PackageTranslation2
PHP Version4.3.9
OSLinux
Roadmaps(Not assigned)

Comments

[2004-10-18 21:53 UTC] ieure at php dot net

Description:
------------
The add() and update() functions in the DB Admin class have
some code which could be optimized further.

They both have what appears to be the same block of code,
which iterates over the passed languages and unset any code
not present in the available list. This is done inside a
foreach loop, which makes repeated calls to in_array().

This has been replaced with a single call to
array_intersect(). count() was also called twice; the
redundant call has been removed.

While I haven't benchmarked my code, I expect that it's
faster than the current version.

Patch is against CVS:
http://atomized.org/PEAR/Patches/Translation2-Admin_DB_AddUpdate_Cleanup.patch