Commit 4fdb0167 authored by Niels de Ruijter's avatar Niels de Ruijter Committed by Robert Ragas

Issue #2573979 by Niels de Ruijter, realityloop: Warning in status report

parent 17a81ef6
......@@ -4,73 +4,6 @@
* Install, update, and uninstall functions for the Yoast SEO for Drupal module.
*/
/**
* Implements hook_requirements().
*/
function yoast_seo_requirements($phase) {
$requirements = array();
// Ensure translations don't break during installation.
$t = get_t();
// We want to make sure the correct JavaScript files have been placed in the
// libraries.
if ($phase == 'runtime') {
$requirements['yoast_seo'] = array(
'title' => $t('Yoast SEO for Drupal'),
);
// Is installed correctly?
$dependencies = _yoast_seo_requirements_getinstalledversion();
if (!in_array(NULL, $dependencies)) {
$requirements['yoast_seo'] += array(
'value' => 'Installed',
'severity' => REQUIREMENT_OK,
);
}
else {
$description = '';
foreach ($dependencies as $dependency => $version) {
if ($dependency == 'js-text-analysis' && is_null($version)) {
$description .= $t('Without the text analysis tool the Yoast SEO won\'t function properly. Please download it at <a href="@link">@link</a> and place it in the libraries folder.', array('@link' => 'https://github.com/Yoast/js-text-analysis'));
}
$description .= ' ';
}
$requirements['yoast_seo'] += array(
'value' => $t('Not found'),
'description' => $description,
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
/**
* Determines the version of the JS text analysis tool.
*/
function _yoast_seo_requirements_getinstalledversion() {
module_load_include('module', 'yoast_seo');
$dependencies = array(
'js-text-analysis' => NULL,
);
foreach ($dependencies as $dependency => $version) {
$file = '';
if ($dependency == 'js-text-analysis') {
$file = yoast_seo_library_path($dependency, 'local') . '/js/dist/yoast-seo-content-analysis.min.js';
}
$file_content = @file_get_contents($file);
if ($file_content) {
$dependencies[$dependency] = 'TBD';
}
}
return $dependencies;
}
/**
* Implements hook_schema().
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment