Skip to:
Content

bbPress.org

Opened 5 years ago

Closed 3 years ago

#2739 closed defect (duplicate)

Error in script/stylesheet path resolution when bbpress installed in a sym-linked plugins/ dir

Reported by: lincolnthree 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.


5 years ago

#2 @lincolnthree
5 years ago

Actually, using plugins_url() won't solve the problem, either, unless it's been filtered to correct the sym-link (which I have)

#3 follow-up: @lincolnthree
5 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 @johnjamesjacoby
5 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 @blakeage
4 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 );

#7 @r-a-y
3 years ago

See #3048, which has a patch.

Proposal to close this as a duplicate.

#8 @johnjamesjacoby
3 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.