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

Error if cache folder is not created #32

Closed
DonBananos opened this issue Jun 4, 2015 · 2 comments
Closed

Error if cache folder is not created #32

DonBananos opened this issue Jun 4, 2015 · 2 comments

Comments

@DonBananos
Copy link

If the cache folder is not in the directory, the application crashed.
therefore, i've added this little piece of code to the project where i'm using your great work.

/*
 * Check if the cache folder exists in the imdbphp api.
 * if it doesn't - then create it!
 */
if (!file_exists('../includes/api/imdbphp/cache'))
{
    mkdir('../includes/api/imdbphp/cache', 0777, true);
}

Anyway, Thanks for sharing this!

@IzzySoft
Copy link
Collaborator

IzzySoft commented Jun 4, 2015

Sound good so far – but it shouldn't use a hard-coded path. There's a config variable cachedir which should be used instead. Furthermore, this check is only required when caching is enabled (config: usecache). And even then, it should not be done "too often". A quick idea might be doing so in the constructor; but this I better leave to @tboothman as he's more familiar with the current code 😇

@DonBananos
Copy link
Author

This was just my quickfix. But of course for a sustainable solution, config
file is the way to go. A chef on whether or not the cache is enabled is
likewise the better choice. Well, all your points are valid. Thank you sir.

tor. 4. jun. 2015 16.14 skrev Izzy notifications@github.com:

Sound good so far – but it shouldn't use a hard-coded path. There's a
config variable cachedir which should be used instead. Furthermore, this
check is only required when caching is enabled (config: usecache). And
even then, it should not be done "too often". A quick idea might be doing
so in the constructor; but this I better leave to @tboothman
https://github.com/tboothman as he's more familiar with the current
code [image: 😇]


Reply to this email directly or view it on GitHub
#32 (comment).

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

2 participants