Bug 254429 - Babel server blank plugin_id for deleted properties file
Summary: Babel server blank plugin_id for deleted properties file
Status: RESOLVED FIXED
Alias: None
Product: Babel
Classification: Technology
Component: Server (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Babel server inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 252625 258002
  Show dependency tree
 
Reported: 2008-11-06 06:52 EST by Antoine Toulmé CLA
Modified: 2009-03-31 15:27 EDT (History)
2 users (show)

See Also:


Attachments
Patch that fixes #3 (3.70 KB, patch)
2008-11-18 17:26 EST, Antoine Toulmé CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Toulmé CLA 2008-11-06 06:52:45 EST
Since we now record the plugin_id for properties file, some have blank values because they were deleted or are not anymore mapped to babel with a map file.

Two or three solutions:
1. Just don't generate for those files.
2. Remove them from the DB.
3. Flag those files as non existing during the processing and avoid generating for them.
Comment 1 Antoine Toulmé CLA 2008-11-18 08:36:52 EST
Workaround for now:

for those files we rely on the old way of finding the plugin id.

I will bring the discussion to the babel-dev mailing list.
Comment 2 Denis Roy CLA 2008-11-18 16:58:36 EST
I vote 3.

I'm raising priority here, because our database is full of 'deleted' files, and this could cause our translators to work for nothing.
Comment 3 Antoine Toulmé CLA 2008-11-18 17:26:41 EST
Created attachment 118201 [details]
Patch that fixes #3

Denis or Kit, please take a look at the attached patch.
Comment 4 Antoine Toulmé CLA 2008-11-19 10:09:28 EST
Changing state to assigned.
Comment 5 Denis Roy CLA 2008-12-01 13:32:28 EST
cc'ing Margaret
Comment 6 Denis Roy CLA 2009-01-21 15:13:09 EST
The patch looks good, but I haven't tested it on my dev box.  I believe we have an event log PHP class that could probably be used to log file additions and deletions, so we can track when these occurred.  What do you think?  I don't have any strong opinions about it.

Otherwise, +1
Comment 7 Kit Lo CLA 2009-01-21 15:58:25 EST
+1
Comment 8 Denis Roy CLA 2009-01-21 16:33:24 EST
callback/getFilesForProject.php was also missing:
AND f.is_active = 1

So all files, even inactive ones, currently show up in the UI for translation.  I've fixed this on staging.
Comment 9 Denis Roy CLA 2009-01-23 10:40:47 EST
The maps processor seems to be removing dead files (as of the revision in the repo) properly.  I just need to make sure the files are not available for translation in the UI.
Comment 10 Denis Roy CLA 2009-03-31 14:51:49 EDT
I think we're done here. I marked a bunch of files as is_active = 0 and they don't show up in the UI, and Antoine has changed the maps processor to mark dead files as inactive.

+1 for closing this FIXED.
Comment 11 Denis Roy CLA 2009-03-31 15:01:38 EDT
I'll also add this trigger, to automatically update the is_active status of strings when we update the is_active status of a file:

SET @OLD_SQL_MODE=@@SQL_MODE;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
DROP TRIGGER IF EXISTS `upd_is_active`;;

/* This trigger will recursively update the is_active status of the strings of a file */   
CREATE TRIGGER `upd_is_active` AFTER UPDATE ON `files` FOR EACH ROW BEGIN
  UPDATE strings set is_active = NEW.is_active WHERE strings.file_id = NEW.file_id;
END;
;;
DELIMITER ;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
Comment 12 Denis Roy CLA 2009-03-31 15:27:38 EDT
Closing as FIXED, and the trigger is running on both the live and staging DB.