Get the db select return object.

Paramètres

string $theme: Name of the current theme.

array $type: Array of int types to lookup.

array $lookup: The lookup value.

array $user: Array of user string values.

Return value

SelectQuery Return the SelectQuery object after it has been executed.

1 call to advagg_critical_css_table_get()
advagg_critical_css_advagg_mod_critical_css_file_pre_alter dans advagg_critical_css/advagg_critical_css.module
Implements hook_advagg_mod_critical_css_file_pre_alter().

Fichier

advagg_critical_css/advagg_critical_css.module, line 128

Code

function advagg_critical_css_table_get($theme, array $type, array $lookup, array $user) {
    $output = array();
    try {
        $results = db_select('advagg_critical_css', 'acc')->fields('acc')
            ->condition('theme', $theme)
            ->condition('type', $type, 'IN')
            ->condition('user', $user, 'IN')
            ->condition('lookup', $lookup, 'IN')
            ->orderBy('type', 'DESC')
            ->execute();
        // Get first result.
        $output = $results->fetchAssoc();
        // Check for a better match in other results if they exist.
        foreach ($results as $values) {
            $values = (array) $values;
            if ($values['type'] < $output['type']) {
                $output = $values;
                break;
            }
            if ($values['type'] = $output['type']) {
                if (($values['user'] === 'anonymous' || $values['user'] === 'authenticated') && $output['user'] === 'all') {
                    $output = $values;
                    break;
                }
                if (is_int($values['user'])) {
                    $output = $values;
                    break;
                }
            }
        }
    } catch (PDOException $e) {
        // Log the error if in development mode.
        if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) {
            watchdog('advagg_critical_css', 'Development Mode - Caught PDO Exception: <code>@info</code>', array(
                '@info' => $e,
            ));
        }
    }
    return $output;
}