<?php
/**
 * @file
 * Installation and update scripts for Metatag:OpenGraph.
 */

/**
 * Implements hook_requirements().
 */
function metatag_opengraph_requirements($phase) {
  $requirements = array();
  // Ensure translations don't break during installation.
  $t = get_t();

  if ($phase == 'runtime') {
    if (module_exists('rdf')) {
      $requirements['metatag_og_rdf'] = array(
        'severity' => REQUIREMENT_WARNING,
        'title' => 'Metatag:OpenGraph',
        'value' => $t('Possible conflict with the RDF module'),
        'description' => $t("The core RDF module is known to cause validation problems for Open Graph meta tags. Unless it is actually needed for the site, it may be worthwhile to disable the RDF module to avoid any possible problems for the Open Graph integration."),
      );
    }
  }

  return $requirements;
}

/**
 * Implements hook_install().
 */
function metatag_opengraph_install() {
  // Display a warning about possible conflicts with the RDF module.
  if (module_exists('rdf')) {
    drupal_set_message(t('The core RDF module is known to cause validation problems for Open Graph meta tags. Unless it is actually needed for the site, it may be worthwhile to disable the RDF module to avoid any possible problems for the Open Graph integration.'));
  }
}

/**
 * Implementations of hook_update_N().
 */

/**
 * Enable the new Metatag:Facebook submodule.
 */
function metatag_opengraph_update_7100() {
  module_enable(array('metatag_facebook'));
  drupal_set_message(t('Enabled the new Metatag:Facebook submodule. If the Facebook meta tags are not being used then it is safe to disable.'));
}

/**
 * Leave a warning about the two og:type value changes.
 */
function metatag_opengraph_update_7101() {
  drupal_set_message(t('The "Movie" and "TV Show" values for the "Content type" open graph meta tag changed, if this site used those values they will need to be manually updated.'));
}
