New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP_ROOT_DIR str_replace too greedy #114

Closed
jellycode opened this Issue Nov 2, 2017 · 3 comments

Comments

2 participants
@jellycode
Contributor

jellycode commented Nov 2, 2017

Great plugin but I'm having a bit of an issue with my setup.

My WP_CONTENT_DIR contains the AUTOPTIMIZE_WP_CONTENT_NAME in the path twice, so when it gets replaced on line 49 of the autoptimize.php file it destroys the path:

define('WP_ROOT_DIR',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',WP_CONTENT_DIR));

My path is
/srv/users/serverpilot/apps/website ... /web/app
and the AUTOPTIMIZE_WP_CONTENT_NAME is /app.

When the str_replace happens the path ends up like:

/srv/users/serverpilots/website ... /web

So instead of replacing it anywhere it appears, I changed it to only replace at the end:

define('WP_ROOT_DIR',substr(WP_CONTENT_DIR, 0, strlen(WP_CONTENT_DIR)-strlen(AUTOPTIMIZE_WP_CONTENT_NAME)));

Thoughts?

@futtta

This comment has been minimized.

Show comment
Hide comment
@futtta

futtta Nov 2, 2017

Owner

makes sense, tested a bit and seems OK, why not make it PR @jellycode ? :-)

Owner

futtta commented Nov 2, 2017

makes sense, tested a bit and seems OK, why not make it PR @jellycode ? :-)

@jellycode

This comment has been minimized.

Show comment
Hide comment
@jellycode

jellycode Nov 2, 2017

Contributor

Ok!

Contributor

jellycode commented Nov 2, 2017

Ok!

@futtta

This comment has been minimized.

Show comment
Hide comment
@futtta

futtta Nov 2, 2017

Owner

merged, thanks @jellycode

Owner

futtta commented Nov 2, 2017

merged, thanks @jellycode

@futtta futtta closed this Nov 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment