query
SELECT module, delta FROM {blocks} WHERE status = '1' AND cache <> '-1'
just ignores blocks, which have status = 0.

But blocks with status=0 still can be invoked using
module_invoke('blockcache_alter', 'block', 'view', 'module,delta');
and that means, that on event such add/delete/update node/comment cache for this block will not reset, because of status = 0

Comments

kiploona’s picture

If i'm correct, we can simply change status = '0' in query, or probably make kind of variable, which will modify sql query for example to:

$modules = variable_get('blockcache_alter_include_modules', array());
$m_excl = implode("', '", $modules);

db_query("SELECT module, delta FROM {blocks} WHERE (status = '1' OR (module IN ('%s')) AND cache <> '-1'", $m_excl);
swentel’s picture

Status: Active » Needs work

Very edge casy, but it's valid. Like the solution too, but getting a mysql error at

User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;&#039; at line 1 query: SELECT module, delta FROM blocks WHERE (status = &#039;1&#039; OR (module IN (&#039;user\&#039;, \&#039;menu&#039;)) AND cache &lt;&gt; &#039;-1&#039; in _db_query() (line 128 of /var/www/html/drupal/drupal6/includes/database.mysqli.inc).

MySQL is escaping the quotes inside the string.

swentel’s picture

Status: Needs work » Closed (fixed)

Used db_placeholders() instead, commited to D6 branch.

tmarly’s picture

Not so edge casy when using Context module :)

In this case, all blocks have status=0, so cache refresh is not working, except setting the variable blockcache_alter_include_modules to an exhaustive list of all modules, but in this case, it's better to remove the test 'status=1'.

I guess the reason for this test is performances, to avoir a loop on hundreds (or thousands) of blocks ?

btopro’s picture

sub cause of context usage

bastnic’s picture

subscribe