Home › Forums › Calendar Products › Community Events › Resource URL’s break when using Capistrano (symlinked release dirs)
- This topic has 6 replies, 3 voices, and was last updated 8 years, 7 months ago by
bigfishdesign.
-
AuthorPosts
-
March 1, 2017 at 6:49 am #1247579
bigfishdesign
ParticipantCurrently, your tribe_resource_url function doesn’t seem to play well when the website is served out of a symlinked dir.
I’m having to run the following code as a mu-plugin to work around the problem:
<?php
add_filter('tribe_resource_url', function ($url) {
$root = dirname(dirname(__DIR__));
if (strpos($url, $root) === 0) {
$url = str_replace($root, home_url(), $url);
}
return $url;
});With capistrano you have a releases dir, with a symlink point to a current dir. The current dir is what is served up by the webserver.
Here are the PATHS set in our config
WP_SITEURL=https://ngs.staging.bigfish.co.uk/wp
WP_HOME=https://ngs.staging.bigfish.co.uk
WP_CONTENT_URL=https://ngs.staging.bigfish.co.uk/app
WP_CONTENT_DIR=/var/www/ngs.staging.bigfish.co.uk/current/web/app
With the webserver serving this folder:
$_SERVER['DOCUMENT_ROOT'] = '/var/www/ngs.staging.bigfish.co.uk/current/web'but the real directory, the content being in something like:
/var/www/ngs.staging.bigfish.co.uk/releases/XXXXXXXXX/webBecause you are using a number of PHP functions to read the current dir, it will return the real dir rather than what the webserver and WordPress says where it is (symlinked dir).
So when you come to compile the resource URL we end up with something like this:
/var/www/ngs.staging.bigfish.co.uk/releases/20170228143114/web/app/plugins/the-events-calendar/src/resources/js/aggregator-admin-legacy-settings.jsinstead of:
https://ngs.staging.bigfish.co.uk/app/plugins/the-events-calendar/src/resources/js/aggregator-admin-legacy-settings.jsMarch 1, 2017 at 6:55 pm #1248116Cliff
MemberHi, Big Fish.
Thanks for that detailed report.
I’ve passed it along to our developers.
I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. I cannot guarantee when it will be fixed as it’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.
I apologize for this issue and appreciate your understanding and patience.
The best I can tell you right now is that this was a previously-logged-and-fixed bug that apparently wasn’t… so we’ll have them look into it again for you.
Thank you for sharing all the details, including your System Information Report.
July 26, 2017 at 6:33 pm #1326690Cliff
MemberBig Fish, sorry for the long-delayed reply here.
Community Events went through a significant code update.
Could you please confirm if this issue is still an outstanding one to be fixed or did it get resolved on its own?
Thank you.
July 31, 2017 at 12:10 pm #1328447Cliff
MemberHi, Big Fish.
Just checking back here to see if you got my previous message asking if the bug is still outstanding.
Our developers are standing by awaiting your report.
Thank you.
August 14, 2017 at 10:38 am #1335047Brook
ParticipantHowdy Big Fish,
I looked into this and am not able to determine what the problem is. WordPress registers both the symlinked and realpaths using wp_register_plugin_realpath(). Our code here relies on plugins_url(), thus it should be able to accept either the symlink or realpath all while returning the proper URL.
None of us have Capistrano setup so we can not test your exact scenario. What happens if you create a test plugin, and pass plugins_url() both parameters, with __FILE__ as the second parameter? Does it return the correct URL, or does it contain the release/xxxxxx bits? If it does not return the correct URL, near as I can tell your server is somehow not compatible with WP’ handling of symlinks. Unfortunately that’s not a bug we can fix. If it is returning the correct URL, there might be something we can do.
I really appreciate you taking the time to reach out and share your findings. I wish I was able to find a solution for you right off the bat.
– Brook
September 5, 2017 at 9:35 am #1344917Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Resource URL’s break when using Capistrano (symlinked release dirs)’ is closed to new replies.
