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

Difference data/attachments and internal_data/attachments?

Marcus

Well-known member
#1
I wonder what is the difference between these directories?

And how could I move everything from internal_data/attachments to data/attachments?
 

Brogan

XenForo moderator
Staff member
#2
The /data directory is public and contains the thumbnails.

The /internal_data directory is permission controlled and contains the full size images.

Why would you want to move everything from one to the other?
 

Marcus

Well-known member
#3
Thanks for explaining the difference. I would like to make use of xenforos feature to put file data on an external location. I currently put data and internal_data to another server. The problem is that xenforo stores "Fetch template as public files" data also on internal_data/templates. And this does not work, even the files are 100% identical to the local ones, xenforo does not parse them right. I just got another answer telling me that this configuration would slow down my forum a lot. So I guess having the data on another "data server" like Amazon Cloud is a secure setting. Having server sensitive precompiled php statements on that same remote server is not really a good idea.
 

Chris D

XenForo developer
Staff member
#4
The path can actually be changed with a simple code edit.

XenForo_Template_FileHandler::__construct()

PHP:
$this->_path = XenForo_Helper_File::getInternalDataPath() . '/templates';
I can't say I'm 100% sure because it's been a while since I looked at it; but I'm pretty sure that's the only place it needs to change; because any interaction with the template files is done through that class and uses that path as the base path for all template files. Changing that, moving it outside of internal_data should do the trick.
 

Marcus

Well-known member
#5
Thanks Chris D! It looks like I will have to reinstall phpstorm and read through xenforos code. The last addon I created with "cat >", it worked great but it's not that comfortable :)
 

Marcus

Well-known member
#6
The path can actually be changed with a simple code edit.

XenForo_Template_FileHandler::__construct()

PHP:
$this->_path = XenForo_Helper_File::getInternalDataPath() . '/templates';
I can't say I'm 100% sure because it's been a while since I looked at it; but I'm pretty sure that's the only place it needs to change; because any interaction with the template files is done through that class and uses that path as the base path for all template files. Changing that, moving it outside of internal_data should do the trick.
That works perfect! I am now curious how I could extend the __construct() function without doing a file edit. https://xenforo.com/community/threads/extending-xenforo_template_filehandler.88825/ There are template helpers available, but I guess I can not modify the __construct() function with it.
 

Marcus

Well-known member
#8
Thanks! I tried for hours finding a way around it. Then I guess I just write a short bash script that I execute after each upgrade.

XenForo works in general even with internal_data located within other networks, you would have to tell php to
allow_url_fopen and allow_url_include, but it's not stored within the opcache so it takes forever for pages to load.

So I guess when you put the data not directly on the server where xenforos logic is executed, you either put data and internal_data into the database which is also maybe rather complicated, or you manually edit this class after each upgrade.