Commit graph

11 commits

Author SHA1 Message Date
umherirrender
2ce8768495 Avoid assignment in return in TemplateParser.php
Hard to read and may misread as boolean return

Change-Id: If6bfdbed7e647dde51db62ae6901874a83682d9e
2015-06-17 22:16:36 +02:00
Kunal Mehta
a9ae91c362 TemplateParser: Use ObjectCache::newAccelerator() with fallback set
Change-Id: I202192f6bf509068941e9490d02a11bdedecd872
2015-03-23 03:34:57 +00:00
Kunal Mehta
2f88829e1b TemplateParser: make most functions protected, only expose processTemplate()
All of the other functions expose internal implementation details, which no
external caller should ever need. In fact, no external caller does use these
functions directly.

The TemplateParser::compile() tests were removed as they're simply just
checking LightnCandy functionality, which is something the library should be
doing.

Change-Id: If9003d40315e0e5aa361c174b764b799e3b88c34
2015-03-22 20:31:59 -07:00
Timo Tijhof
cfcaa33fcc TemplateParser: Don't fatal on cache misses
Also add regression test, and coverage for more methods.

Was trying to eval the code which had the hmac integrity check in front of it,
which causes a syntax error in valid PHP code.

Follows-up db1866da4, 50c50bea2e.

Bug: T93436
Bug: T93511
Change-Id: Ie90074e4885de7340e53f59fdd479f5384b5eac6
2015-03-23 01:38:56 +00:00
kaldari
2a8992a8b9 Make sure template function is callable from processTemplate()
Change-Id: Id9df4062754b02e7217779bc6c0ba42d457e9942
2015-03-20 15:06:59 -07:00
kaldari
a2def8064d Replacing generic Exception with Exception subclasses
Improves ability to debug.

Change-Id: I21a51fc5b4f185a01ba4706bd5a853c2974057dd
2015-03-12 14:31:32 -07:00
kaldari
50c50bea2e If no secret key is available, don't try to use cache
In the unlikely event that no secret key is available, we shouldn't
rely on the cache at all in TemplateParser.

Adding new compileForEval() function and and moving eval() outside
of if statement to prevent code duplication.

Also, if the template fails integrity check, generate a notice
instead of throwing an exception in case we change the secret key.

Change-Id: Id44fdcc9533fc8a9c77e84fcebaa064f602477c6
2015-03-04 09:27:23 -08:00
kaldari
db1866da41 Make sure hash_hmac() always works even if no secret key
Otherwise a fatal error is possible.

Change-Id: Icda96bac3e75f424be068cdad30ad618b503a8e1
2015-02-27 15:36:33 -08:00
kaldari
13aff8aa7c Adding sample code to TemplateParser::processTemplate() docs
Also reverting punctuation that was accidently changed in
change I28cd13d4d.

Change-Id: I1283fbfbaf8cefbbc951599ee286d923b9dedf65
2015-02-20 16:40:31 -08:00
kaldari
7040aeffca Some clean-up of TemplateParser
* Replacing global var with Config
* Fixing spacing
* Adding @since tag

Change-Id: I8b0a35116eef6ecead16e03a3c408081ee500aa6
2015-02-20 10:50:17 -08:00
kaldari
2ec0272218 Adding TemplateParser class providing interface to Mustache templates
The TemplateParser class provides a server-side interface to cachable
dynamically-compiled Mustache templates. It currently uses the
lightncandy library to do compilation (which is already included in
the vendor repo).

Also converting NoLocalSettings.php to use it as a proof-of-concept.

Bug: T379
Change-Id: I28cd13d4d1132bd386e2ae2f4f0d1dd88ad9162b
2015-02-19 17:41:45 -08:00