• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Allow exec() to run on XenForo_Template_FileHandler::_destruct()

digitalpoint

Well-known member
#1
It would be really nice if the XenForo_Template_FileHandler class had a __destruct() method that could trigger an exec() command.

More or less any time that class is used, it's writing or deleting templates stored in the file system... Now if you have multiple web servers running, you want those new template files to be written to all web servers.

Right now I added the following __destruct() method, but it would be nice if you could just define a command in the options and not have to hack on the files.

PHP:
	public function __destruct()
	{
		exec('sudo /usr/sbin/csync2 -x');
	}
There are of course other ways to do this (a NAS system, lsyncd to monitor for file changes automatically, etc.) but I won't get into the reasons I'm not using those options. :)
 

digitalpoint

Well-known member
#2
BTW - this didn't work so great when live. lol... was calling csync2 every page view since that class does things like figure out the file name of a template. Needed to make it a little more selective. lol
 

Chris D

XenForo developer
Staff member
#3
BTW - this didn't work so great when live. lol... was calling csync2 every page view since that class does things like figure out the file name of a template. Needed to make it a little more selective. lol
Crap! When did you go live on XF! I had no idea! :D

Very happy :)
 
#11
Not really... trying to figure out how to make it faster actually. lol
Noticed same, the vBulletin 4 forum before was running faster. Could tell right away visiting and browsing around, but expect you'll sort that out later, you've only just installed it.

Well done on finally converting over though, Internet Brands will love you now... not.