Navigation Menu

Skip to content
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

Handle symlinked directories #13

Merged
merged 2 commits into from Oct 11, 2018
Merged

Handle symlinked directories #13

merged 2 commits into from Oct 11, 2018

Conversation

greatislander
Copy link
Contributor

@greatislander greatislander commented Oct 11, 2018

In Trellis systems, the uploads directory is a symlink, so we need to use realpath() to resolve the symlink to ensure that we get an accurate directory size.

In Trellis systems, the uploads directory is a symlink,
so we need to use realpath() to resolve the symlink
to ensure that we get an accurate directory size.
@@ -492,7 +492,7 @@ function display_network_storage() {
}

function calculate_network_storage() {
$path = wp_upload_dir()['basedir'];
$path = realpath( wp_upload_dir()['basedir'] );
$storage = format_bytes( rtrim( str_replace( $path, '', `du -b -s $path` ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$path can theoretically be false.

$path can theoretically be exploited (the command line version of https://xkcd.com/327/) it should be wrapped in escapeshellarg()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks = shell_exec, (aka exec, aka system, ...) I would prefer a function here so I don't have to squint as much.

@greatislander greatislander merged commit a06dc96 into dev Oct 11, 2018
@greatislander greatislander deleted the realpath branch October 11, 2018 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants