How do I programmatically disable/enable a block?
Use db_update.

db_update('block')
   -&gt;fields(array(
     'status' =&gt; 0,
     'weight' =&gt; -10,
     'region' =&gt; 'disabled',
   ))
   -&gt;condition('module', 'modulename')
   -&gt;condition('delta', 'modulename_delta')
   -&gt;execute();