PEAR is archived and read-only

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

Home » Internationalization » Translation2 » Bug #4218

Admin Container removeLang bug

Details

Submitted2005-04-25 04:23 UTC
Fromivanchoo at singnet dot com dot sg
Assignedquipo
StatusClosed
PackageTranslation2
PHP Version4.3.11
OSDarwin OS X
Roadmaps(Not assigned)

Comments

[2005-04-25 04:23 UTC] ivanchoo at singnet dot com dot sg

Description:
------------
removeLang() in Translation2/Admin/Container/db.php
drops the entire table even though there is ONE language
column left.

Reproduce code:
---------------
function removeLang($langID, $force) {
....
if (count($langs) > 1 && !$force) {
..
}
}

change to

function removeLang($langID, $force) {
....
if (count($langs) > 0 && !$force) {
..
}
}

[2005-04-25 13:12 UTC] ivanchoo at singnet dot com dot sg

Sorry, I'm kinda new to all these. I checked the latest
Translation2 package and at cvs.php.net, the "problem"
is the same.

My point is that removeLang() will drop the entire
$lang_table if there is lesser then 2 languages defined.

--------------------
..
if (count($langs) > 1 & !$force) {
[alter table statement];
return [alter table result];

}
[drop entire $lang_table here!];
--------------------

It makes sense to alter the table when there's at least
one language left, instead of dropping the table.

if (count($langs) >= 1 & !$force) {..
^

Anyway, I suggest not dropping the $lang_table at all,
as it may cause some error when we try to access the
$lang_table via other interface like DB_DataObject.

Sorry if I'm missing something here. Thanks for your
patience.

[2005-04-27 02:45 UTC] ivanchoo at singnet dot com dot sg

I am using a single table to hold all the string
data, and I would assume that the stringID & pageID are
used as the keys in this table.

In my case, i removed all but one language column and

$langs = $this->_getLangsInTable($lang_table);

returns the last language column.

array {
[0] = 'lang_ID_here';
}

Therefore, in my case, the table shouldn't be dropped.

I am using DB_DataObject_FormBuilder to dynamically
built a web form to access/modify/add the languages. All
actions are proxied through my DB_DataObject and passed
on to the Translations2_Admin interface. Hence it will
cause some problems when the table is dropped.