You are here

function delta_update_7304 in Delta 7.3

Add keys to the settings arrays.

File

./delta.install, line 200
Contains install, update, and uninstall functions for Skinr.

Code

function delta_update_7304(&$sandbox) {
  if (!isset($sandbox['progress'])) {
    $sandbox['#finished'] = 0;
    $sandbox['progress'] = 0;
    $sandbox['max'] = db_select('delta', 'dt')
      ->countQuery()
      ->execute()
      ->fetchField();
  }
  $templates = db_select('delta', 'd')
    ->fields('d', array(
    'machine_name',
    'settings',
    'theme',
  ))
    ->orderBy('machine_name')
    ->range($sandbox['progress'], 10)
    ->execute();
  foreach ($templates as $item) {
    $settings = array(
      'theme_' . $item->theme . '_settings' => unserialize($item->settings),
    );
    db_update('delta')
      ->fields(array(
      'settings' => serialize($settings),
    ))
      ->condition('machine_name', $item->machine_name)
      ->execute();
    $sandbox['progress']++;
  }
  $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max'];
  if ($sandbox['#finished'] >= 1) {
    cache_clear_all();
    return t("The Delta template settings have been successfully updated.");
  }
}