[bd] Attachment Store for XenForo 1 [Paid] 1.3.7

Store attachment differently and more effectively.

  1. rsi

    rsi New Member

    Hello,

    Have you had a chance to look at this? See the previous post below that was posted on XenForo's Site.

    I'm trying to figure out why when I go to run the Rebuild Attachment Thumbnails from the XenForo ACP the files that were ftp'ed using this [bd] Attachment Store [Paid] add-on want to login using the old ftp username that was somehow stored to the files when they were uploaded using this add-on?

    It may just be a bug since I updated to XenForo v1.57 two days ago and the add-on just needs to be updated, but if not then this is going to be a real problem for anyone who moves their website to another server where their ftp account username and password changes.

    Whichever it is I need a way to fix this. Either with an update to this add-on, or instructions by you posting a query to run to do a username find and replace or something similar including the same for any stored password if it also exists.

    Please let me know...

    Thanks

    --------------------------------------

    PREVIOUS POST

    Hi, I have a real problem. I moved my website and the database to another server and when I try to run the Rebuild Attachment Thumbnails in the ACP tool menu I get the error below.

    XenForo_Exception: Thumb rebuild for #2997: Unable to login to mydomain.com (user=oldusername) - library/bdAttachmentStore/Model/File.php:334

    Somewhere my old ftp username on the old server has been linked or stored with those files and on the new server with my new ftp username it tries to somehow log on (I think) with that old username and after is does it several times my hosting company blocks my ip address because of the repeated failed login attempts. I have my new username all configured properly in the add-on's settings, but the old files from the old server are still somehow linked to my old ftp username from the old server.

    I can search my database using phpMyAdmin and can find my old username listed a few thousand times in the xf_attachment_data table, but how do I correct it? I cannot actually see that old username listed in the table rows anywhere.

    I also just updated to xenforo v1.57 today as well so I’m not sure if that is the real problem, but how can I correct the old user name stored to those files and change it to my new username if necessary? Is there some query I can run? I need to fix this.

    Please look into what is happening and let me know how to fix it. I’m not sure if the old ftp username stored to those files is the problem, but it might be. If it’s not, then it is because something has now changed with xenforo v1.57

    Stack Trace below…

    #0 /home/newusername/public_html/library/bdAttachmentStore/Model/File.php(394): bdAttachmentStore_Model_File->_ftp_connect(Array)

    #1 /home/newusername/public_html/library/bdAttachmentStore/Model/File.php(29): bdAttachmentStore_Model_File->_ftp_saveFile(Array, '/home/newusername/...', '2016/03/2977_66...', 'IMG_0337.JPG')

    #2 /home/newusername/public_html/library/bdAttachmentStore/XenForo/DataWriter/AttachmentData.php(133): bdAttachmentStore_Model_File->saveFile('ftp', Array, '/home/newusername/...', '2016/03/2977_66...', 'IMG_0337.JPG')

    #3 /home/newusername/public_html/library/bdAttachmentStore/XenForo/DataWriter/AttachmentData.php(145): bdAttachmentStore_XenForo_DataWriter_AttachmentData->_writeAttachmentFile('/home/newusername/...', Array, true)

    #4 /home/newusername/public_html/library/XenForo/DataWriter/AttachmentData.php(167): bdAttachmentStore_XenForo_DataWriter_AttachmentData->_writeAttachmentFileData('\xFF\xD8\xFF\xE0\x00\x10JFIF\x00\x01\x01\x00\x00...', Array, true)

    #5 /home/newusername/public_html/library/bdAttachmentStore/XenForo/DataWriter/AttachmentData.php(55): XenForo_DataWriter_AttachmentData->_postSave()

    #6 /home/newusername/public_html/library/XenForo/DataWriter.php(1423): bdAttachmentStore_XenForo_DataWriter_AttachmentData->_postSave()

    #7 /home/newusername/public_html/library/XenForo/Deferred/AttachmentThumb.php(67): XenForo_DataWriter->save()

    #8 /home/newusername/public_html/library/bdAttachmentStore/XenForo/Deferred/AttachmentThumb.php(11): XenForo_Deferred_AttachmentThumb->execute(Array, Array, 7.9999980926514, '')

    #9 /home/newusername/public_html/library/XenForo/Model/Deferred.php(295): bdAttachmentStore_XenForo_Deferred_AttachmentThumb->execute(Array, Array, 7.9999980926514, '')

    #10 /home/newusername/public_html/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 7.9999980926514, '', false)

    #11 /home/newusername/public_html/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)

    #12 /home/newusername/public_html/library/XenForo/ControllerAdmin/Tools.php(159): XenForo_Model_Deferred->run(true, NULL, '', false)

    #13 /home/newusername/public_html/library/XenForo/FrontController.php(351): XenForo_ControllerAdmin_Tools->actionRunDeferred()

    #14 /home/newusername/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))

    #15 /home/newusername/public_html/admin.php(13): XenForo_FrontController->run()

    #16 {main}
    .
     
  2. rsi

    rsi New Member

    Here's more... If I search through my database I can find the old ftp username and password listed in the xf_attachment_data table.

    How can I correct this because I think this is the problem. Your [bd] Attachment Store [Paid] add-on has stamped the uploaded files with this previous ftp info from my old server. Now that I have moved it to a new server with a new ftp username and password I have the issue and it is a REAL problem. Are they in the hash ???


    My old ftp Username

    SELECT
    *

    FROM`prefix_database`.`xf_attachment_data`

    WHERE(

    CONVERT(`data_id`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`user_id`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`upload_date`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`filename`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`file_size`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`file_hash`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`file_path`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`width`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`height`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`thumbnail_width`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`thumbnail_height`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`attach_count`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`bdattachmentstore_engine`

    USINGutf8) LIKE '%Old_Username%'

    OR CONVERT(`bdattachmentstore_options`

    USINGutf8) LIKE '%Old_Username%'

    )

    LIMIT0,30

    My old ftp Password

    SELECT*

    FROM`prefix_database`.`xf_attachment_data`

    WHERE(

    CONVERT(`data_id`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`user_id`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`upload_date`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`filename`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`file_size`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`file_hash`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`file_path`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`width`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`height`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`thumbnail_width`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`thumbnail_height`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`attach_count`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`bdattachmentstore_engine`

    USINGutf8) LIKE '%Old_Password%'

    OR CONVERT(`bdattachmentstore_options`

    USINGutf8) LIKE '%Old_Password%'

    )

    LIMIT0,30
    .
     
  3. rsi

    rsi New Member

    Hi, are you ever even going to respond?
     
  4. sage57

    sage57 New Member

    #349 sage57, Jul 25, 2016
    Last edited: Jul 25, 2016
    @xfrocks, does this add-on work with AndyB Convert All add-on? I seen another user @Axel B say on the XF forums that it does not.
     
  5. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    1. Maester Aemon

      Maester Aemon New Member

      xfrocks likes this.
      1
  6. MattW

    MattW Member

    #352 MattW, Aug 10, 2016
    Last edited: Aug 10, 2016
    Update took down my ACP

    Code:
    XenForo_Exception: $apiUrl is invalid: Array - library/bdAttachmentStore/ShippableHelper/Updater.php:50
    Generated By: Unknown Account, 7 minutes ago
    [B]Stack Trace[/B]
    #0 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/CodeEvent.php(90): bdAttachmentStore_ShippableHelper_Updater::onInitDependencies(Object(XenForo_Dependencies_Admin), Array)
    #1 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/Dependencies/Abstract.php(215): XenForo_CodeEvent::fire('init_dependenci...', Array)
    #2 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
    #3 /home/nginx/domains/mattwservices.co.uk/public/admin.php(13): XenForo_FrontController->run()
    #4 {main}
    [B]Request State[/B]
    array(3) {
      ["url"] => string(145) "https://mattwservices.co.uk/admin.php?tools/run-deferred&redirect=https%3A%2F%2Fmattwservices.co.uk%2Fadmin.php%3Fadd-ons%2F%23_bdAttachmentStore"
      ["_GET"] => array(2) {
        ["tools/run-deferred"] => string(0) ""
        ["redirect"] => string(65) "https://mattwservices.co.uk/admin.php?add-ons/#_bdAttachmentStore"
      }
      ["_POST"] => array(0) {
      }
    }
    
    
    Code:
    ErrorException: Array to string conversion - library/bdAttachmentStore/ShippableHelper/Updater.php:50
    Generated By: Unknown Account, 1 minute ago
    [B]Stack Trace[/B]
    #0 [internal function]: XenForo_Application::handlePhpError(8, 'Array to string...', '/home/nginx/dom...', 50, Array)
    #1 /home/nginx/domains/mattwservices.co.uk/public/library/bdAttachmentStore/ShippableHelper/Updater.php(50): sprintf('$apiUrl is inva...', Array)
    #2 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/CodeEvent.php(90): bdAttachmentStore_ShippableHelper_Updater::onInitDependencies(Object(XenForo_Dependencies_Admin), Array)
    #3 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/Dependencies/Abstract.php(215): XenForo_CodeEvent::fire('init_dependenci...', Array)
    #4 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
    #5 /home/nginx/domains/mattwservices.co.uk/public/admin.php(13): XenForo_FrontController->run()
    #6 {main}
    [B]Request State[/B]
    array(3) {
      ["url"] => string(37) "https://mattwservices.co.uk/admin.php"
      ["_GET"] => array(0) {
      }
      ["_POST"] => array(0) {
      }
    }
    
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @MattW That may happen during uploading files / upgrading xml. Once those are done, it should work without issue. Please confirm?
       
    2. MattW

      MattW Member

      MattW @xfrocks I had to disable all the addons to get back into the ACP, and then continue the rebuild process to get everything working again.
       
    3. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @MattW Weird, do you remember your [bd] Attachment Store version before upgrading? Also, did you install manually or via updater?
       
    4. MattW

      MattW Member

      MattW @xfrocks 1.2.1 and I always manually update.

      I've just checked, and it might have been due to ZendOpcache. This is on a new server, and the re-validate time was 180 seconds, I missed setting it back to 60, so it might have still had a cached version of a file.
       
    5. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @MattW That makes sense, the error matches the old script from 1.2.1. Sorry for the inconvenience :(
       
  7. thienbui

    thienbui Member

    How to show Display IMG Inside Quote where use Addon this?
    ( Addon: [Tinhte] Attach Image Optimization not work with Attachment Store )
     

    Attached Files:

  8. TheComputerGuy

    TheComputerGuy New Member

    Does this actually remove the attachments from the local install?
    Or will I need to go in there and delete the attachments locally?
     
  9. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Yes, these two add-ons do not work together. It's best to disable one of them. For files that are stored in remote storage, you don't need the optimization anyway though.

    After the move, the system will delete the local files by itself.
     
    1. thienbui

      thienbui Member

      thienbui @xfrocks But if you do not use images not visible to guest.
      Any other solution? I can not see all permissions attachments.


      Thanks mate.
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @thienbui The problem with image for guest is a permission config. You can allow guest / unregistered user group to download attachment.
       
  10. thienbui

    thienbui Member

    That's impossible. I have many attachments and I do not want it free.
    I just want to show the image :(
     
  11. thienbui

    thienbui Member

    What error ?

    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 261042323 bytes)

    Thanks
     
  12. TheComputerGuy

    TheComputerGuy New Member

    Question @xfrocks do I need to rebuild any cache?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @TheComputerGuy If you want to move existing files from internal_data to new storage, it's required to run the move files tool.
       
    2. TheComputerGuy

      TheComputerGuy New Member

      TheComputerGuy @xfrocks Understood....I did that and it broke a number of files like the gallery, etc
       
  13. TheComputerGuy

    TheComputerGuy New Member

    Also, I called one of my buckets "site.com" is that frowned upon?
     
  14. Enstage

    Enstage New Member

    Hello, I'm using "Store file in External Data directory" to serve attachments over my pull CDN from the /data folder...however only new attachments are served through this, how can serve existing attachments through through the URL set under "Store file in External Data directory".

    Thanks
     
  15. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Make sure you run the latest version of both add-ons. They have been tested to work well together.

    You meant S3 bucket? That's fine but not recommended since the bucket name is supposed to have the domain CNAME for direct access.

    You need to run the move file tool in AdminCP > Tools > Rebuild Caches to migrate existing files.
     
    1. TheComputerGuy

      TheComputerGuy New Member

      TheComputerGuy @xfrocks I keep getting an error in hopes to uninstall, and then reinstall.

      Code:
      Mysqli prepare error: Unknown column 'attachment_data.bdattachmentstore_engine' in 'where clause'
      
      Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
      Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
      Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
      Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 734
      Zend_Db_Adapter_Abstract->fetchAll() in bdAttachmentStore/CacheRebuilder/StorageOptions.php at line 66
      bdAttachmentStore_CacheRebuilder_StorageOptions->rebuild() in XenForo/ControllerHelper/CacheRebuild.php at line 26
      XenForo_ControllerHelper_CacheRebuild->rebuildCache() in XenForo/ControllerAdmin/Tools.php at line 82
      XenForo_ControllerAdmin_Tools->actionCacheRebuild() in XenForo/FrontController.php at line 351
      XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
      XenForo_FrontController->run() in /xxxxx/domain.com/admin.php at line 13
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @TheComputerGuy That error indicated that you have uninstalled the add-on? Why are you running the rebuild after uninstalling it?
       
    3. TheComputerGuy

      TheComputerGuy New Member

      TheComputerGuy @xfrocks Actually haven't uninstalled. That's me trying to uninstall it.
       
  16. TheComputerGuy

    TheComputerGuy New Member

    I was able to restore back to the original
     
    xfrocks likes this.
  17. thienbui

    thienbui Member

    How to fix ?
    Screen Shot 2016-10-18 at 6.42.25 AM.jpg
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

    2. thienbui

      thienbui Member

      thienbui @xfrocks Stack Trace
      #0 [internal function]: XenForo_Application::handleFatalError()
      #1 {main}
       
    3. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @thienbui No, the directory structure between internal_data and S3 is not the same. You should move the files from internal_data to data before uploading to S3.
       
    4. thienbui

      thienbui Member

      thienbui @xfrocks Yes, All attachments are available in internal_data.
      I get this error when trying to run: AdminCP > Tools > Rebuild Cache.
      Screen Shot 2016-10-25 at 3.11.16 PM.jpg
       
  18. thienbui

    thienbui Member

    Fatal Error: Out of memory (allocated 6029312) (tried to allocate 200264146 bytes)
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}

    Yes, All attachments are available in internal_data.
    I get this error when trying to run: AdminCP > Tools > Rebuild Cache.
     
Loading...