diff --git a/core/modules/views/views.install b/core/modules/views/views.install index d3c0dee..32aabb4 100644 --- a/core/modules/views/views.install +++ b/core/modules/views/views.install @@ -27,3 +27,33 @@ function views_schema_0() { $schema['cache_views_results'] = $cache_schema; return $schema; } + +/** + * Implements hook_requirements(). + */ +function views_requirements($phase) { + $requirements = array(); + // Display a warning if the user attempts to update with a Drupal 7 version + // of Views. An upgrade path is provided by the views_d8_upgrade contributed + // module, which uninstalls Views before beginning the Drupal 8 upgrade. + if ($phase == 'update') { + // If Views is installed but has a schema version less than 8000, we can + // assume it is a pre-Drupal version of Views from contrib. + $version = (int) drupal_get_installed_schema_version('views'); + if (($version != SCHEMA_UNINSTALLED) && ($version < 8000)) { + $requirements['views_upgrade'] = array( + 'title' => t('Installed Views version'), + 'value' => $version, + 'severity' => REQUIREMENT_ERROR, + 'description' => t( + 'Your installed version of Views is too old. To migrade Views data from Drupal 7, install and run the Views Drupal 7 to Drupal 8 upgrade module before installing Drupal 8.', + array( + '@url' => url('http://drupal.org/project/views_d8_upgrade'), + ) + ), + ); + } + } + + return $requirements; +}