From 3b6e90d36bb4346d36d5790fa39ec04f9d32d8e6 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Sat, 9 May 2015 06:00:32 -0700 Subject: [PATCH] Issue #2160643 by jhedstrom, dawehener: Add status report "requirement" for Twig C extension for PHP --- core/modules/system/system.install | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 6c3db4608c9..8f9c15f5575 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -648,6 +648,22 @@ function system_requirements($phase) { } } + // Check if the Twig C extension is available. + if ($phase == 'runtime') { + $url = 'http://twig.sensiolabs.org/doc/installation.html#installing-the-c-extension'; + $requirements['twig_c_extension'] = [ + 'title' => t('Twig C extension'), + 'severity' => REQUIREMENT_INFO, + ]; + if (!function_exists('twig_template_get_attributes')) { + $requirements['twig_c_extension']['value'] = t('Not available'); + $requirements['twig_c_extension']['description'] = t('Enabling the Twig C extension can greatly increase rendering performance. See the installation instructions for more detail.', ['@url' => $url]); + } + else { + $requirements['twig_c_extension']['description'] = t('The Twig C extension is available', ['@url' => $url]); + } + } + return $requirements; }