How do I unset a region in template.php AND have it alter the body classes In some cases I need to programmatically remove the sidebar_first region in template.php.  So, I'm doing something like:

function template_preprocess_page(&amp;$variables) {
  if(my_condition){
    unset($variables['page']['sidebar_first']);
  }
}


this does, indeed, remove the sidebar, however, it does NOT alter the body classes.  So, I still have a class of

body.two-sidebars


...even though I unset one of them (so the proper class would be body.one-sidebar).

How can I programmatically remove a sidebar AND have it alter the body classes properly?

(please, for various reasons dont suggest creating a new template suggestion and altering the sidebar there.  that won't work in my case.  I am asking specifically how to remove a region programmatically)
If you look at the default template_preprocess_html, you will see

  // Add information about the number of sidebars.
  if (!empty($variables['page']['sidebar_first']) &amp;&amp; !empty($variables['page']['sidebar_second'])) {
    $variables['classes_array'][] = 'two-sidebars';
  }
  elseif (!empty($variables['page']['sidebar_first'])) {
    $variables['classes_array'][] = 'one-sidebar sidebar-first';
  }
  elseif (!empty($variables['page']['sidebar_second'])) {
    $variables['classes_array'][] = 'one-sidebar sidebar-second';
  }
  else {
    $variables['classes_array'][] = 'no-sidebars';
  }


If you don't want this behavior, you should implement your own version which will run after.  Then, you just check your condition and muck with $variables['classes_array'] as needed.