Given a filename create that file; usually works if PHP goes fatal.

Paramètres

string $filename: Just the filename no path information.

Return value

mixed On failure a string saying why it failed. On success the $files_to_save array.

1 string reference to 'advagg_missing_fatal_handler'
advagg_missing_create_file dans ./advagg.missing.inc
Given a filename create that file.

Fichier

./advagg.missing.inc, line 1628

Code

function advagg_missing_fatal_handler($filename) {
    static $counter = 0;
    // Bail out if there is no error.
    $error = error_get_last();
    if ($error === NULL) {
        return;
    }
    $counter++;
    // Bail out if this is still in a loop.
    if ($counter > 2) {
        return;
    }
    // Bail out if the file already exists.
    $data = advagg_get_hashes_from_filename($filename);
    $type = $data[0];
    list($css_path, $js_path) = advagg_get_root_files_dir();
    $uri = '';
    if ($type === 'css') {
        $uri = $css_path[0] . '/' . $filename;
    }
    elseif ($type === 'js') {
        $uri = $js_path[0] . '/' . $filename;
    }
    if (file_exists($uri)) {
        return;
    }
    // Generate the file with no alters.
    set_time_limit(0);
    $return = advagg_missing_create_file($filename, TRUE);
    if (is_array($return) && !headers_sent()) {
        $redirect_counter = isset($_GET['redirect_counter']) ? intval($_GET['redirect_counter']) : 0;
        // 307 if headers have not been sent yet.
        $uri = advagg_generate_location_uri($filename, $data[0], $data[3]);
        ++$redirect_counter;
        $uri .= '?redirect_counter=' . $redirect_counter;
        header('Location: ' . $uri, TRUE, 307);
        exit;
    }
}