|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
cyber Smarty Regular
Joined: 08 Jun 2006 Posts: 51
|
Posted: Mon Jul 13, 2015 6:44 pm Post subject: Migrating from version 2.6.22 to the newest |
|
|
Hi,
I still use version version 2.6.22 which is ancient by now
In fact it still runs under php4 etc.
I need to really really really make some work from upgrading to a new server with php5 etc.
I was wondering what the impact will be ?
Will my old scripts still work or has much changed in this regard ?
My thinking was to do this in 2 steps. First migrate to the new server using the old version ( version 2.6.22 ). But will it work OK under php5 ?
And as a second step, if all works, I would want to update Smarty to the latest and greatest.
Some insights appreciated ! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jul 14, 2015 4:45 pm Post subject: |
|
|
It will work, more or less.
Make migration on a copy of your setup, amend the changes imparted by a new PHP release.
Move your production to a new setup.
Then try moving forward with Smarty 3.
Your mileage may wary.
If you are not using questionable practices and frowned upon functionality, you may have it just work, with a little change here and there.
If you rely heavily on custom plugins and the ability to execute code within template, then you're in for a rough ride. |
|
Back to top |
|
cyber Smarty Regular
Joined: 08 Jun 2006 Posts: 51
|
Posted: Wed Jul 15, 2015 7:56 am Post subject: |
|
|
Thanks.
I tried and immediately ran into this error:
Fatal error: Uncaught --> Smarty: Call of unknown method 'register_prefilter'
I use a prefilter to remove the BOM from pages that happen to have it (since my translators don't always have the tools/knowledge/insight to remove the BOM) |
|
Back to top |
|
cyber Smarty Regular
Joined: 08 Jun 2006 Posts: 51
|
Posted: Wed Jul 15, 2015 8:11 am Post subject: |
|
|
OK, I found that the BOM is now automatically removed, so no need for the prefilter anyway ( http://www.smarty.net/forums/viewtopic.php?p=87302&sid=7f0e937f24465ad26fe2a672a45d3d98 )
I wanted to test the smarty version, since right now I use the code with both a Smarty 2.x and a Smarty 3.x version (hoping the differences won't be too much to handle)
But (using 3.1.17) $smarty-_version doesn't seem to work ?
So I removed the prefilter code entirely, to run into next error:
Fatal error: Uncaught --> Smarty: Call of unknown method 'is_cached'.
is_cached() is called on all my (houndreds of) pages ...
I didn't realize these are all exotic functions and trickery ?
Maybe something else is the matter here ? |
|
Back to top |
|
cyber Smarty Regular
Joined: 08 Jun 2006 Posts: 51
|
Posted: Wed Jul 15, 2015 8:50 am Post subject: |
|
|
Concerning is_cached() I notice there is a replacement function isCached() that works.
This involves changing all files and basically loose compatibility with Smart 2.x (during the migration I hoped to have things running on two servers with same code)
Is there a reason why all this changed ? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Jul 16, 2015 3:55 am Post subject: |
|
|
Coding practices change.
Bad practices die.
Good practices survive.
Method naming was inconsistent and not up to common standards. It was fixed.
You could try SmartyBC class, but I really strongly adwise against that.
You can't have your code "running on two servers", it is not a migration, it is bullshit.
Load your code into a virtual machine with a copy of working environment.
Make necessary changes. Make it work.
Then make a clean machine with a clean copy of your environment and apply your changes there, anew. Test migration. Make changes, if necessary.
Then test again.
Repeat the process until you are certain that everything works right and is not giving you headache.
Then deploy your changes on live server. |
|
Back to top |
|
|
|
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
|