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

XF 1.3 Custom database migration

Discussion in 'Installation, Upgrade, and Import Support' started by Fab, Jun 12, 2014.

  1. Fab

    Fab Member

    I have a custom forum with a custom database structure that i want to migrate to Xenforo with a python script.
    I managed to transfer users, profiles, posts, nodes, ... and everything went well except for two things.

    Attachments
    1. What is the proper way to generate the file_hash value that will be used in attachment_data.file_hash and in the name of the file?
    2. Is the correct filename format <attachment_data.data_id>-<file_hash>.data ? What about the content of the file, is it changed before being saved?
    User to admin

    In ACP > Users > Admin, there ain't no users, even though i'm super admin. When i try to change a user to admin, the user still can't connect to the ACP and the Admin page is still empty.

    Any help would be welcome
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    1) file_hash is a md5 of the file data.

    2) Correct.

    library/XenForo/Model/Attachment.php

    Code:
    	/**
    	 * Gets the full path to this attachment's data.
    	 *
    	 * @param array $data Attachment data info
    	 * @param string Internal data path
    	 *
    	 * @return string
    	 */
    	public function getAttachmentDataFilePath(array $data, $internalDataPath = null)
    	{
    		if ($internalDataPath === null)
    		{
    			$internalDataPath = XenForo_Helper_File::getInternalDataPath();
    		}
    
    		return sprintf('%s/attachments/%d/%d-%s.data',
    			$internalDataPath,
    			floor($data['data_id'] / 1000),
    			$data['data_id'],
    			$data['file_hash']
    		);
    	}
    
    	/**
    	 * Gets the full path to this attachment's thumbnail.
    	 *
    	 * @param array $data Attachment data info
    	 * @param string External data path
    	 *
    	 * @return string
    	 */
    	public function getAttachmentThumbnailFilePath(array $data, $externalDataPath = null)
    	{
    		if ($externalDataPath === null)
    		{
    			$externalDataPath = XenForo_Helper_File::getExternalDataPath();
    		}
    
    		return sprintf('%s/attachments/%d/%d-%s.jpg',
    			$externalDataPath,
    			floor($data['data_id'] / 1000),
    			$data['data_id'],
    			$data['file_hash']
    		);
    	}
    
    The content is just the raw file data.
     
  3. Fab

    Fab Member

    Thank you!

    What about the admin problem please? "In ACP > Users > Admin, there ain't no users, even though i'm super admin. When i try to change a user to admin, the user can't connect to the ACP and the Admin page is still empty."
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yours is a custom import so I can only provide general information about user accounts.

    In terms of database records, every user is required to have a record in each of these tables:

    xf_user
    xf_user_authenticate
    xf_user_option
    xf_user_privacy
    xf_user_profile


    Regarding admin access, this might help:

    http://xenforo.com/community/thread...min-password-through-mysql.20494/#post-262022
     

Share This Page