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

setCacheDir no Exceptions on Server #23

Closed
nyze2oo9 opened this issue Apr 28, 2015 · 0 comments
Closed

setCacheDir no Exceptions on Server #23

nyze2oo9 opened this issue Apr 28, 2015 · 0 comments

Comments

@nyze2oo9
Copy link
Contributor

Wenn meine CacheDir auf einer Lokalen Installation (xampp) falsch ist bekomme ich eine Exception, jedoch hab ich keine auf einem richtigen Server bekommen. Deshalb musste ich ein paar Echos einbauen. Vielleicht hilft das ja ein paar Leute die ebenfalls einen 500 Error bekommen haben und keine richtigen Exceptions bekommen haben. Ich habe auf dem Server einen eigenen Cache Ordner benutzt, da es mit Default Einstellungen(system temp directory) nicht funktioniert hat(ebenfalls keine richtigen Exceptions nur 500 Error).

public function setCacheDir($cacheDir)
{

    if ($cacheDir !== null) {
        if (!is_dir($cacheDir)) {
            echo'cache dir not found';
            throw new Exception\InvalidArgumentException(
                "Cache directory '{$cacheDir}' not found or not a directory"
            );
        } elseif (!is_writable($cacheDir)) {
            echo'cache dir not writable';
            throw new Exception\InvalidArgumentException(
                "Cache directory '{$cacheDir}' not writable"
            );
        } elseif (!is_readable($cacheDir)) {
            echo'cache dir not readable';
            throw new Exception\InvalidArgumentException(
                "Cache directory '{$cacheDir}' not readable"
            );
        }

        $cacheDir = rtrim(realpath($cacheDir), DIRECTORY_SEPARATOR);
    } else {
        echo $cacheDir;
        $cacheDir = sys_get_temp_dir();
    }

    $this->triggerOptionEvent('cache_dir', $cacheDir);
    $this->cacheDir = $cacheDir;
    return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants