• Resolved nickerzb

    (@nickerzb)


    In public/class-reactpress-public.php there’s the following line of code:

    
    $relative_apppath = $document_root ? explode($document_root, $plugin_app_dir_url)[1] : escapeshellcmd("/wp-content/plugins/reactpress/apps/{$appname}/");
    

    In most cases, I’m going to assume that the document_root and plugin_app_dir_url line up, but in my staging/production environment they don’t. There’s an assumption being made here that the document root and plugin app directory will be on the same machine/server/location, which might not be the case.

    In my case..

    
    Local:
    document_root: /var/www/html
    plugin_root: /var/www/html/wp-content/plugins/reactpress/apps/wp-job-board/
    Dev:
    document_root: /nas/wp/www/sites/<company_name_retracted>staging
    plugin_root: /nas/content/live/<company_name_retracted>staging/wp-content/plugins/reactpress/apps/wp-job-board/
    

    There should be a check before doing the explode instead of assuming they’re in the same root location.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author rockiger

    (@rockiger)

    Thank you for debugging this issue. Your solution should probably work. The reason why I don’t use an absolute path is, that sometime on some hosting services the document root is not set.

    Would you care to create a pull request at https://github.com/rockiger/reactpress? I don’t have docker setup for WordPress to test the changes, and honestly don’t want to set up one.

    Thread Starter nickerzb

    (@nickerzb)

    Yeah I’ll happily do that. I wasn’t sure which repo was yours.

    Thread Starter nickerzb

    (@nickerzb)

    Plugin Author rockiger

    (@rockiger)

    Ver cool,

    I will prepare an updated release during the weekend. I was sick the last days, so I am drowning in work :(.

    Thread Starter nickerzb

    (@nickerzb)

    No worries I have our plugin patched in our staging site right now and can patch prod if we release this before you’re ready. This is more so I don’t have to patch it going forward when updates happen ??

    • This reply was modified 3 years, 4 months ago by nickerzb.
    Plugin Author rockiger

    (@rockiger)

    Would you like to share the page when it’s ready? I would love to see, what people are doing with the plugin.

    Thread Starter nickerzb

    (@nickerzb)

    Sure! Effectively right now we pull our job board in an iframe from a third party vendor, and I’m replacing that with a custom react app to hit their API and render the results faster/better with more SEO. I’ll share it when we’re done.

    Plugin Author rockiger

    (@rockiger)

    @nickerzb I released a new version with your PR. Thanks again.

    Thread Starter nickerzb

    (@nickerzb)

    Working as expected!

    One thing I did notice… when I upgrade my plugin, my apps are deleted and I have to reconfigure everything. Is there a way around this?

    Plugin Author rockiger

    (@rockiger)

    Arrrr, I add a .keep file, to the apps directory. I guess that is the problem. The update overwrites the apps directory.

    I have to release another version and create the directory by hand.

    Thinking about it, it will probably make sense to move the apps directory out of the plugins directory.

    Thread Starter nickerzb

    (@nickerzb)

    What’s a .keep file? I’m happy to add that, but yeah probably a better long term solution to have that exist somewhere else.

    Plugin Author rockiger

    (@rockiger)

    A .keep file you can tell git to add an empty directory.

    This won’t help you in any way. I will change the plugin as fast as possible.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Document root and plugin app dir don’t match’ is closed to new replies.