[bd] Attachment Store for XenForo 2.0 [Paid] 2.1.3

Store attachment differently and more effectively.

  1. Berkin

    Berkin New Member

    @xfrocks Hi, your plugin works great. Thank you.

    But i have a problem with avatars which needs to be solved.

    Normally, i moved my avatars to CDN from command line. Then i put config.php this line;

    $config['externalDataUrl'] = 'https://cdn.otopark.com/forum/data';

    And all of my avatars came back to life. But i realised that (as it supposed) users started having problems with uploading avatar. When i try to upload avatar, i choose my new avatar. Avatar thumbnail flashes but it still showes up the old one. Because it can't upload it (it doesn't have any CDN credentals)

    I deleted this line to solve that problem. And it solved, but all avatars are now routed to normal URL. (ex. https://otopark.com/forum/..... bla bla)

    OTOPARK.COM | Sürücünün Adresi

    OTOPARK.COM Forum araç meraklıları ve kullanıcılarının birbirleriyle etkileşimini sağlayan bir platformdur.
    otopark.com


    I tried to run "Update attachment storage options" and "Move attachment data" that didn't solve that. It looks like plugin doesn't do anything about uploading avatars.

    Is there is any easy way to implement that or do you have any ideas?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @Berkin For avatars, you need to configure this https://xfrocks.com/resources/bd-attachment-store-for-xenforo-2-0.35/update?update=184

      [bd] Attachment Store for XenForo 2.0

      Store attachment differently and more effectively.
      xfrocks.com
       
    2. Berkin

      Berkin New Member

      Berkin @xfrocks Yeah i saw that and added to config php like that;

      $config['fsAdapters']['data'] = function () {
      return \Xfrocks\AttachmentStore\Fs::getAdapterDefault();
      };
      $config['externalDataUrl'] = function ($externalPath, $canonical) {
      return 'https://cdn.otopark.com/' . $externalPath;
      };

      But all avatars gone and when i tried to run attachment move tool it didnt help.

      (Note: For now in website i configured URL as cdn.otopark.com/data because i put my avatars manually to there)

      It looks like there is a thing that i didnt do.
       
    3. Berkin

      Berkin New Member

      Berkin @Berkin @xfrocks Waiting for your response whenever you are available :)
       
  2. vlady

    vlady New Member

    I'm using this addon with DO Spaces and sometimes got an errors like this

    ErrorException: [E_NOTICE] Trying to get property 'bdattachmentstore_engine' of non-object src/addons/Xfrocks/AttachmentStore/XF/ControllerPlugin/Attachment.php:15

    Stack trace
    #0 src/addons/Xfrocks/AttachmentStore/XF/ControllerPlugin/Attachment.php(15): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/nginx/dom...', 15, Array)
    #1 src/XF/Pub/Controller/Attachment.php(43): Xfrocks\AttachmentStore\XF\ControllerPlugin\Attachment->displayAttachment(Object(XF\Entity\Attachment))
    #2 src/addons/Xfrocks/AttachmentStore/XF/Pub/Controller/Attachment.php(16): XF\Pub\Controller\Attachment->actionIndex(Object(XF\Mvc\ParameterBag))
    #3 src/XF/Mvc/Dispatcher.php(321): Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment->actionIndex(Object(XF\Mvc\ParameterBag))
    #4 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Index', Object(XF\Mvc\RouteMatch), Object(Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment), NULL)
    #5 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment), NULL)
    #6 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
    #7 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
    #8 src/XF.php(390): XF\App->run()
    #9 index.php(20): XF::runApp('XF\\Pub\\App')
    #10 {main}

    Request state
    array(4) {
    ["url"] => string(20) "/attachments/655433/"
    ["referrer"] => bool(false)
    ["_GET"] => array(1) {
    ["/attachments/655433/"] => string(0) ""
    }
    ["_POST"] => array(0) {
    }
    }


    How i can fix it?
     
  3. Clive Bailye

    Clive Bailye New Member

    We are upgrading from 1.5 to 2.1 and have upgraded the addon

    We are having the issue that no images show. We are using S3 and Cloudflare as per 1.5. You can upload the images to S3 and this is working.

    However when the images are being displayed in Xenforo there is additional code being added to the end of the attachment URL that is stopping it from working. Can you shed any light on this. Here is the example below:

    Link to Thread:

    http://18.203.48.239/index.php?threads/farmer-roys-random-thoughts-i-never-said-it-was-easy.186684/page-899#post-6070281

    Image link in View Source Code:

    http://18.203.48.239/index.php?attachments/photo-08-11-2015-12-19-06-jpg.775985/

    Image link from Xenforo that is generated:

    http://d21zkh06156iu1.cloudfront.net/2019/04/777339_7a16d2b74842f38c056a9707391fd63f.jpg?Expires=1556178988&Signature=CcSDnE0iNXqkkNJWY4Ch8SgwnBSGgGSbQzTEE5fRxMPgFlTlSoPax6ffQVzPSKVV4Gr49gNBWg3dJFE3NV0jW9XMIy~bGggHQCCez~TijDIdBSkO~tOdVyJJjCa-vObKezt-5NZ9xi5TuT-ijTVoEYVSG~gpUAXs6EqN6SYY3hTmAhbLRY9uQCCXsSPFjVQIPGucDCR~WJWq2WAj2ij1gb9siHenikuev3Ztjg6-3MtOTa8TVgJ-uZ90kdcXlkN0AUNIv5RxIYjR5fxC9UzHxgtqQ3V6ePSSjU~MMqfA8JOHUG9Z1-gqmf3UmSkOGGHMis3VShP5IN9l~Dt503s-Gw__&Key-Pair-Id=APKAI3FUQAMYQSG3SXKQ

    Image on Cloudfront that works:

    http://d21zkh06156iu1.cloudfront.net/2019/04/777339_7a16d2b74842f38c056a9707391fd63f.jpg

    Why and where is everything after the "?" being added?
     
  4. Kent D

    Kent D New Member

    hop you update the guide full data with config.php
     
  5. fly

    fly New Member

    If we do full data, do we have to copy everything over? I agree that an updated guide would be helpful.
     
  6. tohaitrieu

    tohaitrieu New Member

    Too many errors:
    Code:
    InvalidArgumentException: Credentials must be an instance of Aws\Credentials\CredentialsInterface, an associative array that contains "key", "secret", and an optional "token" key-value pairs, a credentials provider function, or false. src/addons/Xfrocks/AttachmentStore/vendor/aws/aws-sdk-php/src/ClientResolver.php:414
    Generated by: Unknown account 20/05/2019, lúc 07:10
    
    #0 src/addons/Xfrocks/AttachmentStore/vendor/aws/aws-sdk-php/src/ClientResolver.php(291): Aws\ClientResolver::_apply_credentials(Array, Array, Object(Aws\HandlerList))
    #1 src/addons/Xfrocks/AttachmentStore/vendor/aws/aws-sdk-php/src/AwsClient.php(158): Aws\ClientResolver->resolve(Array, Object(Aws\HandlerList))
    #2 src/addons/Xfrocks/AttachmentStore/vendor/aws/aws-sdk-php/src/S3/S3Client.php(263): Aws\AwsClient->__construct(Array)
    #3 src/addons/Xfrocks/AttachmentStore/Fs.php(316): Aws\S3\S3Client->__construct(Array)
    #4 src/addons/Xfrocks/AttachmentStore/Fs.php(345): Xfrocks\AttachmentStore\Fs::getAdapterObj('s3', Array)
    #5 src/addons/Xfrocks/AttachmentStore/Fs.php(201): Xfrocks\AttachmentStore\Fs::registerIfNeeded('s3', Array)
    #6 src/addons/Xfrocks/AttachmentStore/Data/Storage.php(59): Xfrocks\AttachmentStore\Fs::buildPath('s3', Array, '2019/04/340_5f4...')
    #7 src/addons/Xfrocks/AttachmentStore/XF/Entity/AttachmentData.php(25): Xfrocks\AttachmentStore\Data\Storage->getAbstractedPathReplacement(Object(Xfrocks\AttachmentStore\XF\Entity\AttachmentData), '2019/04/340_5f4...', 'internal-data:/...')
    #8 src/XF/Entity/AttachmentData.php(217): Xfrocks\AttachmentStore\XF\Entity\AttachmentData->getAbstractedDataPath()
    #9 src/XF/Mvc/Entity/Entity.php(1580): XF\Entity\AttachmentData->_postDelete()
    #10 src/XF/Repository/Attachment.php(320): XF\Mvc\Entity\Entity->delete()
    #11 src/XF/Cron/CleanUp.php(120): XF\Repository\Attachment->deleteUnusedAttachmentData()
    #12 [internal function]: XF\Cron\CleanUp::runHourlyCleanUp(Object(XF\Entity\CronEntry))
    #13 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
    #14 src/XF/Job/Manager.php(253): XF\Job\Cron->run(G)
    #15 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
    #16 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
    #17 job.php(42): XF\Job\Manager->runQueue(false, 8)
    #18 {main}
     

    Attached Files:

  7. vitoreis

    vitoreis New Member

    Where are "Update attachment storage options" and "Move attachment data" at this version?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @vitoreis They are in AdminCP > Tools > Data maintenance > Rebuild Caches.
       
      vitoreis likes this.
      1
  8. W.D

    W.D New Member

    Bought this as it said FTP we assumed it would cover both FTP & SFTP, but I use SFTP (FTP is disabled on my dedicated servers for security reasons) sadly it isn't working and produces server errors.

    Is there a way to enable it to use SFTP? (Port 22)

    The server logins are valid, ports were set and file paths etc, chmod 777 on remote data folder too. Is there a way to fix this please?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @W.D No, ftp and sftp are two different protocols (despite the similarity in their names). We do not support sftp at the moment.
       
  9. fly

    fly New Member

    I attempted to use the cache rebuild tool to move everything back locally and it appears to have broken all attachments. The attachments are still referencing the CloudFront URL, which no longer works. Suggestions on how to fix this ASAP please?
     
    1. vitoreis

      vitoreis New Member

      vitoreis @fly Where are "Update attachment storage options" and "Move attachment data" on XF2?
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @fly Did the tool run to completion? Anything in the server error log?
       
  10. joec

    joec New Member

    Are there any plans to include Google Cloud support?
     
    zig likes this.
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @joec It's fairly simple to add support for GCS but it will increase the add-on package download size. If there is demand we will certainly do it though.
       
      zig likes this.
      1
    2. joec

      joec New Member

      joec @xfrocks I'd be quite excited if GCS support is added, for sure.
       
      zig likes this.
      1
    3. joec

      joec New Member

      joec @xfrocks What kind of time do you think it would take to implement GCS support?
       
      zig likes this.
      1
    4. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @joec Just FYI, I have replied to your colleague via email regarding the upload error.
       
  11. killyp

    killyp New Member

    When uploading an mp4 the file never gets copied over to S3 or removed from the local /data/videos directory. Also, when I delete the video from the admin "Attachment Browser" the file remains on disk.
     
  12. dakis

    dakis New Member

    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @dakis Post 2455869 doesn't seem to have any attachment? Can you double check?
       
    2. dakis

      dakis New Member

      dakis @xfrocks I ended up uploading all the missing attachments from my backup. I do not know why this happened but I have one more forum to upgrade and I do not want to have the same issue, do you know what may have caused this ?
       
    3. dakis

      dakis New Member

      dakis @xfrocks Unfortunately it's more than 50gb, not sure how easy it will be to do that.
       
    4. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @dakis 50GB is not too big, I will create a new server on Digital Ocean with 4vCPU, 8GB RAM, 160GB SSD for you.
       
      dakis likes this.
      1
  13. fmsc88

    fmsc88 New Member

    Hello there,
    I'm doing some tests before upgrading my forum from 1.5.x to 2.1.x.

    Upgraded to 2.1.3, uploaded the addon for xf 2 and worked perfect from start.Had the settings ready from the main installation.


    I see many users here having issues with this add-on, what the hell. I never had any issue with the addon. i'm using it 2 years and never had issue :)


    At this post i want to ask the same thing i did for xf 1.5 January 10, 2018 https://xfrocks.com/other/threads/bd-attachment-store-for-xenforo-1-paid.58/page-26#post-5814

    How i can do this for xf 2.1.x please? Like i said i don't have any issue and never had. I just don't remember how do we made it work for xf 1.5.

    My question:
    One thing I would like to know is if there any way to preserve the filenames of the files i download from S3, so instead of having a filename composed by ID_HASH.zip to have the OriginalName.zip. Is there any option or configuration of the module that allows this or can it be done via code?
     
    1. fmsc88

      fmsc88 New Member

      fmsc88 C'mon please tell me how i can do that,everything works perfect. The only issue i have is when i download resource to my pc it's named
      Code:
      19200_a911d84966f2f10bc5d70b69dad68ac0.zip
      For xf 1 works fine,the zip file has the correct name when i download resource to my pc.
      I'm preparing to update to xenforo 2.1 and this is the only thing stoping me to do so.
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @fmsc88 Looks like there is a bug with that feature (keeping file name in S3) in the XF2 version. We will attempt a fix and release a new version to address it.
       
      fmsc88 likes this.
      1
    3. fmsc88

      fmsc88 New Member

      fmsc88 @xfrocks Any update please?
       
    4. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @fmsc88 v2.0.2 has just been released with the fix for this. Please try upgrading and see whether it works for you. Sorry for the inconvenience.
       
      fmsc88 likes this.
      1
    5. fmsc88

      fmsc88 New Member

      fmsc88 @xfrocks works works works,thank you very very very much!
       
      xfrocks likes this.
      1
  14. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    RoldanLT likes this.
    1. vlady

      vlady New Member

    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @vlady Your stack trace is similar to this?

      Code:
      #0 src/addons/Xfrocks/AttachmentStore/XF/ControllerPlugin/Attachment.php(15): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/nginx/dom...', 15, Array)
      #1 src/XF/Pub/Controller/Attachment.php(43): Xfrocks\AttachmentStore\XF\ControllerPlugin\Attachment->displayAttachment(Object(XF\Entity\Attachment))
      #2 src/addons/Xfrocks/AttachmentStore/XF/Pub/Controller/Attachment.php(16): XF\Pub\Controller\Attachment->actionIndex(Object(XF\Mvc\ParameterBag))
      #3 src/XF/Mvc/Dispatcher.php(321): Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment->actionIndex(Object(XF\Mvc\ParameterBag))
      #4 src/XF/Mvc/Dispatcher.php(244): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Index', Object(XF\Mvc\RouteMatch), Object(Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment), NULL)
      #5 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Xfrocks\AttachmentStore\XF\Pub\Controller\Attachment), NULL)
      #6 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
      #7 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
      #8 src/XF.php(390): XF\App->run()
      #9 index.php(20): XF::runApp('XF\\Pub\\App')
      #10 {main}
       
    3. vlady

      vlady New Member

      vlady @xfrocks @xfrocks ,exactly
       
  15. RoldanLT

    RoldanLT Active Member

    Seems to be a bug with the recent update?
    Code:
    Server error log
    RuntimeException: find '' -type f > '/home/nginx/domains/domain.com/public/internal_data/temp/attachMover20190904_iSIAyY' src/addons/Xfrocks/AttachmentStore/Service/Mover.php:42
    Generated by: Unknown account Sep 4, 2019 at 11:37 AM
    
    Stack trace
    #0 src/addons/Xfrocks/AttachmentStore/Job/Move.php(53): Xfrocks\AttachmentStore\Service\Mover->backupPathPrepare(NULL)
    #1 src/XF/Job/Manager.php(253): Xfrocks\AttachmentStore\Job\Move->run(15)
    #2 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, 15)
    #3 src/XF/Job/Manager.php(146): XF\Job\Manager->runJobEntry(Array, 15)
    #4 src/XF/Cli/Command/JobRunnerTrait.php(30): XF\Job\Manager->runUnique('Xfrocks\\Attachm...', 15)
    #5 src/XF/Cli/Command/JobRunnerTrait.php(13): Xfrocks\AttachmentStore\Cli\Command\Move->runJob('Xfrocks\\Attachm...', NULL)
    #6 src/addons/Xfrocks/AttachmentStore/Cli/Command/Move.php(57): Xfrocks\AttachmentStore\Cli\Command\Move->setupAndRunJob('Xfrocks\\Attachm...', 'Xfrocks\\Attachm...', Array)
    #7 src/vendor/symfony/console/Command/Command.php(255): Xfrocks\AttachmentStore\Cli\Command\Move->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #8 src/vendor/symfony/console/Application.php(960): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Xfrocks\AttachmentStore\Cli\Command\Move), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #10 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 cmd.php(15): XF\Cli\Runner->run()
    #13 {main}
    
    Request state
    array(1) {
      ["cli"] => string(69) "/home/nginx/domains/domain.com/public/cmd.php attachment-store:move"
    }
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @RoldanLT Yes, if you need to run the move cli right away. Please use this beta https://www.dropbox.com/s/6e92b08qjjbwfvm/Xfrocks-AttachmentStore-20.0.3 Beta 3.zip?dl=0
       
      RoldanLT likes this.
      1
  16. RoldanLT

    RoldanLT Active Member

    I just moved 450k+ images using this addon to /data/attachment-files/ directory.
    (without Maintain File Name option check).
    So my 450k+ images are filename as: {data_id}_{file_hash}.{extension}

    Now I just enable "Maintain File Name"
    as I want all images to have this filename: {data_id}_{name}.{extension}

    How can I update old images on /data/attachment-files/ to have the new file name?
    I've run the Move Tool, but it doesn't change old files.

    Thanks a lot Sir.
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @RoldanLT Ah, I have just replied you on xenforo.com.

      > The safest way is to switch back to Default, run the move tool, then switch to external data (with maintain filename) and run the move tool.
       
      RoldanLT likes this.
      1
    2. RoldanLT

      RoldanLT Active Member

      RoldanLT @xfrocks Last time I do this makes some Gallery Images missing (I have to delete).
       
    3. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @RoldanLT That sounds like a bug... If you happen to do something similar again, please let me know so I can pin point the issue (and hopefully fix it).
       
  17. RoldanLT

    RoldanLT Active Member

    Bug?
    Attachment are still downloadable by Guest user even if it's on the "Ignored Extensions" list?
     
    1. RoldanLT

      RoldanLT Active Member

      RoldanLT @RoldanLT View attachments to posts for Guest is set to NO.
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @RoldanLT Can you share the attachment link?

      Screenshot of the ignored list should be useful too.
       
  18. xfrocks

    xfrocks XenForo rocks!
    Staff Member

Loading...