Skip to content

Instantly share code, notes, and snippets.

@skwashd
Created March 8, 2012 12:20
Show Gist options
  • Save skwashd/2000765 to your computer and use it in GitHub Desktop.
Save skwashd/2000765 to your computer and use it in GitHub Desktop.
Update caching for a bunch of views
$res = db_query('SELECT * FROM views_display WHERE ...');
while ($record = db_fetch_array($res)) {
$options = unserialize($record['display_options']);
$options['cache'] = array(
'type' => 'time',
'results_lifespan' => 3600,
'output_lifespan' => 3600,
);
db_update('views_display')
->fields(array(
'display_options' => searialize($display_options),
))
->condition('vid', $record['vid'], '=')
->condition('id', $record['id'], '=')
->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment