Skip to content

Instantly share code, notes, and snippets.

@opi
Created January 18, 2012 09:39
Show Gist options
  • Save opi/1632184 to your computer and use it in GitHub Desktop.
Save opi/1632184 to your computer and use it in GitHub Desktop.
Drupal 6 Update block cache
<?php
function mymodule_update_N() {
$return = array();
$blocks = mymodule_block('list');
foreach($blocks as $delta => $block) {
$cache = ($block['cache']) ? $block['cache'] : BLOCK_CACHE_PER_ROLE;
$return[] = update_sql('UPDATE {blocks} SET cache = '.$cache.' WHERE module = "mymodule" AND delta = "'.$delta.'" ');
}
return $return;
}
<?php
function mymodule_update_N() {
$return = array();
$blocks = mymodule_block('list');
foreach($blocks as $delta => $block) {
$cache = ($block['cache']) ? $block['cache'] : BLOCK_CACHE_PER_ROLE;
$return[] = update_sql('UPDATE {blocks} SET cache = '.$cache.' WHERE module = "mymodule" AND delta = "'.$delta.'" ');
}
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment