How do I programatically create a context? I'm using the migrate module to move content into a Drupal site. Some of this content needs to be created as blocks and added to a region using contexts. I have the creation of blocks (actually, boxes) working using a purpose-built module, but I don't know where to begin on the context side of things - looking for something like add_block_to_context() but I cannot find anything. Any ideas?
After checking the code used in the context test units for Drupal 6:

ctools_include('export');
$context = ctools_export_new_object('context');
$context-&gt;name = 'testcontext';
$context-&gt;conditions = array('path' =&gt; array('values' =&gt; array('admin')));
$context-&gt;reactions = array('debug' =&gt; array('debug' =&gt; TRUE));
$saved = context_save($context);


You can easily code your reactions or conditions then save the context.

BTW to get all context you can use context_context_list().