Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

BC Checker

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
Synchro
Smarty Regular


Joined: 27 Apr 2008
Posts: 43

PostPosted: Tue Feb 07, 2012 11:06 am    Post subject: BC Checker Reply with quote

I've just been doing a big migration from Smarty 2 to 3. As a companion to the SmartyBC wrapper class, I've written a little shell script that checks a directory (recursively) for uses of the old-style names so that they can be fixed properly without having to resort to the BC class. All I did was take the function names defined in SmartyBC and grep for them, however it proved pretty useful so I though others might like it, might be nice to include it in the source bundle.

Code:

#!/bin/sh

egrep -R "\b(assign_by_ref|append_by_ref|clear_assign|register_function|unregister_function|register_object|unregister_object|register_block|unregister_block|register_compiler_function|unregister_compiler_function|register_modifier|unregister_modifier|register_resource|unregister_resource|register_prefilter|unregister_prefilter|register_postfilter|unregister_postfilter|register_outputfilter|unregister_outputfilter|load_filter|clear_cache|clear_all_cache|is_cached|clear_all_assign|clear_compiled_tpl|template_exists|get_template_vars|get_config_vars|config_load|get_registered_object|clear_config|trigger_error|smarty_php_tag)\b" $1/*

I saved that as 'smbc.sh' and call it like this:
Code:
./smbc.sh <path to code dir>

It might be useful to do something similar for properties - I had quite a few instances of looking at $this->_tpl_vars, which is no longer there.

Note that I needed to do this on OS X 10.7 in order to fix grep.

As an aside, I'm finding that the change from Smarty 2.6.26 to 3.1.7 resulted in an overall slowdown of about 15% (I profiled rendering of 500 templates using xdebug). For me this is outweighed by the increased functionality, particularly blocks, but it's a shame after all the good things I'd read! On the upside, the call trees you get in 3.1.7 are so much more sane!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP