// Warn if any experimental modules are installed.
$experimental = array();
$enabled_modules = system_rebuild_module_data();
foreach ($enabled_modules as $module => $data) {
if ($data->info['package'] === 'Core (Experimental)') {
$experimental[$module] = $data->info['name'];
}
}
if (!empty($experimental)) {
$requirements['experimental'] = array(
'title' => t('Experimental modules enabled'),
'value' => t('Experimental modules found: %module_list. Experimental modules are provided for testing purposes only. Use at your own risk.', array('%module_list' => implode(', ', $experimental))),
// If the Apache rewrite module is not enabled, Apache version must be >=
// 2.2.16 because of the FallbackResource directive in the root .htaccess
// file. Since the Apache version reported by the server is dependent on the
// ServerTokens setting in httpd.conf, we may not be able to determine if a
// given config is valid. Thus we are unable to use version_compare() as we
// need have three possible outcomes: the version of Apache is greater than
// 2.2.16, is less than 2.2.16, or cannot be determined accurately. In the
// first case, we encourage the use of mod_rewrite; in the second case, we
// raise an error regarding the minimum Apache version; in the third case,
// we raise a warning that the current version of Apache may not be
// supported.
$rewrite_warning = FALSE;
$rewrite_error = FALSE;
$apache_version_string = 'Apache';
// Determine the Apache version number: major, minor and revision.
if (preg_match('/Apache\/(\d+)\.?(\d+)?\.?(\d+)?/', $software, $matches)) {
$apache_version_string = $matches[0];
// Major version number
if ($matches[1] < 2) {
$rewrite_error = TRUE;
}
else if ($matches[1] == 2) {
if (!isset($matches[2])) {
$rewrite_warning = TRUE;
}
else if ($matches[2] < 2) {
$rewrite_error = TRUE;
}
else if ($matches[2] == 2) {
if (!isset($matches[3])) {
$rewrite_warning = TRUE;
}
else if ($matches[3] < 16) {
$rewrite_error = TRUE;
}
}
}
}
else {
$rewrite_warning = TRUE;
}
if ($rewrite_warning) {
$requirements['apache_version'] = array (
'title' => t('Apache version'),
'value' => $apache_version_string,
'severity' => REQUIREMENT_WARNING,
'description' => t('Due to the settings for ServerTokens in httpd.conf, it is impossible to accurately determine the version of Apache running on this server. The reported value is @reported, to run Drupal without mod_rewrite, a minimum version of 2.2.16 is needed.', array('@reported' => $apache_version_string)),
);
}
if ($rewrite_error) {
$requirements['Apache version'] = array (
'title' => t('Apache version'),
'value' => $apache_version_string,
'severity' => REQUIREMENT_ERROR,
'description' => t('The minimum version of Apache needed to run Drupal without mod_rewrite enabled is 2.2.16. See the <a href="@link">enabling clean URLs</a> page for more information on mod_rewrite.', array('@link' => 'http://drupal.org/node/15365')),
);
}
if (!$rewrite_error && !$rewrite_warning) {
$requirements['rewrite_module'] = array (
'title' => t('Clean URLs'),
'value' => t('Disabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended. <a href="@link">Enable clean URLs</a>', array('@link' => 'http://drupal.org/node/15365')),
'description' => t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information, <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array('@phpinfo' => 'https://www.drupal.org/node/243993')),
'severity' => REQUIREMENT_INFO,
);
}
if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) {
$requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
'description' => t('PHP versions higher than 5.6.5 or 5.5.21 provide built-in SQL injection protection for mysql databases. It is recommended to update.'),
'severity' => REQUIREMENT_INFO,
);
}
// Test for PHP extensions.
$requirements['php_extensions'] = array(
'title' => t('PHP extensions'),
);
$missing_extensions = array();
$required_extensions = array(
'date',
'dom',
'filter',
'gd',
'hash',
'json',
'pcre',
'pdo',
'session',
'SimpleXML',
'SPL',
'tokenizer',
'xml',
);
foreach ($required_extensions as $extension) {
if (!extension_loaded($extension)) {
$missing_extensions[] = $extension;
}
}
if (!empty($missing_extensions)) {
$description = t('Drupal requires you to enable the PHP extensions in the following list (see the <a href="@system_requirements">system requirements page</a> for more information):', array(
$pdo_message = t('Your web server does not appear to support PDO (PHP Data Objects). Ask your hosting provider if they support the native PDO extension. See the <a href="@link">system requirements</a> page for more information.', array(
// Make sure at least one supported database driver exists.
$drivers = drupal_detect_database_types();
if (empty($drivers)) {
$database_ok = FALSE;
$pdo_message = t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array(
// Make sure the native PDO extension is available, not the older PEAR
// version. (See install_verify_pdo() for details.)
if (!defined('PDO::ATTR_DEFAULT_FETCH_MODE')) {
$database_ok = FALSE;
$pdo_message = t('Your web server seems to have the wrong version of PDO installed. Drupal requires the PDO extension from PHP core. This system has the older PECL version. See the <a href="@link">system requirements</a> page for more information.', array(
if (!Environment::checkMemoryLimit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
$description = array();
if ($phase == 'install') {
$description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
}
elseif ($phase == 'update') {
$description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
}
elseif ($phase == 'runtime') {
$description['phase'] = t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
}
if (!empty($description['phase'])) {
if ($php_ini_path = get_cfg_var('cfg_file_path')) {
$description['memory'] = t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', array('%configuration-file' => $php_ini_path));
}
else {
$description['memory'] = t('Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.');
}
$handbook_link = t('For more information, see the online handbook entry for <a href="@memory-limit">increasing the PHP memory limit</a>.', array('@memory-limit' => 'https://www.drupal.org/node/207036'));
if (!drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir')) {
$conf_errors[] = t("The directory %file is not protected from modifications and poses a security risk. You must change the directory's permissions to be non-writable.", array('%file' => $site_path));
}
foreach (array('settings.php', 'settings.local.php', 'services.yml') as $conf_file) {
$full_path = $site_path . '/' . $conf_file;
if (file_exists($full_path) && !drupal_verify_install_file($full_path, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
$conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", array('%file' => $full_path));
}
}
if (!empty($conf_errors)) {
if (count($conf_errors) == 1) {
$description = $conf_errors[0];
}
else {
// We use twig inline_template to avoid double escaping.
'description' => t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array('@url' => 'https://www.drupal.org/SA-CORE-2013-003', '%directory' => $info['directory'])),
'#markup' => t('For more information, see the online handbook entry for <a href="@cron-handbook">configuring cron jobs</a>.', ['@cron-handbook' => 'https://www.drupal.org/cron']),
'#markup' => t('To run cron from outside the site, go to <a href="@cron">@cron</a>', ['@cron' => \Drupal::url('system.cron', ['key' => \Drupal::state()->get('system.cron_key'), ['absolute' => TRUE]])]),
'description' => t('Your %file file must define the $config_directories variable as an array containing the name of a directories in which configuration files can be written.', array('%file' => $site_path . '/settings.php')),
'severity' => REQUIREMENT_ERROR,
);
}
$requirements['file system'] = array(
'title' => t('File system'),
);
$error = '';
// For installer, create the directories if possible.
$error = t('The directory %directory does not exist.', array('%directory' => $directory));
}
else {
$error = t('The directory %directory is not writable.', array('%directory' => $directory));
}
// The files directory requirement check is done only during install and runtime.
if ($phase == 'runtime') {
$description = t('You may need to set the correct directory at the <a href="@admin-file-system">file system settings page</a> or change the current directory\'s permissions so that it is writable.', array('@admin-file-system' => \Drupal::url('system.file_system_settings')));
}
elseif ($phase == 'install') {
// For the installer UI, we need different wording. 'value' will
// be treated as version, so provide none there.
$description = t('An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the <a href="@handbook_url">online handbook</a>.', array('@handbook_url' => 'https://www.drupal.org/server-permissions'));
$requirements['update']['value'] = t('Out of date');
$requirements['update']['description'] = t('Some modules have database schema updates to install. You should run the <a href="@update">database update script</a> immediately.', array('@update' => \Drupal::url('system.db_update')));
'description' => t('The update.php script is accessible to everyone without authentication check, which is a security risk. You must change the @settings_name value in your settings.php back to FALSE.', array('@settings_name' => '$settings[\'update_free_access\']')),
);
}
else {
$requirements['update access'] = array(
'value' => t('Protected'),
);
}
$requirements['update access']['title'] = t('Access to update.php');
}
// Display an error if a newly introduced dependency in a module is not resolved.
if ($phase == 'update') {
$profile = drupal_get_profile();
$files = system_rebuild_module_data();
foreach ($files as $module => $file) {
// Ignore disabled modules and installation profiles.
if (!$file->status || $module == $profile) {
continue;
}
// Check the module's PHP version.
$name = $file->info['name'];
$php = $file->info['php'];
if (version_compare($php, PHP_VERSION, '>')) {
$requirements['php']['description'] .= t('@name requires at least PHP @version.', array('@name' => $name, '@version' => $php));
'description' => t('@name requires this module and version. Currently using @required_name version @version', array('@name' => $name, '@required_name' => $required_name, '@version' => $version)),
if (!\Drupal::moduleHandler()->moduleExists('update')) {
$requirements['update status'] = array(
'value' => t('Not enabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the Update Manager module from the <a href="@module">module administration page</a> in order to stay up-to-date on new releases. For more information, <a href="@update">Update status handbook page</a>.', array(
'description' => t('The rebuild_access setting is enabled in settings.php. It is recommended to have this setting disabled unless you are performing a rebuild.'),
);
}
}
// See if trusted hostnames have been configured, and warn the user if they
'description' => t('The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is <strong>highly recommended</strong> that you configure this. See <a href="@url">Protecting against HTTP HOST Header attacks</a> for more information.', array('@url' => 'https://www.drupal.org/node/1992030')),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements['trusted_host_patterns'] = array(
'title' => t('Trusted Host Settings'),
'value' => t('Enabled'),
'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', array('%trusted_host_patterns' => join(', ', $trusted_host_patterns))),
$requirements['twig_c_extension']['description'] = t('Enabling the Twig C extension can greatly increase rendering performance. See <a href="@url">the installation instructions</a> for more detail.', ['@url' => $url]);
}
else {
$requirements['twig_c_extension']['description'] = t('The <a href="@url">Twig C extension</a> is available', ['@url' => $url]);
}
}
// Check xdebug.max_nesting_level, as some pages will not work if it is too
// low.
if (extension_loaded('xdebug')) {
// Setting this value to 256 was considered adequate on Xdebug 2.3
// (see http://bugs.xdebug.org/bug_view_page.php?bug_id=00001100)
if ($current_nesting_level < $minimum_nesting_level) {
$requirements['xdebug_max_nesting_level'] = [
'title' => t('Xdebug settings'),
'value' => t('xdebug.max_nesting_level is set to %value.', ['%value' => $current_nesting_level]),
'description' => t('Set <code>xdebug.max_nesting_level=@level</code> in your PHP configuration as some pages in your Drupal site will not work when this setting is too low.', ['@level' => $minimum_nesting_level]),
'description' => 'Stores details about batches (processes that run in multiple HTTP requests).',
'fields' => array(
'bid' => array(
'description' => 'Primary Key: Unique batch ID.',
// This is not a serial column, to allow both progressive and
// non-progressive batches. See batch_process().
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'token' => array(
'description' => "A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.",
'type' => 'varchar_ascii',
'length' => 64,
'not null' => TRUE,
),
'timestamp' => array(
'description' => 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.',
'type' => 'int',
'not null' => TRUE,
),
'batch' => array(
'description' => 'A serialized array containing the processing data for the batch.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
),
),
'primary key' => array('bid'),
'indexes' => array(
'token' => array('token'),
),
);
$schema['flood'] = array(
'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
'fields' => array(
'fid' => array(
'description' => 'Unique flood event ID.',
'type' => 'serial',
'not null' => TRUE,
),
'event' => array(
'description' => 'Name of event (e.g. contact).',
'type' => 'varchar_ascii',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'identifier' => array(
'description' => 'Identifier of the visitor, such as an IP address or hostname.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => 'Timestamp of the event.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'expiration' => array(
'description' => 'Expiration timestamp. Expired events are purged on cron run.',
'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as state since they must not be cached.',
'fields' => array(
'name' => array(
'description' => 'Primary Key: Unique name.',
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => ''
),
'value' => array(
'description' => 'A value for the semaphore.',
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => ''
),
'expire' => array(
'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
'type' => 'float',
'size' => 'big',
'not null' => TRUE
),
),
'indexes' => array(
'value' => array('value'),
'expire' => array('expire'),
),
'primary key' => array('name'),
);
$schema['sequences'] = array(
'description' => 'Stores IDs.',
'fields' => array(
'value' => array(
'description' => 'The value of the sequence.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('value'),
);
$schema['sessions'] = array(
'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
'fields' => array(
'uid' => array(
'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'sid' => array(
'description' => "A session ID (hashed). The value is generated by Drupal's session handlers.",
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
),
'hostname' => array(
'description' => 'The IP address that last used this session ID (sid).',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'timestamp' => array(
'description' => 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'session' => array(
'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
),
),
'primary key' => array(
'sid',
),
'indexes' => array(
'timestamp' => array('timestamp'),
'uid' => array('uid'),
),
'foreign keys' => array(
'session_user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
);
$schema['url_alias'] = array(
'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.',
'fields' => array(
'pid' => array(
'description' => 'A unique path alias identifier.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'source' => array(
'description' => 'The Drupal path this alias is for; e.g. node/12.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'alias' => array(
'description' => 'The alias for this path; e.g. title-of-the-story.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'langcode' => array(
'description' => "The language code this alias is for; if 'und', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.",
$menu_links = $database->queryRange('SELECT mlid, system_update_8001_title AS title, system_update_8001_description AS description FROM {menu_tree} ORDER BY mlid ASC', $sandbox['current'], $sandbox['current'] + 50)
$message = t('Because your site has custom theme(s) installed, we had to set local actions and tasks blocks into the content region. Please manually review the block configurations and remove the removed variables from your templates.');
}
return $message;
}
/**
* Helper function to create block configuration objects for the update.
*
* @param string $name
* The name of the config object.
* @param string $theme_name
* The name of the theme the block is associated with.
* @param array $values
* The block config values.
*/
function _system_update_create_block($name, $theme_name, array $values) {
if (!\Drupal::service('config.storage')->exists($name)) {