Support » Plugin: Microsoft Azure Storage for WordPress » Multisite data BUG

  • Hi,

    At first, thanks for the great plugin, I’m currently implementing it in a multisite network.
    All images etc should be available over a cdn which works as aspected but:

    The plugin uploads the file 2 times:

    • blobstorage/2016/12/05/my-image.jpg
    • blobstorage/sites/2/2016/12/05/my-image.jpg

    The first path works fine, the second path not. Path 2 is the one used by WordPress. So currently the images do not load. I loggedin to my blobstorage using cyberduck and when I check the files I see the file in the first path has some bytes (which is good) but the once in the second path have 0 bytes, so something is going wrong while uploading them I guess.

    Can you please check this?

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi @jorenvh,

    Thanks for the report. Can you tell us your WordPress setup, WordPress version and Azure Storage Plugin settings? We are not able to reproduce this at our end.

    Regards,
    Ritesh

    Hi @ritteshpatel

    – site.example.com => main site which is used as a splash page
    – site.example.com/be => subsite 1
    – site.example.com/nl => subsite 2

    I network activated the plugin & set different settings for both subsites. I also tried to network disable the plugin & activate it per site install, but that gives the same result as when I network activate it.

    – each subsite uses a different storage container
    – a cname has been set to base cdn url https://mycdn.azureedge.net
    – use windows Azure storage for default upload is checked
    – keep local files is NOT checked
    – timeout for azure filel ist cache in seconds = the default of 15

    Plugin version: Version 4.0.0
    WP version: 4.6.1

    In Azure I have a normal blob storage account with public 2 containers (belgium & netherlands), one for each of the subsites. I also setup a cdn which is linked to the blob sotrage account.

    If there is other info you would like, please let me know and I will send you over the details.

    Thanks,
    Joren

    Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi Joren,

    Thanks for the details, we are looking into this. We are still not able to reproduce this one except that sites/2 is not in file path which in my opinion should be in path. Can you check it once with other plugins disabled and with WordPress default theme in your dev environment just to confirm if it is a theme or plugin conflict.

    Regards,
    Ritesh

    Hi Ritesh,

    I retried with all plugins disabled and a default theme, but it still results in the same result as before.

    Best regards,
    Joren

    Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi Joren,

    We are still not able to reproduce this. Can you get us list of plugins/themes you are using? Are you changing upload dir using any filter or such which can cause this issue?

    Regards,
    Ritesh

    a:37:{i:0;s:21:"polylang/polylang.php";i:1;s:29:"gravityforms/gravityforms.php";i:2;s:29:"acf-repeater/acf-repeater.php";i:3;s:39:"admin-columns-pro/admin-columns-pro.php";i:4;s:30:"advanced-custom-fields/acf.php";i:5;s:59:"ajax-load-more-repeaters-v2/ajax-load-more-repeaters-v2.php";i:6;s:33:"ajax-load-more/ajax-load-more.php";i:7;s:59:"black-studio-tinymce-widget/black-studio-tinymce-widget.php";i:8;s:31:"cac-addon-acf/cac-addon-acf.php";i:9;s:43:"custom-field-widget/custom-field-widget.php";i:10;s:33:"duplicate-menu/duplicate-menu.php";i:11;s:45:"ewww-image-optimizer/ewww-image-optimizer.php";i:12;s:46:"gravity-forms-custom-post-types/gfcptaddon.php";i:13;s:35:"oa-social-login/oa-social-login.php";i:14;s:72:"persistent-database-connection-updater/persistent-connection-updater.php";i:15;s:40:"polylang-slug-master-5/polylang-slug.php";i:16;s:47:"regenerate-thumbnails/regenerate-thumbnails.php";i:17;s:48:"simple-301-redirects/wp-simple-301-redirects.php";i:18;s:16:"td-ajax/ajax.php";i:19;s:18:"td-audio/Audio.php";i:20;s:27:"td-cta/bind-cta-to-post.php";i:21;s:14:"td-cta/cta.php";i:22;s:32:"td-external_url/External_url.php";i:23;s:52:"td-fb-instant-articles/facebook-instant-articles.php";i:24;s:16:"td-file/file.php";i:25;s:30:"td-infographic/infographic.php";i:26;s:38:"td-post-reading-time/post-readtime.php";i:27;s:24:"td-products/products.php";i:28;s:18:"td-quote/Quote.php";i:29;s:18:"td-tweet/Tweet.php";i:30;s:18:"td-video/Video.php";i:31;s:47:"windows-azure-storage/windows-azure-storage.php";i:32;s:41:"wordpress-importer/wordpress-importer.php";i:33;s:51:"wordpress-popular-posts/wordpress-popular-posts.php";i:34;s:24:"wordpress-seo/wp-seo.php";i:35;s:27:"wp-super-cache/wp-cache.php";i:36;s:33:"wp-user-avatar/wp-user-avatar.php";}

    Hi Ritesh,

    Above the serialised field with all active plugins. The theme we are using is completly custom.

    We are not rewriting the upload dir using a filter or anything else everything with uploads is default WordPress functionality, except for your plugin 😉

    Thanks,
    Joren

    Hi Ritesh,

    Any update on this issue?

    Best regards,
    Joren

    Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi Joren,

    Can you get us all the actions/filters you are using in your theme?

    Regards,
    Ritesh

    Hi Ritesh,

    I created a gist with that part of our functions.php file. You can find it here:

    https://gist.github.com/jorenvh/737c7ffd096f50881db10f20c804e6c7

    Thanks,
    Joren

    Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi Joren,

    I don’t see any conflicting filter/action in the list. Ok, let’s go through this again. So, you are uploading my-image.jpg in a site with id 2 and it’s generating two files in azure storage.

    – blobstorage/2016/12/05/my-image.jpg
    – blobstorage/sites/2/2016/12/05/my-image.jpg

    According to plugin code, which I have verified as well, it should create one file only “blobstorage/2016/12/05/my-image.jpg”. You have already checked with other plugins disabled but can you check again the same for new upload and see if new uploads are working fine? If you check windows_azure_storage_wp_update_attachment_metadata function, it stores all the media related info in to meta with windows_azure_storage_info key. Can you check that key for media which are having issue? Azure storage plugin will alter media URLs with azure storage link only if this meta found.

    Let us know if that helps or not.

    Regards,
    Ritesh

    Hi Ritesh,

    That’s correct. Well I just tried again an can verify that it uploads 2 files.

    I checked the record in the database and it’s available and contains the following data:

    a:4:{s:9:"container";s:7:"belgium";s:4:"blob";s:46:"2016/12/Screen-Shot-2016-12-19-at-14.47.41.png";s:3:"url";s:86:"https://mycdn.azureedge.net/belgium/2016/12/Screen-Shot-2016-12-19-at-14.47.41.png";s:10:"thumbnails";a:4:{i:0;s:54:"2016/12/Screen-Shot-2016-12-19-at-14.47.41-150x150.png";i:1;s:54:"2016/12/Screen-Shot-2016-12-19-at-14.47.41-244x300.png";i:2;s:54:"2016/12/Screen-Shot-2016-12-19-at-14.47.41-768x945.png";i:3;s:54:"2016/12/Screen-Shot-2016-12-19-at-14.47.41-670x400.png";}}

    The url above is correct but when I visit the image in the media lib it links to the following one:

    https://mycdn.azureedge.net/belgium/sites/2/2016/12/Screen-Shot-2016-12-19-at-14.47.41.png

    Which is the second file that is only 0 bytes large.

    Hope that helps.

    Thanks,
    Joren

    • This reply was modified 2 years, 8 months ago by  jorenvh.
    • This reply was modified 2 years, 8 months ago by  jorenvh.

    Hi Ritesh,

    Some extra info:

    after another page is laoded the correct url in the meta data changes to the wrong one.

    Joren

    Plugin Author Ritesh Patel

    (@ritteshpatel)

    Hi Joren,

    As you can see windows_azure_storage_info meta is getting added in windows_azure_storage_wp_update_attachment_metadata function only which is a callback for wp_update_attachment_metadata filter. Can you debug in that function why it’s called second time and updated the meta value? Also check which function triggering it.

    Regards,
    Ritesh

    Hi Ritesh,

    I’m already trying to do that, but I think it’s still called through the plugin. I think it has something to do with the generation of thumbnails.

    And that this part is causing it: (not sure yet trying to debug it)

    delete_post_meta( $post_id, 'windows_azure_storage_info' );
    
    		add_post_meta(
    			$post_id, 'windows_azure_storage_info',
    			array(
    				'container'  => $default_azure_storage_account_container_name,
    				'blob'       => $relative_file_name,
    				'url'        => $url,
    				'thumbnails' => $thumbnails,
    			)
    		);

    Joren

    Hi Ritesh,

    Any tips on dumping debug data in that function? Can’t seem to get it to display, also nothing useful in my network inspector.

    Thanks,
    Joren

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Multisite data BUG’ is closed to new replies.