• Hi there,

    very much anticipated using this this plugin since it exactly seems to be doing what we need to achieve: Import images form a (synched) server folder and do so in a regular fashion via Cron event which handily is also included!

    Unfortunately the plugin produces an error as soon as I try to select a folder under “Select Register” other then the uploads-folder (which has an empty option value).

    The issue is, that our folder structure is different from regular WP installations (we use Bedrock) and thus the paths are recognized falsely to begin with…

    Read more about the issue and the proposed solution here: https://roots.io/docs/bedrock/master/compatibility/

    Excerpt:

    If a plugin or theme works with a vanilla WordPress install and not with Bedrock, the plugin or theme is likely at fault: In most cases, it is hard-coding assumptions about directory structure or file location and ignoring the systems WordPress has in place to determine those things dynamically.

    This is the error message taken from the log:

    
    2021/06/08 09:22:53 [error] 904#904: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/srv/www/mysite.com/releases/20210608092139/web/app/uploadshttps://mysite.com/app/uploads/rclone): failed to open dir: No such file or directory in /srv/www/mysite.com/releases/20210608092139/web/app/mu-plugins/bulk-media-register/lib/class-bulkmediaregister.php:122
    Stack trace:
    #0 /srv/www/mysite.com/releases/20210608092139/web/app/mu-plugins/bulk-media-register/lib/class-bulkmediaregister.php(122): RecursiveDirectoryIterator->__construct('/srv/www/hackeu...', 4096)
    #1 /srv/www/mysite.com/releases/20210608092139/web/app/mu-plugins/bulk-media-register/lib/class-bulkmediaregister.php(444): BulkMediaRegister->scan_file('/srv/www/hackeu...', 'all', true, '/^(?!.*(-[0-9]+...', false, Array, Array, 1, 1623144173, 2880)
    #2 /srv/www/mysite.com/releases/20210608092139/web/wp/wp-includes/class-wp-hook.php(292): BulkMediaRegister->search_files(1, false)" while reading response header from upstream, client: 95.91.214.80, server: multi.hackeundspitze.xyz, request: "POST /wp/wp-admin/admin.php?page=bulkmediaregister-selectregister HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm-wordpress.sock:", host: "multi.hackeundspitze.xyz", referrer: "https://mysite.com/wp/wp-admin/admin.php?page=bulkmediaregister-selectregister"
    

    Would it be possible to fix the issue and make the plugin more “structure-agnostic”?

    Looking forward to using the plugin and we’ll gladly support the development.

    Thanks & regards,

    Henning

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    Please complain to your hosting provider.
    This plugin uses the standard WordPress functions to retrieve directories.

    https://developer.www.ads-software.com/reference/functions/wp_upload_dir/

    Why don’t you use a different server?

    Thread Starter leanderbraunschweig

    (@leanderbraunschweig)

    Hi Katsushi,

    thanks for getting back.

    The server itself is irrelevant here, changing hosting providers won’t do the trick…

    I’ve managed to wrap my head around the plugin structure a bit and there are two changes necessary to make this work properly with Bedrock / a more agnostic folder structure:

    1. Change $wordpress_path to use WP_CONTENT_DIR

    class-bulkmediaregister.php | line 300

    
    $wordpress_path = wp_normalize_path(WP_CONTENT_DIR);
    

    2. Change $linkpath in first conditional to use $this->upload_dir instead of $wordpress_path

    class-bulkmediaregister.php | line 317

    
    if ( strstr( $linkdir, $wordpress_path ) ) {
      $linkpath = $this->mb_utf8( str_replace( $this->upload_dir, '', $linkdir ) );
    }
    

    Not sure how this translates to “regular” installs but this fixes the error(s) on our side.

    Would you be willing to test this on your end? Maybe this change can be introduced in order to increase compatibility?

    Thanks & regards,

    Henning

    Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    Are you building WordPress with this?

    https://roots.io/bedrock/

    Hi Katsushi,
    please allow me to answer for Henning, as he is currently travelling. The answer is Yes.

    Holger

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Incompatible with Bedrock / alternative folder structure’ is closed to new replies.