How to recompile templates programatically [Deleted]

Rigel Kentaurus

Well-known member
Rigel Kentaurus submitted a new resource:

How to recompile templates programatically (version 1.0.0) - How to recompile templates programatically

The following code snippet will "force" to recompile all templates

Code:
    $t = new XenForo_Model_Template();
    $t->compileAllTemplates();

If you just need to run it for whatever reason you could add it in index.php just before fc->run() (or create a separate file, or add it to a code event)

Read more about this resource...
 
This may cause timeouts because templates expected to be recompiled by small chunks.
That's why compileAllTemplates has arguments $maxExecution = 0, $startStyle = 0, $startTemplate = 0
You can always add

Code:
@set_time_limit(0);

to the top of the script. Won't work in safe mode, of course.

I was developing something that seriously messed up with the compiled templates, and I needed to recompile them.
The templates are already recompiled if an add-on is installed anyway, so this is not really needed in those scenarios.
 
If the install directory is still in place you can also go there to rebuild all the caches if needed.
 
If the install directory is still in place you can also go there to rebuild all the caches if needed.
Even thought it isn't technically required to remove the install directory, I would encourage anyone to delete it, rename it, or at least password protect it. If one day there is any kind of bug related to access to the installer, there should not be a tool in place to wipe your forum installation. The install-lock.php protection file is a weak mechanism for my tastes, and I certainly feel more secure wiping the whole thing out, especially when it is certainly not needed.
 
Even thought it isn't technically required to remove the install directory, I would encourage anyone to delete it, rename it, or at least password protect it. If one day there is any kind of bug related to access to the installer, there should not be a tool in place to wipe your forum installation. The install-lock.php protection file is a weak mechanism for my tastes, and I certainly feel more secure wiping the whole thing out, especially when it is certainly not needed.
Yep agreed. Password protection should be what people choose. Also adding it to the ACP as well. I'll be working on DevTools soon (extending what I already made) to make add-on development much less frustrating in areas and to also auto build packages with build steps etc likea compiled language so you can auto generate file hashes, integrate with VCS etc. I'll post what I have privately on XenForo once I have time.
 
This was the author's choice. (The housekeeping refers only to paid resources for any "automated" process.)
 
Back
Top Bottom