Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

PhPBB3 Attachements

piotrnlpiotrnl New
edited October 2014 in Vanilla 2.0 - 2.8

Hi,

Can I import PhPbb3 attachments ? The documentation mentions the FileUpload plugin. I've installed the plugin and did a test import. Import finishes w/o errors but I don't see attachments (or dead links to attachments).

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Welcome to the community!

    What version of the porter are you using? What version of Vanilla are you using?

    According to the documentation:

    phpBB file attachments can be renamed using utilities/phpbb.extensions.php in the GitHub project.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • piotrnlpiotrnl New
    edited October 2014

    Vanilla 2.1 & Porter 2.0. I've used the phpbb.extensions.php to rename the files. Now Export, Import ? Or Import, rename ?

    Ps: I had to edit phpbb.extensions.php because it generated errors. This worked for me:

    `<?php

    // Show errors

    error_reporting(E_ALL);

    ini_set('display_errors', '1');

    // Add your database connection info here.
    $con=mysqli_connect("localhost","db_user","db_password","db_name");

    // Absolute path to the folder you're importing.

    $Directory = '/home/vhosts/domain/httpdocs/phpbb/files/';

    // No more editing!

    // Select attachments
    mysqli_select_db($con,"db_name");
    $Results = mysqli_query($con,"select physical_filename as name, extension as ext from phpbb_attachments");

    // Iterate thru files based on database results and rename.
    $Renamed = $Failed = 0;
    while ($Row = mysqli_fetch_array($Results)) {
    if (file_exists($Directory.$Row['name'])) {
    rename($Directory.$Row['name'], $Directory.$Row['name'].'.'.$Row['ext']);
    //echo ('$Row');
    $Renamed++;
    }
    else {
    $Failed++;
    }
    }

    // Results
    echo 'Renamed '.$Renamed.' files. '.$Failed. ' failures.';
    `

  • peregrineperegrine MVP
    edited October 2014

    I haven't used it. but according to docs

    http://docs.vanillaforums.com/developers/importing/porter/

    Notes
    You can port your attachments over to Vanilla 2. To do this you must enable the File Upload plugin before >importing your data. You them must copy them to Vanilla 2's uploads folder.

    you might make sure you use a File Upload plugin that is compatible with version 2.1.

    you could test it in vanilla prior to importing and then delete what you have done.

    since this is vanilla 2.1 related it might be moved to the correct category vanilla 2.1 NOT vanilla 2.0

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • piotrnlpiotrnl New
    edited October 2014

    Ok, I'm almost there. What I did:

    • Installed FileUpload plugin
    • Applied update to the FileUpload plugin (see zip elswhere on the forum)
    • Edited the phpbb.extensions.php and tested it. (see above)
    • Renamed all the (extension less) original files in the SOURCE (/phpbb/files) with phpbb.extensions.php (checked, worked) they all have the correct extension now: .png, .jpg, .pdf etc.
    • Performed Export from PHPBB3
    • Performed Import
    • Tested, everything works
    • BUT: attachments are added to the posts with their original (without extension) filename.

    Any clues ?

    Another thought: images show up as attachment (icon), clicking the icon gives the opportunity to place the attachment in the post. I have 1200+ attachments on my forum. Any chance to do this scripted ? I know sql, i know a little php.

    Any help appreciated.

  • peregrineperegrine MVP
    edited October 2014

    BUT: attachments are added to the posts with their original (without extension) filename.

    no sure what you are looking for. do you want all images inserted into the post body, this seems unnecessary and extra overhead.

    or is there a problem when you click on attachment and don't see the image. does the thumbnail show the image?

    can you post a screenshot of what you have and what you would like.

    :BUT: attachments are added to the posts with their original (without extension) filename.

    that seems like a bug to me. @linc

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Ok, done. Needed to some things by hand but the procedure described above works.

    After the import you need to add the file-extension to the path of file by hand:

    UPDATEGDN_MediaSETPath= CONCAT (path, '.jpg') WHERE Name Like '%.jpg'
    Do this for all your file types.

    @peregrine: Attachments, in my case mostly pictures, are shown as attachment thumbnail with an "insert image" option. Would be nice to have a query to do this for all attachments of type jpg/png/gif. I'll look into it.

Sign In or Register to comment.