<?php

/**
 * @file
 * An installation file for Panopoly Theme
 */

/**
 * Implementation of hook_install()
 */
function panopoly_theme_install() {

}

/**
 * Implemenetation of hook_uninstall()
 */
function panopoly_theme_uninstall() {

}

/** 
 * Panopoly Beta 6 Update: Updating Location of Panopoly Icons
 */
function panopoly_theme_update_7001(&$sandbox) {

  // Update Bartik, Garland, or Responsive Bartik's Current Logo to New Panopoly Location
  foreach (array('bartik', 'garland', 'responsive_bartik') as $theme_key) {
    $theme_settings = variable_get('theme_' . $theme_key . '_settings');
    if ($theme_settings['logo_path'] == 'profiles/panopoly/images/panopoly_icon_theme.png') {
      $theme_settings['logo_path'] = drupal_get_path('module', 'panopoly_theme') . '/images/panopoly_icon_theme.png';
      variable_set('theme_' . $theme_key . '_settings', $theme_settings);
    }
  }

  // Update Seven's Logo to Go Back to Normal
  $theme_settings = variable_get('theme_seven_settings');
  if ($theme_settings['logo_path'] == 'profiles/panopoly/images/panopoly_icon_install.png') {
    $theme_settings['logo_path'] = '';
    $theme_settings['default_logo'] = 1;
    variable_set('theme_seven_settings', $theme_settings);
  }

  // Flush the Theme Data
  system_rebuild_theme_data();
}
