123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?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')) {
- // Work out the release of D7 that is currently running.
- list($major, $minor) = explode('.', VERSION);
- // Strip off any suffixes on the version string, e.g. "17-dev".
- if (strpos('-', $minor)) {
- list($minor, $suffix) = explode('-', $minor);
- }
- if ($minor < 33) {
- $requirements['metatag_og_rdf'] = array(
- 'severity' => REQUIREMENT_WARNING,
- 'title' => 'Metatag:OpenGraph',
- 'value' => $t('RDF problems with Drupal core releases before v7.33'),
- '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.'),
- );
- }
- }
- }
- return $requirements;
- }
- /**
- * Implements hook_update_dependencies().
- */
- function metatag_opengraph_update_dependencies() {
- // OpenGraph update 7103 requires the complete Metatag schema, so lets wait
- // for Metatag update 7100 just to be sure.
- $dependencies['metatag_opengraph'][7103] = array(
- 'metatag' => 7100,
- );
- return $dependencies;
- }
- /**
- * 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.'));
- }
- /**
- * The Open Graph Products meta tags are now in a new submodule.
- */
- function metatag_opengraph_update_7102() {
- drupal_set_message(t('The Open Graph Products meta tags have been moved into the new "Metatag: Open Graph Products" submodule.'));
- }
- /**
- * Change og:video to og:video:url in all metatags.
- */
- function metatag_opengraph_update_7103(&$sandbox) {
- module_load_include('install', 'metatag');
- $old_tag = 'og:video';
- $new_tag = 'og:video:url';
- return metatag_update_replace_entity_tag($sandbox, $old_tag, $new_tag);
- }
- /**
- * Rename the 'og:video' meta tag to 'og:video:url' in the configs.
- */
- function metatag_opengraph_update_7104() {
- module_load_include('install', 'metatag');
- $old_tag = 'og:video';
- $new_tag = 'og:video:url';
- return metatag_update_replace_config_tag($old_tag, $new_tag);
- }
- /**
- * Clear the Metatag cache to pick up changes to og:video.
- */
- function metatag_opengraph_update_7105() {
- cache_clear_all('*', 'cache_metatag', TRUE);
- return t('All Metatag caches cleared.');
- }
- /**
- * Clear the Metatag cache to pick up changes to og:audio:secure_url.
- */
- function metatag_opengraph_update_7106() {
- cache_clear_all('*', 'cache_metatag', TRUE);
- return t('All Metatag caches cleared.');
- }
|