Opened 10 years ago
Closed 8 years ago
#2739 closed defect (bug) (duplicate)
Error in script/stylesheet path resolution when bbpress installed in a sym-linked plugins/ dir
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | normal | Version: | trunk |
Component: | API - Installation/Upgrade | Keywords: | needs-patch needs-testing |
Cc: |
Description
Symlink: /var/lib/openshift/54a615dbfcf933db6b00002b/app-root/data/current/wp-content/plugins -> /var/lib/openshift/54a615dbfcf933db6b00002b/app-root/data/plugins/
When running in a sym-linked plugins folder, the following is generated for a CSS file URL: https://ocpsoft-lincolnbaxter.rhcloud.com/var/lib/openshift/54a615dbfcf933db6b00002b/app-root/data/plugins/bbpress/templates/default/css/bbpress.css?d4c4d2, which is obviously outside of the wordpress root folder, and path calculations proceed to fail.
The correct/expected URL is https://ocpsoft-lincolnbaxter.rhcloud.com/wp-content/plugins/bbpress/templates/default/js/editor.js?d4c4d2
I believe this is due to the fact that bbpress.php uses $this->file = FILE; which automatically resolves sym-links.
I believe this can be fixed by calculating the style/script URLs via the WP function: plugins_url() . "bbpress/templates/css/style.css" ... etc in includes/core/template-functions.php :: bbp_enqueue_style() and bbp_enqueue_script().
Change History (8)
This ticket was mentioned in Slack in #bbpress by lincolnthree. View the logs.
10 years ago
#3
follow-up:
↓ 5
@
10 years ago
Workaround in template-functions.php:
170 Make path to file relative to site URL
171 $located = preg_replace( '/.*(\/plugins\/)((?!.*plugins.*).*)/', plugins_url().'/$2', $located );
238 Make path to file relative to site URL
239 $located = preg_replace( '/.*(\/plugins\/)((?!.*plugins.*).*)/', plugins_url().'/$2', $located );
#4
@
10 years ago
- Component changed from General to Installation/Upgrade
- Keywords needs-patch needs-testing added
- Milestone changed from Awaiting Review to Future Release
- Priority changed from normal to low
Moving this to Future Release. I suspect this comes from our using plugins_dir_path()
and comparing it to plugins_dir_url()
, but will need testing in a symbolically linked wp-content
directory to confirm.
#5
in reply to:
↑ 3
@
9 years ago
I can confirm this works.
Replying to lincolnthree:
Workaround in template-functions.php:
170 Make path to file relative to site URL
171 $located = preg_replace( '/.*(\/plugins\/)((?!.*plugins.*).*)/', plugins_url().'/$2', $located );
238 Make path to file relative to site URL
239 $located = preg_replace( '/.*(\/plugins\/)((?!.*plugins.*).*)/', plugins_url().'/$2', $located );
Actually, using plugins_url() won't solve the problem, either, unless it's been filtered to correct the sym-link (which I have)