1. 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?

Discussion in 'XenForo Development Discussions' started by Marcus, Aug 16, 2014.

  1. Marcus

    Marcus Well-Known Member

    I wonder what is the difference between these directories?

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

    Brogan XenForo Moderator Staff Member

    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 likes this.
  3. Marcus

    Marcus Well-Known Member

    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.
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    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 and Brogan like this.
  5. Marcus

    Marcus Well-Known Member

    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 :)
     
  6. Marcus

    Marcus Well-Known Member

    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.
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    I don't think it's possible to extend that class.
     
    Marcus likes this.
  8. Marcus

    Marcus Well-Known Member

    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.
     

Share This Page