Skip to content
Snippets Groups Projects
Commit d5d5ef8d authored by Abdullah Yassin's avatar Abdullah Yassin Committed by Rajab Natshah
Browse files

Issue #3277590 by Abdullah Yassin: Have a Varbase installation requirement (...

Issue #3277590 by Abdullah Yassin: Have a Varbase installation requirement ( notification, not a blocker)
parent e05015ad
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ use Drupal\varbase\Form\AssemblerForm; ...@@ -14,6 +14,7 @@ use Drupal\varbase\Form\AssemblerForm;
use Drupal\varbase\Form\DevelopmentToolsAssemblerForm; use Drupal\varbase\Form\DevelopmentToolsAssemblerForm;
use Vardot\Entity\EntityDefinitionUpdateManager; use Vardot\Entity\EntityDefinitionUpdateManager;
use Drupal\path_alias\Entity\PathAlias; use Drupal\path_alias\Entity\PathAlias;
use Drupal\Component\Utility\Environment;
/** /**
* Implements hook_form_FORM_ID_alter() for install_configure_form(). * Implements hook_form_FORM_ID_alter() for install_configure_form().
...@@ -713,3 +714,49 @@ function varbase_toolbar_alter(&$items) { ...@@ -713,3 +714,49 @@ function varbase_toolbar_alter(&$items) {
$items['admin_toolbar_tools']['#attached']['library'][] = 'varbase/toolbar.icon'; $items['admin_toolbar_tools']['#attached']['library'][] = 'varbase/toolbar.icon';
} }
} }
/**
* Implements hook_requirements().
*/
function varbase_requirements($phase) {
$requirements = [];
$phpVersion = phpversion();
$memoryLimit = ini_get('memory_limit');
$maxExecutionTime = ini_get('max_execution_time');
if ($phase === "install") {
if (version_compare($phpVersion, "8.0", "<")) {
$requirements['php'] = [
'title' => t('PHP'),
'description' => t('Your PHP installation is too old. It is recommended to upgrade to PHP version <b>%php_version</b> or higher for the best ongoing support. See <a href="http://php.net/supported-versions.php">PHP\'s version support documentation</a>', ['%php_version' => "8.0"]),
'severity' => REQUIREMENT_WARNING,
];
}
if (!Environment::checkMemoryLimit(256, $memoryLimit)) {
$requirements['php_memory_limit'] = [
'title' => t('PHP memory limit'),
'description' => t('Consider increasing your PHP memory limit to <b>%memory_recommended_limit</b> M to help prevent errors in the installation process.', ['%memory_recommended_limit' => 256]),
'severity' => REQUIREMENT_WARNING,
];
}
if ($maxExecutionTime < 180) {
$requirements['max_execution_time'] = [
'title' => t('Recommended maximum execution time'),
'description' => t('Your current setting for <b>max_execution_time</b> is less than <b>%recommended_max_execution_time</b>. Change your PHP settings or contact your server administrator to set it to the recommended value.', ['%recommended_max_execution_time' => 180]),
'severity' => REQUIREMENT_WARNING,
];
}
if (!extension_loaded('yaml')) {
$requirements['php_yaml_extension'] = [
'title' => 'PHP YAML extension',
'description' => t('The PHP YAML extension is not enabled. It is recommended that you enable the PHP YAML extension for your server.'),
'severity' => REQUIREMENT_WARNING,
];
}
}
return $requirements;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment