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

Missing cache folder, realpath() does not support nonexistent directory #17

Open
pixelchutes opened this issue Aug 4, 2016 · 1 comment

Comments

@pixelchutes
Copy link

pixelchutes commented Aug 4, 2016

In the current default handling for setCacheLocation, it processes the result through realpath(). If the defined folder does not exist (e.g. {core_path}components/spiefeed/cache), the code attempts to create it.

However, it never succeeds.

Since realpath() cannot handle nonexistent files/folders, the result is always empty. That said, the value passed to mkdir is an empty string, and the cache folder is not created. The only reason it does not error is the error suppressor @ at the front.

$cachePath = realpath($scriptProperties['setCacheLocation']);
if (!is_dir($cachePath)) {
    @mkdir($cachePath, 0755);
}

Perhaps the default handling should pass $scriptProperties['setCacheLocation'] to mkdir(), or come up with an alternative to realpath() to handle this correctly?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36659981-missing-cache-folder-realpath-does-not-support-nonexistent-directory?utm_campaign=plugin&utm_content=tracker%2F5873226&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F5873226&utm_medium=issues&utm_source=github).
@pixelchutes
Copy link
Author

pixelchutes commented Aug 4, 2016

Perhaps it is due to assets/components/spiefeed/cache existing, but $defaultCacheLocation check is actually prefixed by core_path?

Personally, I think it would be safer to store in core_path (and not assets_path) anyway, so perhaps the folder (and accompanying .gitignore) also needs to be created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant