Given a filename create that file.

Paramètres

string $filename: Just the filename no path information.

bool $no_alters: (optional) Set to TRUE to do the bare amount of processing on the file.

mixed $data: (optional) Output from advagg_get_hashes_from_filename().

Return value

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

3 calls to advagg_missing_create_file()
advagg_build_aggregates dans ./advagg.module
Builds the requested CSS/JS aggregates.
advagg_missing_fatal_handler dans ./advagg.missing.inc
Given a filename create that file; usually works if PHP goes fatal.
advagg_missing_generate dans ./advagg.missing.inc
Generates a missing CSS/JS file and send it to client.

Fichier

./advagg.missing.inc, line 423

Code

function advagg_missing_create_file($filename, $no_alters = FALSE, $data = array()) {
    // Option to still delever the file if fatal error.
    register_shutdown_function("advagg_missing_fatal_handler", $filename);
    if (empty($data)) {
        $data = advagg_get_hashes_from_filename($filename);
    }
    if (is_array($data)) {
        list($type, $aggregate_filenames_hash, $aggregate_contents_hash, $aggregate_settings) = $data;
    }
    else {
        return $data;
    }
    if (empty($aggregate_settings)) {
        $aggregate_settings = advagg_current_hooks_hash_array();
    }
    // Set no alters if this is the last chance of generating the aggregate.
    if ($no_alters) {
        $aggregate_settings['settings']['no_alters'] = TRUE;
    }
    // Get a list of files.
    $files = advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash);
    if (empty($files)) {
        return t('Hashes do not match database.');
    }
    // Save aggregate file.
    list($files_to_save, $errors) = advagg_save_aggregate($filename, $files, $type, $aggregate_settings);
    // Update atime.
    advagg_multi_update_atime(array(
        array(
            'aggregate_filenames_hash' => $aggregate_filenames_hash,
            'aggregate_contents_hash' => $aggregate_contents_hash,
        ),
    ));
    // Make sure .htaccess file exists in the advagg dir.
    if (variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE)) {
        advagg_htaccess_check_generate($files_to_save, $type);
    }
    // Return data.
    return array(
        $files_to_save,
        $type,
        $aggregate_filenames_hash,
        $aggregate_contents_hash,
        $aggregate_settings,
        $files,
        $errors,
    );
}