Commit Graph

7 Commits

Author SHA1 Message Date
stronk7 081a63a9eb MDL-19579 code coverage - add more initial $includecoverage attributes 2009-06-26 17:49:15 +00:00
tjhunt 88b02e3b22 Remove experimental part of string_manger. Also, improve class comment. 2009-06-25 04:02:36 +00:00
tjhunt 64208b5de5 MDL-16438 fix string manager unit tests. 2009-06-22 06:03:53 +00:00
tjhunt 7e3a668c07 get_string unit tests: Switch to inline fixture setup 2009-04-10 04:59:09 +00:00
tjhunt 5c2fec8b74 get_string: MDL-18813 get_string was broken for strings that were '' 2009-04-08 11:45:53 +00:00
tjhunt e7b818807c get_string: MDL-13816 allow third-partly modules to register sub-plugin types that have their own lang files.
I suppose to be really useful we should deal with database, capabiltities, etc. too in due course. Still, this is a start.
2009-03-30 06:13:35 +00:00
tjhunt bb45fe62c4 get_string: Refactoring, performance improvements, bug fixes and unit tests
MDL-18669 get_string refactored to elimiate duplicate code and make it easier to understand.
MDL-17763 parent language not processed correctly when getting a plugin string.
MDL-16181 more intelligent caching to avoid repeated file_exists checks.
MDL-12434 move values to array keys to improve lookup times.

The main part of the refactoring is to create a singleton string_manager class to encapsulate the cached data and the processing, while breaking the code up into more smaller methods.

Other performance improvements include:
* Cache results of plugin name -> locations to search array.
* Cache parent lang lookup.
* Skip eval if the string does not contain $ \ or %.
* Remove the unnecessary sprintf from the eval.

There is a performance testing script in lib/simpletest/getstringperformancetester.php. For now this script has the old get_string implementation copied and pasted to the end, and renamed to old_get_string to allow for comparitive timings.

There are now some unit tests for get_string in lib/simpletest/teststringmanager.php. I think I have managed to cover most of the tricky cases.
2009-03-30 02:21:27 +00:00