nilsteampassnet/TeamPass — pull request #805 by gooseleggs (2014-11-29 07:13:49+00:00)
Title: Keepass Import improvements

Had some issues importing my Keepass file (v2) from work. Lots of issue, but have resolved them here, and also done some performance improvements and other enhancements. One of the changes is a fundamental change (new pbkdf2 function) but the speedup is huge for me - went from importing 100 entries per minute to around 1300. I have done some testing and appears backward compatible.

Question: What is your preferred method of adding strings to the language files? - just add them to English and you upload to poeditor and them automagically copy to the other files?

FIXES
- Fix actually delete working files when finished
- Change keepass import to only display stats of import (was finishing script but not updating display due to text being too long?)
- Create function sanitizeString to encode strings similar to JavaScript code. This enables correct encoding of \, for example (maybe move this routine to main.functions.php?)
- If import has blank password, false is displayed instead of a blank password - issue with display, not import - fixed in API code as well
- Cannot import different file after completed import once without full refresh (f5) of home page
- Fix where keepass file has multiple levels (would just silently fail and never complete)
- Tell script to never time out such that large files can be imported without exceed execution timelimit.

IMPROVEMENTS
- Change pbkdf2 function as more effecient (ie faster ~13x with importing)
- Keepass import creates log file in FILES/ directory with detailed logs
- second Pbkpdf function in functions.php - uses updated function
- Display a link to log file after import finished
- Modify order of fields in keepass temp files incase entry longer than max bytes read per line - make Notes field last field
- Increase max number of bytes read per line from 4k to 8k ( yes, I had some entries that were longer than the 4k read buffer!)
- Added indexes onto tables related to import to improve import speeds (may assist elsewhere)