metatag_opengraph.install 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @file
  4. * Installation and update scripts for Metatag:OpenGraph.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function metatag_opengraph_requirements($phase) {
  10. $requirements = array();
  11. // Ensure translations don't break during installation.
  12. $t = get_t();
  13. if ($phase == 'runtime') {
  14. if (module_exists('rdf')) {
  15. // Work out the release of D7 that is currently running.
  16. list($major, $minor) = explode('.', VERSION);
  17. // Strip off any suffixes on the version string, e.g. "17-dev".
  18. if (strpos('-', $minor)) {
  19. list($minor, $suffix) = explode('-', $minor);
  20. }
  21. if ($minor < 33) {
  22. $requirements['metatag_og_rdf'] = array(
  23. 'severity' => REQUIREMENT_WARNING,
  24. 'title' => 'Metatag:OpenGraph',
  25. 'value' => $t('RDF problems with Drupal core releases before v7.33'),
  26. 'description' => $t('The core RDF module in Drupal before v7.33 caused validation problems for Open Graph meta tags. The solution is to update to v7.33 or newer.'),
  27. );
  28. }
  29. }
  30. }
  31. return $requirements;
  32. }
  33. /**
  34. * Implements hook_install().
  35. */
  36. function metatag_opengraph_install() {
  37. // Display a warning about possible conflicts with the RDF module.
  38. if (module_exists('rdf')) {
  39. 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.'));
  40. }
  41. }
  42. /**
  43. * Implementations of hook_update_N().
  44. */
  45. /**
  46. * Enable the new Metatag:Facebook submodule.
  47. */
  48. function metatag_opengraph_update_7100() {
  49. module_enable(array('metatag_facebook'));
  50. 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.'));
  51. }
  52. /**
  53. * Leave a warning about the two og:type value changes.
  54. */
  55. function metatag_opengraph_update_7101() {
  56. 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.'));
  57. }