Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.4

Bug #4218 Admin Container removeLang bug
Submitted: 2005-04-25 04:23 UTC
From: ivanchoo at singnet dot com dot sg Assigned: quipo
Status: Closed Package: Translation2
PHP Version: 4.3.11 OS: Darwin OS X
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 15 - 7 = ?

 
 [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) { .. } }

Comments

 [2005-04-25 12:26 UTC] quipo
can you check the latest CVS version, please? TIA
 [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-26 15:33 UTC] quipo
I think that having a table with only its primary keys is kind of pointless, hence I added that check to conditionally drop the whole table when the user removes the last lang column. The code in the CVS repository should work as expected. I can't imagine any *real* reason why an table without any payload should be left as-is (i.e. not removed), but I'm open to suggestions. Just out of curiosity, why are you accessing the table-without-any-lang-col with DB_DataObject?
 [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.
 [2005-09-08 16:39 UTC] quipo
The latest CVS version doesn't drop the table in any case, unless you set the $force parameter of removeLang().