Prvi komit

Jurij Podgoršek 2022-03-17 14:45:47 +01:00
parent e60dc60aac
commit ec30cafe87
17308 changed files with 1865105 additions and 0 deletions

197
.ddev/config.yaml 100644
View File

@ -0,0 +1,197 @@
name: naprostem
type: drupal9
docroot: web
php_version: "7.4"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
mariadb_version: "10.3"
mysql_version: ""
nfs_mount_enabled: false
mutagen_enabled: false
use_dns_when_possible: true
composer_version: "2"
web_environment: []
# Key features of ddev's config.yaml:
# name: <projectname> # Name of the project, automatically provides
# http://projectname.ddev.site and https://projectname.ddev.site
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "7.4" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1"
# You can explicitly specify the webimage, dbimage, dbaimage lines but this
# is not recommended, as the images are often closely tied to ddev's' behavior,
# so this can break upgrades.
# webimage: <docker_image> # nginx/php docker image.
# dbimage: <docker_image> # mariadb docker image.
# dbaimage: <docker_image>
# mariadb_version and mysql_version
# ddev can use many versions of mariadb and mysql
# However these directives are mutually exclusive
# mariadb_version: 10.2
# mysql_version: 8.0
# router_http_port: <port> # Port to be used for http (defaults to port 80)
# router_https_port: <port> # Port for https (defaults to 443)
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xdebug" to enable xdebug and "ddev xdebug off" to disable it work better,
# as leaving xdebug enabled all the time is a big performance hit.
# xhprof_enabled: false # Set to true to enable xhprof and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xhprof" to enable xhprof and "ddev xhprof off" to disable it work better,
# as leaving xhprof enabled all the time is a big performance hit.
# webserver_type: nginx-fpm # or apache-fpm
# timezone: Europe/Berlin
# This is the timezone used in the containers and by PHP;
# it can be set to any valid timezone,
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# For example Europe/Dublin or MST7MDT
# composer_version: "2"
# if composer_version:"2" it will use the most recent composer v2
# It can also be set to "1", to get most recent composer v1
# or "" for the default v2 created at release time.
# It can be set to any existing specific composer version.
# After first project 'ddev start' this will not be updated until it changes
# additional_hostnames:
# - somename
# - someothername
# would provide http and https URLs for "somename.ddev.site"
# and "someothername.ddev.site".
# additional_fqdns:
# - example.com
# - sub1.example.com
# would provide http and https URLs for "example.com" and "sub1.example.com"
# Please take care with this because it can cause great confusion.
# upload_dir: custom/upload/dir
# would set the destination path for ddev import-files to <docroot>/custom/upload/dir
# working_dir:
# web: /var/www/html
# db: /home
# would set the default working directory for the web and db services.
# These values specify the destination directory for ddev ssh and the
# directory in which commands passed into ddev exec are run.
# omit_containers: [db, dba, ddev-ssh-agent]
# Currently only these containers are supported. Some containers can also be
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
# the "db" container, several standard features of ddev that access the
# database container will be unusable. In the global configuration it is also
# possible to omit ddev-router, but not here.
# nfs_mount_enabled: false
# Great performance improvement but requires host configuration first.
# See https://ddev.readthedocs.io/en/stable/users/performance/#using-nfs-to-mount-the-project-into-the-container
# mutagen_enabled: false
# Experimental performance improvement using mutagen asynchronous updates.
# See https://ddev.readthedocs.io/en/latest/users/performance/#using-mutagen
# fail_on_hook_fail: False
# Decide whether 'ddev start' should be interrupted by a failing hook
# host_https_port: "59002"
# The host port binding for https can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_webserver_port: "59001"
# The host port binding for the ddev-webserver can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_db_port: "59002"
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
# unless explicitly specified.
# phpmyadmin_port: "8036"
# phpmyadmin_https_port: "8037"
# The PHPMyAdmin ports can be changed from the default 8036 and 8037
# host_phpmyadmin_port: "8036"
# The phpmyadmin (dba) port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be specified and bound.
# mailhog_port: "8025"
# mailhog_https_port: "8026"
# The MailHog ports can be changed from the default 8025 and 8026
# host_mailhog_port: "8025"
# The mailhog port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be bound directly to localhost if specified here.
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
# Extra Debian packages that are needed in the webimage can be added here
# dbimage_extra_packages: [telnet,netcat]
# Extra Debian packages that are needed in the dbimage can be added here
# use_dns_when_possible: true
# If the host has internet access and the domain configured can
# successfully be looked up, DNS will be used for hostname resolution
# instead of editing /etc/hosts
# Defaults to true
# project_tld: ddev.site
# The top-level domain used for project URLs
# The default "ddev.site" allows DNS lookup via a wildcard
# If you prefer you can change this to "ddev.local" to preserve
# pre-v1.9 behavior.
# ngrok_args: --subdomain mysite --auth username:pass
# Provide extra flags to the "ngrok http" command, see
# https://ngrok.com/docs#http or run "ngrok http -h"
# disable_settings_management: false
# If true, ddev will not create CMS-specific settings files like
# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php
# In this case the user must provide all such settings.
# You can inject environment variables into the web container with:
# web_environment:
# - SOMEENV=somevalue
# - SOMEOTHERENV=someothervalue
# no_project_mount: false
# (Experimental) If true, ddev will not mount the project into the web container;
# the user is responsible for mounting it manually or via a script.
# This is to enable experimentation with alternate file mounting strategies.
# For advanced users only!
# bind_all_interfaces: false
# If true, host ports will be bound on all network interfaces,
# not just the localhost interface. This means that ports
# will be available on the local network if the host firewall
# allows it.
# Many ddev commands can be extended to run tasks before or after the
# ddev command is executed, for example "post-start", "post-import-db",
# "pre-composer", "post-composer"
# See https://ddev.readthedocs.io/en/stable/users/extending-commands/ for more
# information on the commands that can be extended and the tasks you can define
# for them. Example:
#hooks:
# post-import-db:
# - exec: drush cr
# - exec: drush updb

17
.editorconfig 100644
View File

@ -0,0 +1,17 @@
# Drupal editor configuration normalization
# @see http://editorconfig.org/
# This is the top-most .editorconfig file; do not search in parent directories.
root = true
# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[composer.{json,lock}]
indent_size = 4

61
.gitattributes vendored 100644
View File

@ -0,0 +1,61 @@
# Drupal git normalization
# @see https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# @see https://www.drupal.org/node/1542048
# Normally these settings would be done with macro attributes for improved
# readability and easier maintenance. However macros can only be defined at the
# repository root directory. Drupal avoids making any assumptions about where it
# is installed.
# Define text file attributes.
# - Treat them as text.
# - Ensure no CRLF line-endings, neither on checkout nor on checkin.
# - Detect whitespace errors.
# - Exposed by default in `git diff --color` on the CLI.
# - Validate with `git diff --check`.
# - Deny applying with `git apply --whitespace=error-all`.
# - Fix automatically with `git apply --whitespace=fix`.
*.config text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.dist text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.engine text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=html
*.inc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.install text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.map text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.module text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.po text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.profile text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.script text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.sql text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.svg text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.theme text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.twig text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
# Define binary file attributes.
# - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ."
*.eot -text diff
*.exe -text diff
*.gif -text diff
*.gz -text diff
*.ico -text diff
*.jpeg -text diff
*.jpg -text diff
*.otf -text diff
*.phar -text diff
*.png -text diff
*.svgz -text diff
*.ttf -text diff
*.woff -text diff
*.woff2 -text diff

2
.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
vendor/
web/sites/default/files/*

74
composer.json 100644
View File

@ -0,0 +1,74 @@
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"drupal/admin_toolbar": "^3.1",
"drupal/core-composer-scaffold": "^9.3",
"drupal/core-project-message": "^9.3",
"drupal/core-recommended": "^9.3",
"drush/drush": "^11.0"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"drupal/core-composer-scaffold": true,
"drupal/core-project-message": true
}
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": [
"type:drupal-core"
],
"web/libraries/{$name}": [
"type:drupal-library"
],
"web/modules/contrib/{$name}": [
"type:drupal-module"
],
"web/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"web/themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"web/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"web/profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"web/themes/custom/{$name}": [
"type:drupal-custom-theme"
]
}
}
}

6299
composer.lock generated 100644

File diff suppressed because it is too large Load Diff

40
web/.csslintrc 100644
View File

@ -0,0 +1,40 @@
--errors=box-model,
display-property-grouping,
duplicate-background-images,
duplicate-properties,
empty-rules,
ids,
import,
important,
known-properties,
outline-none,
overqualified-elements,
qualified-headings,
shorthand,
star-property-hack,
text-indent,
underscore-property-hack,
unique-headings,
unqualified-attributes,
vendor-prefix,
zero-units
--ignore=adjoining-classes,
box-sizing,
bulletproof-font-face,
compatible-vendor-prefixes,
errors,
fallback-colors,
floats,
font-faces,
font-sizes,
gradients,
import-ie-limit,
order-alphabetical,
regex-selectors,
rules-count,
selector-max,
selector-max-approaching,
selector-newline,
universal-selector
--exclude-list=core/assets,
vendor

View File

@ -0,0 +1,8 @@
core/**/*
vendor/**/*
sites/**/files/**/*
libraries/**/*
sites/**/libraries/**/*
profiles/**/libraries/**/*
**/js_test_files/**/*
**/node_modules/**/*

View File

@ -0,0 +1,3 @@
{
"extends": "./core/.eslintrc.json"
}

65
web/.ht.router.php 100644
View File

@ -0,0 +1,65 @@
<?php
/**
* @file
* Router script for the built-in PHP web server.
*
* The built-in web server should only be used for development and testing as it
* has a number of limitations that makes running Drupal on it highly insecure
* and somewhat limited.
*
* Note that:
* - The server is single-threaded, any requests made during the execution of
* the main request will hang until the main request has been completed.
* - The web server does not enforce any of the settings in .htaccess in
* particular a remote user will be able to download files that normally would
* be protected from direct access such as .module files.
*
* The router script is needed to work around a bug in PHP, see
* https://bugs.php.net/bug.php?id=61286.
*
* Usage:
* php -S localhost:8888 .ht.router.php
*
* @see http://php.net/manual/en/features.commandline.webserver.php
*/
$url = parse_url($_SERVER['REQUEST_URI']);
if (file_exists(__DIR__ . $url['path'])) {
// Serve the requested resource as-is.
return FALSE;
}
// Work around the PHP bug.
$path = $url['path'];
$script = 'index.php';
if (strpos($path, '.php') !== FALSE) {
// Work backwards through the path to check if a script exists. Otherwise
// fallback to index.php.
do {
$path = dirname($path);
if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) {
// Discovered that the path contains an existing PHP file. Use that as the
// script to include.
$script = ltrim($path, '/');
break;
}
} while ($path !== '/' && $path !== '.');
}
// Update $_SERVER variables to point to the correct index-file.
$index_file_absolute = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $script;
$index_file_relative = DIRECTORY_SEPARATOR . $script;
// SCRIPT_FILENAME will point to the router script itself, it should point to
// the full path of index.php.
$_SERVER['SCRIPT_FILENAME'] = $index_file_absolute;
// SCRIPT_NAME and PHP_SELF will either point to index.php or contain the full
// virtual path being requested depending on the URL being requested. They
// should always point to index.php relative to document root.
$_SERVER['SCRIPT_NAME'] = $index_file_relative;
$_SERVER['PHP_SELF'] = $index_file_relative;
// Require the script and let core take over.
require $_SERVER['SCRIPT_FILENAME'];

182
web/.htaccess 100644
View File

@ -0,0 +1,182 @@
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
</IfModule>
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Set the default handler.
DirectoryIndex index.php index.html index.htm
# Add correct encoding for SVGZ.
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Most of the following PHP settings cannot be changed at runtime. See
# sites/default/default.settings.php and
# Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
# changed at runtime.
# PHP 7, Apache 1 and 2.
<IfModule mod_php7.c>
php_value assert.active 0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>
# Set a fallback resource if mod_rewrite is not enabled. This allows Drupal to
# work without clean URLs. This requires Apache version >= 2.2.16. If Drupal is
# not accessed by the top level URL (i.e.: http://example.com/drupal/ instead of
# http://example.com/), the path to index.php will need to be adjusted.
<IfModule !mod_rewrite.c>
FallbackResource /index.php
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "/\.|^\.(?!well-known/)" - [F]
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/foo will be redirected to http://www.example.com/foo)
# uncomment the following:
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/foo will be redirected to http://example.com/foo)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
# Redirect common PHP files to their new locations.
RewriteCond %{REQUEST_URI} ^(.*)?/(install\.php) [OR]
RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild\.php)
RewriteCond %{REQUEST_URI} !core
RewriteRule ^ %1/core/%2 [L,QSA,R=301]
# Rewrite install.php during installation to see if mod_rewrite is working
RewriteRule ^core/install\.php core/install.php?rewrite=ok [QSA,L]
# Pass all requests not referring directly to files in the filesystem to
# index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
# For security reasons, deny access to other PHP files on public sites.
# Note: The following URI conditions are not anchored at the start (^),
# because Drupal may be located in a subdirectory. To further improve
# security, you can replace '!/' with '!^/'.
# Allow access to PHP files in /core (like authorize.php or install.php):
RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
# Allow access to test-specific PHP files:
RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?\.php
# Allow access to Statistics module's custom front controller.
# Copy and adapt this rule to directly execute PHP files in contributed or
# custom modules or to run another PHP application in the same directory.
RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics\.php$
# Deny access to any other PHP files that do not match the rules above.
# Specifically, disallow autoload.php from being served directly.
RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
# Serve correct content types, and prevent double compression.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header set Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>
# Various header fixes.
<IfModule mod_headers.c>
# Disable content sniffing, since it's an attack vector.
Header always set X-Content-Type-Options nosniff
# Disable Proxy header, since it's an attack vector.
RequestHeader unset Proxy
</IfModule>

3
web/INSTALL.txt 100644
View File

@ -0,0 +1,3 @@
Please read core/INSTALL.txt for detailed installation instructions for your
Drupal website.

75
web/README.md 100644
View File

@ -0,0 +1,75 @@
<img alt="Drupal Logo" src="https://www.drupal.org/files/Wordmark_blue_RGB.png" height="60px">
Drupal is an open source content management platform supporting a variety of
websites ranging from personal weblogs to large community-driven websites. For
more information, visit the Drupal website, [Drupal.org][Drupal.org], and join
the [Drupal community][Drupal community].
## Contributing
Drupal is developed on [Drupal.org][Drupal.org], the home of the international
Drupal community since 2001!
[Drupal.org][Drupal.org] hosts Drupal's [GitLab repository][GitLab repository],
its [issue queue][issue queue], and its [documentation][documentation]. Before
you start working on code, be sure to search the [issue queue][issue queue] and
create an issue if your aren't able to find an existing issue.
Every issue on Drupal.org automatically creates a new community-accessible fork
that you can contribute to. Learn more about the code contribution process on
the [Issue forks & merge requests page][issue forks].
## Usage
For a brief introduction, see [USAGE.txt](/core/USAGE.txt). You can also find
guides, API references, and more by visiting Drupal's [documentation
page][documentation].
You can quickly extend Drupal's core feature set by installing any of its
[thousands of free and open source modules][modules]. With Drupal and its
module ecosystem, you can often build most or all of what your project needs
before writing a single line of code.
## Changelog
Drupal keeps detailed [change records][changelog]. You can search Drupal's
changes for a record of every notable breaking change and new feature since
2011.
## Security
For a list of security announcements, see the [Security advisories
page][Security advisories] (available as [an RSS feed][security RSS]). This
page also describes how to subscribe to these announcements via email.
For information about the Drupal security process, or to find out how to report
a potential security issue to the Drupal security team, see the [Security team
page][security team].
## Need a helping hand?
Visit the [Support page][support] or browse [over a thousand Drupal
providers][service providers] offering design, strategy, development, and
hosting services.
## Legal matters
Know your rights when using Drupal by reading Drupal core's
[license](/core/LICENSE.txt).
Learn about the [Drupal trademark and logo policy here][trademark].
[Drupal.org]: https://www.drupal.org
[Drupal community]: https://www.drupal.org/community
[GitLab repository]: https://git.drupalcode.org/project/drupal
[issue queue]: https://www.drupal.org/project/issues/drupal
[issue forks]: https://www.drupal.org/drupalorg/docs/gitlab-integration/issue-forks-merge-requests
[documentation]: https://www.drupal.org/documentation
[changelog]: https://www.drupal.org/list-changes/drupal
[modules]: https://www.drupal.org/project/project_module
[security advisories]: https://www.drupal.org/security
[security RSS]: https://www.drupal.org/security/rss.xml
[security team]: https://www.drupal.org/drupal-security-team
[service providers]: https://www.drupal.org/drupal-services
[support]: https://www.drupal.org/support
[trademark]: https://www.drupal.com/trademark

16
web/autoload.php 100644
View File

@ -0,0 +1,16 @@
<?php
/**
* @file
* Includes the autoloader created by Composer.
*
* This file was generated by drupal-scaffold.
*
* @see composer.json
* @see index.php
* @see core/install.php
* @see core/rebuild.php
* @see core/modules/statistics/statistics.php
*/
return require __DIR__ . '/../vendor/autoload.php';

View File

@ -0,0 +1,61 @@
{
"version": "0.1",
"language": "en-US",
"allowCompoundWords": false,
"ignorePaths": [
".*.json",
".*ignore",
"composer.lock",
"assets/vendor/**",
"lib/Drupal/Component/Diff/**",
"lib/Drupal/Component/Transliteration/data/**",
"lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php",
"**/LICENSE.txt",
"../**/LICENSE.txt",
"modules/**/Migrate*Test.php",
"modules/ckeditor5/js/build/*",
"modules/color/preview.html",
"modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html",
"modules/media/tests/fixtures/oembed/*",
"modules/migrate_drupal/tests/fixtures/drupal6.php",
"modules/migrate_drupal/tests/fixtures/drupal7.php",
"modules/search/tests/UnicodeTest.txt",
"modules/system/tests/logo.svgz",
"node_modules/*",
"profiles/demo_umami/modules/demo_umami_content/default_content/languages/es/**/*",
"tests/fixtures/files/*",
"tests/Drupal/Tests/Component/Annotation/Doctrine/**",
"themes/bartik/color/preview.html",
"themes/olivero/fonts/**",
"COPYRIGHT.txt",
"MAINTAINERS.txt",
"package.json",
"yarn.lock",
"misc/cspell/dictionary.txt"
],
"ignoreRegExpList": [
"^msgstr .*",
"!!binary .*",
"%[0-9][0-9A-F]",
"\\Wi18n",
"\\x{[0-9A-F]{4,5}}"
],
"dictionaries": ["drupal","companies", "fonts", "html", "php", "softwareTerms"],
"dictionaryDefinitions": [
{ "name": "drupal", "path": "./misc/cspell/dictionary.txt"}
],
"flagWords": [
"grey",
"hte"
],
"overrides": [
{
"filename": "**/{*.engine,*.inc,*.install,*.module,*.profile,*.theme}",
"languageId": "php"
},
{
"filename": "**/scripts/{*.php.txt, *.sh}",
"languageId": "php"
}
]
}

View File

@ -0,0 +1,77 @@
# This is a dotenv file used by JavaScript tasks.
# Copy this to '.env' to override.
#############################
# General Test Environment #
#############################
# This is the URL that Drupal can be accessed by. You don't need an installed
# site here, just make sure you can at least access the installer screen. If you
# don't already have one running, e.g. Apache, you can use PHP's built-in web
# server by running the following command in your Drupal root folder:
# php -S localhost:8888 .ht.router.php
# DRUPAL_TEST_BASE_URL=http://localhost:8888
DRUPAL_TEST_BASE_URL=
# Tests need to be executed with a user in the same group as the web server
# user.
#DRUPAL_TEST_WEBSERVER_USER=www-data
# By default we use sqlite as database. Use
# mysql://username:password@localhost/databasename#table_prefix for mysql.
DRUPAL_TEST_DB_URL=sqlite://localhost/sites/default/files/db.sqlite
#############
# Webdriver #
#############
# If Chromedriver is running as a service elsewhere, set it here.
# When using DRUPAL_TEST_CHROMEDRIVER_AUTOSTART leave this at the default settings.
DRUPAL_TEST_WEBDRIVER_HOSTNAME=localhost
DRUPAL_TEST_WEBDRIVER_PORT=9515
# If using Selenium, override the path prefix here.
# See http://nightwatchjs.org/gettingstarted#browser-drivers-setup
#DRUPAL_TEST_WEBDRIVER_PATH_PREFIX=/wd/hub
################
# Chromedriver #
################
# Automatically start chromedriver for local development. Set to false when you
# use your own webdriver or chromedriver setup.
# Also set it to false when you use a different browser for testing.
DRUPAL_TEST_CHROMEDRIVER_AUTOSTART=true
# A list of arguments to pass to Chrome, separated by spaces
# e.g. `--disable-gpu --headless --no-sandbox`.
#DRUPAL_TEST_WEBDRIVER_CHROME_ARGS=
##############
# Nightwatch #
##############
# Nightwatch generates output files. Use this to specify the location where these
# files need to be stored. The default location is ignored by git, if you modify
# the location you will probably want to add this location to your .gitignore.
DRUPAL_NIGHTWATCH_OUTPUT=reports/nightwatch
# The path that Nightwatch searches for assumes the same directory structure as
# when you download Drupal core. If you have Drupal installed into a docroot
# folder, you can use the following folder structure to add integration tests
# for your project, outside of tests specifically for custom modules/themes/profiles.
#
# .
# ├── docroot
# │ ├── core
# ├── tests
# │ ├── Nightwatch
# │ │ ├── Tests
# │ │ │ ├── myTest.js
#
# and then set DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY=../
#
#DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY=
# Filter directories to look for tests. This uses minimatch syntax.
# Separate folders with a comma.
DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES=node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest

View File

@ -0,0 +1,17 @@
assets/vendor/**/*
node_modules/**/*
**/js_test_files/**/*
*.js
!*.es6.js
!modules/ckeditor5/js/ckeditor5_plugins/**/*.js
modules/locale/tests/locale_test.es6.js
!tests/Drupal/Nightwatch/**/*.js
misc/polyfills/array.find.es6.js
misc/polyfills/element.closest.es6.js
misc/polyfills/object.assign.es6.js
# Ignore deliberately malformed YAML files.
modules/system/tests/fixtures/HtaccessTest/access_test.yml
modules/system/tests/themes/test_theme_libraries_empty/test_theme_libraries_empty.info.yml
tests/Drupal/Tests/Core/Asset/library_test_files/empty.libraries.yml
tests/Drupal/Tests/Core/Asset/library_test_files/invalid_file.libraries.yml

View File

@ -0,0 +1,56 @@
{
"plugins": [
"jquery"
],
"rules": {
"jquery/no-ajax": 0,
"jquery/no-ajax-events": 2,
"jquery/no-animate": 0,
"jquery/no-attr": 0,
"jquery/no-bind": 2,
"jquery/no-class": 0,
"jquery/no-clone": 0,
"jquery/no-closest": 0,
"jquery/no-css": 0,
"jquery/no-data": 0,
"jquery/no-deferred": 0,
"jquery/no-delegate": 2,
"jquery/no-each": 0,
"jquery/no-extend": 0,
"jquery/no-fade": 0,
"jquery/no-filter": 0,
"jquery/no-find": 0,
"jquery/no-global-eval": 2,
"jquery/no-grep": 2,
"jquery/no-has": 0,
"jquery/no-hide": 0,
"jquery/no-html": 0,
"jquery/no-in-array": 0,
"jquery/no-is-array": 0,
"jquery/no-is-function": 2,
"jquery/no-is": 0,
"jquery/no-load": 2,
"jquery/no-map": 0,
"jquery/no-merge": 2,
"jquery/no-param": 2,
"jquery/no-parent": 0,
"jquery/no-parents": 0,
"jquery/no-parse-html": 0,
"jquery/no-prop": 0,
"jquery/no-proxy": 0,
"jquery/no-ready": 0,
"jquery/no-serialize": 0,
"jquery/no-show": 0,
"jquery/no-size": 2,
"jquery/no-sizzle": 0,
"jquery/no-slide": 0,
"jquery/no-submit": 2,
"jquery/no-text": 0,
"jquery/no-toggle": 0,
"jquery/no-trigger": 0,
"jquery/no-trim": 2,
"jquery/no-val": 0,
"jquery/no-when": 0,
"jquery/no-wrap": 0
}
}

View File

@ -0,0 +1,56 @@
{
"extends": [
"airbnb",
"plugin:prettier/recommended",
"plugin:yml/recommended"
],
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true
},
"globals": {
"Drupal": true,
"drupalSettings": true,
"drupalTranslations": true,
"jQuery": true,
"_": true,
"Cookies": true,
"Backbone": true,
"Modernizr": true,
"loadjs": true,
"Popper": true,
"Shepherd": true,
"Sortable": true,
"once": true,
"CKEDITOR": true,
"tabbable": true
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"prettier/prettier": "error",
"consistent-return": ["off"],
"no-underscore-dangle": ["off"],
"max-nested-callbacks": ["warn", 3],
"import/no-mutable-exports": ["warn"],
"no-plusplus": ["warn", {
"allowForLoopAfterthoughts": true
}],
"no-param-reassign": ["off"],
"no-prototype-builtins": ["off"],
"valid-jsdoc": ["warn", {
"prefer": {
"returns": "return",
"property": "prop"
},
"requireReturn": false
}],
"no-unused-vars": ["warn"],
"operator-linebreak": ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]
}
}

View File

@ -0,0 +1,94 @@
{
"extends": "eslint:recommended",
"root": true,
"env": {
"browser": true
},
"globals": {
"Drupal": true,
"drupalSettings": true,
"drupalTranslations": true,
"domready": true,
"jQuery": true,
"_": true,
"matchMedia": true,
"Backbone": true,
"Modernizr": true,
"CKEDITOR": true
},
"rules": {
"array-bracket-spacing": ["error", "never"],
"block-scoped-var": "error",
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}],
"comma-dangle": ["error", "never"],
"comma-spacing": "error",
"comma-style": ["error", "last"],
"computed-property-spacing": ["error", "never"],
"curly": ["error", "all"],
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"guard-for-in": "error",
"indent": ["error", 2, {"SwitchCase": 1}],
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
"keyword-spacing": ["error", {"before": true, "after": true}],
"linebreak-style": ["error", "unix"],
"lines-around-comment": ["error", {"beforeBlockComment": true, "afterBlockComment": false}],
"new-parens": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-parens": ["error", "functions"],
"no-implied-eval": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-native-reassign": "error",
"no-nested-ternary": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-process-exit": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-unused-expressions": "error",
"no-unused-vars": ["error", {"vars": "all", "args": "none"}],
"no-with": "error",
"object-curly-spacing": ["error", "never"],
"one-var": ["error", "never"],
"quote-props": ["error", "consistent-as-needed"],
"quotes": ["error", "single", "avoid-escape"],
"semi": ["error", "always"],
"semi-spacing": ["error", {"before": false, "after": true}],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never"}],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
"spaced-comment": ["error", "always"],
"strict": ["error", "function"],
"yoda": ["error", "never"],
"max-nested-callbacks": ["warn", 3],
"valid-jsdoc": ["warn", {
"prefer": {
"returns": "return",
"property": "prop"
},
"requireReturn": false
}]
}
}

View File

@ -0,0 +1,18 @@
{
"extends": [
"./.eslintrc.json",
"./.eslintrc.jquery.json"
],
"rules": {
"no-shadow": "off",
"no-new": "off",
"no-continue": "off",
"new-cap": "off",
"max-len": "off",
"default-case": "off",
"prefer-destructuring": "off",
"react/no-this-in-sfc": "off",
"react/destructuring-assignment": "off",
"import/named": "off"
}
}

21
web/core/.gitignore vendored 100644
View File

@ -0,0 +1,21 @@
# Ignore node_modules folder created when installing core's JavaScript
# dependencies.
node_modules
yarn-error.log
# Ignore overrides of core's phpcs.xml.dist and phpunit.xml.dist.
phpcs.xml
phpunit.xml
# Ignore package-lock.json that is automatically created when adding
# dependencies by users of NPMv5.
package-lock.json
# Ignore test reports
reports
# Ignore local Nightwatch settings
nightwatch.settings.json
# Ignore dotenv
.env

View File

@ -0,0 +1,2 @@
modules/locale/tests/locale_test.es6.js
*.yml

View File

@ -0,0 +1,6 @@
{
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}

View File

@ -0,0 +1,10 @@
themes/claro/**/*.css
!themes/claro/**/*.pcss.css
themes/olivero/**/*.css
!themes/olivero/**/*.pcss.css
misc/dialog/off-canvas.reset.css
misc/dialog/off-canvas.base.css
themes/stable/css/core/dialog/off-canvas.reset.css
themes/stable/css/core/dialog/off-canvas.base.css
themes/stable9/css/core/dialog/off-canvas.reset.css
themes/stable9/css/core/dialog/off-canvas.base.css

View File

@ -0,0 +1,468 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order"
],
"rules": {
"comment-empty-line-before": null,
"function-linear-gradient-no-nonstandard-direction": null,
"function-whitespace-after": null,
"no-descending-specificity": null,
"no-duplicate-selectors": null,
"no-unknown-animations": true,
"media-feature-name-no-unknown": [true, {
"ignoreMediaFeatureNames": [
"prefers-reduced-motion",
"min--moz-device-pixel-ratio"
]
}],
"number-leading-zero": "always",
"order/order": [
"custom-properties",
"dollar-variables",
{
"type": "at-rule",
"hasBlock": false
},
"declarations",
"rules",
{
"type": "at-rule",
"hasBlock": true
}
],
"order/properties-order": [
"position",
"z-index",
"top",
"right",
"bottom",
"left",
"display",
"visibility",
"float",
"clear",
"overflow",
"overflow-x",
"overflow-y",
"-ms-overflow-x",
"-ms-overflow-y",
"-webkit-overflow-scrolling",
"clip",
"zoom",
"flex",
"flex-flow",
"flex-direction",
"flex-wrap",
"flex-basis",
"flex-grow",
"flex-shrink",
"flex-order",
"flex-pack",
"-ms-grid",
"grid",
"grid-area",
"grid-template",
"grid-template-areas",
"-ms-grid-rows",
"grid-template-rows",
"-ms-grid-columns",
"grid-template-columns",
"grid-row",
"-ms-grid-row",
"grid-row-start",
"grid-row-end",
"grid-column",
"-ms-grid-column",
"grid-column-start",
"grid-column-end",
"grid-auto-rows",
"grid-auto-columns",
"grid-auto-flow",
"grid-gap",
"grid-row-gap",
"grid-column-gap",
"-ms-grid-row-align",
"-ms-grid-column-align",
"place-content",
"place-items",
"align-content",
"align-items",
"align-self",
"justify-content",
"justify-items",
"justify-self",
"order",
"-webkit-box-sizing",
"-moz-box-sizing",
"box-sizing",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"margin-block-start",
"margin-block-end",
"margin-inline-start",
"margin-inline-end",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"padding-block-start",
"padding-block-end",
"padding-inline-start",
"padding-inline-end",
"table-layout",
"-webkit-columns",
"-moz-columns",
"columns",
"-webkit-column-span",
"-moz-column-span",
"column-span",
"-webkit-column-width",
"-moz-column-width",
"column-width",
"-webkit-column-count",
"-moz-column-count",
"column-count",
"-webkit-column-fill",
"-moz-column-fill",
"column-fill",
"-webkit-column-gap",
"-moz-column-gap",
"column-gap",
"-webkit-column-rule",
"-moz-column-rule",
"column-rule",
"-webkit-column-rule-width",
"-moz-column-rule-width",
"column-rule-width",
"-webkit-column-rule-style",
"-moz-column-rule-style",
"column-rule-style",
"-webkit-column-rule-color",
"-moz-column-rule-color",
"column-rule-color",
"empty-cells",
"caption-side",
"border-spacing",
"border-collapse",
"$counter-style",
"list-style",
"list-style-position",
"list-style-type",
"list-style-image",
"content",
"quotes",
"counter-reset",
"counter-increment",
"resize",
"cursor",
"-webkit-user-select",
"-moz-user-select",
"-ms-user-select",
"user-select",
"nav-index",
"nav-up",
"nav-right",
"nav-down",
"nav-left",
"-webkit-transition",
"-moz-transition",
"-ms-transition",
"-o-transition",
"transition",
"-webkit-transition-delay",
"-moz-transition-delay",
"-ms-transition-delay",
"-o-transition-delay",
"transition-delay",
"-webkit-transition-timing-function",
"-moz-transition-timing-function",
"-ms-transition-timing-function",
"-o-transition-timing-function",
"transition-timing-function",
"-webkit-transition-duration",
"-moz-transition-duration",
"-ms-transition-duration",
"-o-transition-duration",
"transition-duration",
"-webkit-transition-property",
"-moz-transition-property",
"-ms-transition-property",
"-o-transition-property",
"transition-property",
"-webkit-transform",
"-moz-transform",
"-ms-transform",
"-o-transform",
"transform",
"-webkit-transform-origin",
"-moz-transform-origin",
"-ms-transform-origin",
"-o-transform-origin",
"transform-origin",
"$keyframes",
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-name",
"-moz-animation-name",
"-ms-animation-name",
"-o-animation-name",
"animation-name",
"-webkit-animation-duration",
"-moz-animation-duration",
"-ms-animation-duration",
"-o-animation-duration",
"animation-duration",
"-webkit-animation-play-state",
"-moz-animation-play-state",
"-ms-animation-play-state",
"-o-animation-play-state",
"animation-play-state",
"-webkit-animation-timing-function",
"-moz-animation-timing-function",
"-ms-animation-timing-function",
"-o-animation-timing-function",
"animation-timing-function",
"-webkit-animation-delay",
"-moz-animation-delay",
"-ms-animation-delay",
"-o-animation-delay",
"animation-delay",
"-webkit-animation-iteration-count",
"-moz-animation-iteration-count",
"-ms-animation-iteration-count",
"-o-animation-iteration-count",
"animation-iteration-count",
"-webkit-animation-direction",
"-moz-animation-direction",
"-ms-animation-direction",
"-o-animation-direction",
"animation-direction",
"text-align",
"-webkit-text-align-last",
"-moz-text-align-last",
"-ms-text-align-last",
"text-align-last",
"vertical-align",
"white-space",
"text-decoration",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"text-emphasis-position",
"text-indent",
"-ms-text-justify",
"text-justify",
"text-transform",
"letter-spacing",
"word-spacing",
"-ms-writing-mode",
"text-outline",
"text-transform",
"text-wrap",
"text-overflow",
"-ms-text-overflow",
"text-overflow-ellipsis",
"text-overflow-mode",
"-ms-word-wrap",
"word-wrap",
"word-break",
"-ms-word-break",
"-moz-tab-size",
"-o-tab-size",
"tab-size",
"-webkit-hyphens",
"-moz-hyphens",
"hyphens",
"pointer-events",
"direction",
"unicode-bidi",
"orphans",
"widows",
"object-fit",
"object-position",
"opacity",
"filter:progid:DXImageTransform.Microsoft.Alpha(Opacity",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha",
"-webkit-filter",
"-ms-filter",
"filter",
"-ms-interpolation-mode",
"color",
"border",
"border-collapse",
"border-width",
"border-style",
"border-color",
"border-top",
"border-top-width",
"border-top-style",
"border-top-color",
"border-right",
"border-right-width",
"border-right-style",
"border-right-color",
"border-bottom",
"border-bottom-width",
"border-bottom-style",
"border-bottom-color",
"border-left",
"border-left-width",
"border-left-style",
"border-left-color",
"border-block-start",
"border-block-start-width",
"border-block-start-style",
"border-block-start-color",
"border-inline-end",
"border-inline-end-width",
"border-inline-end-style",
"border-inline-end-color",
"border-block-end",
"border-block-end-width",
"border-block-end-style",
"border-block-end-color",
"border-inline-start",
"border-inline-start-width",
"border-inline-start-style",
"border-inline-start-color",
"-webkit-border-radius",
"-moz-border-radius",
"border-radius",
"-webkit-border-top-left-radius",
"-moz-border-radius-topleft",
"border-top-left-radius",
"-webkit-border-top-right-radius",
"-moz-border-radius-topright",
"border-top-right-radius",
"-webkit-border-bottom-right-radius",
"-moz-border-radius-bottomright",
"border-bottom-right-radius",
"-webkit-border-bottom-left-radius",
"-moz-border-radius-bottomleft",
"border-bottom-left-radius",
"-webkit-border-image",
"-moz-border-image",
"-o-border-image",
"border-image",
"-webkit-border-image-source",
"-moz-border-image-source",
"-o-border-image-source",
"border-image-source",
"-webkit-border-image-slice",
"-moz-border-image-slice",
"-o-border-image-slice",
"border-image-slice",
"-webkit-border-image-width",
"-moz-border-image-width",
"-o-border-image-width",
"border-image-width",
"-webkit-border-image-outset",
"-moz-border-image-outset",
"-o-border-image-outset",
"border-image-outset",
"-webkit-border-image-repeat",
"-moz-border-image-repeat",
"-o-border-image-repeat",
"border-image-repeat",
"outline",
"outline-width",
"outline-style",
"outline-color",
"outline-offset",
"background",
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader",
"background-color",
"background-image",
"background-repeat",
"background-attachment",
"background-position",
"background-position-x",
"-ms-background-position-x",
"background-position-y",
"-ms-background-position-y",
"-webkit-background-clip",
"-moz-background-clip",
"background-clip",
"background-origin",
"-webkit-background-size",
"-moz-background-size",
"-o-background-size",
"background-size",
"box-decoration-break",
"-webkit-box-shadow",
"-moz-box-shadow",
"box-shadow",
"filter:progid:DXImageTransform.Microsoft.gradient",
"-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient",
"text-shadow",
"$font-face",
"font",
"font-family",
"src",
"$font-feature-values",
"$swash",
"$annotation",
"$ornaments",
"$stylistic",
"$styleset",
"$character-variant",
"font-variant-alternates",
"font-size",
"font-weight",
"font-style",
"font-variant",
"font-size-adjust",
"font-stretch",
"font-effect",
"font-emphasize",
"font-emphasize-position",
"font-emphasize-style",
"font-smooth",
"line-height"
],
"property-no-unknown": null,
"rule-empty-line-before": null,
"selector-pseudo-element-colon-notation": null,
"shorthand-property-no-redundant-values": null,
"string-quotes": "double",
"unit-allowed-list": ["ch", "deg", "em", "ex", "fr", "ms", "rem", "%", "s", "px", "vw", "vh"],
"value-keyword-case": ["lower", {
"ignoreProperties": [
"--font-family",
"font-family"
]
}]
},
"ignoreFiles": [
"assets/vendor/**/*.css",
"tests/Drupal/Tests/Core/Asset/css_test_files/**/*.css",
"modules/media/css/plugins/drupalmedia/ckeditor.drupalmedia.css",
"themes/stable/css/core/assets/vendor/**/*.css",
"themes/stable9/css/core/assets/vendor/**/*.css",
"themes/stable9/css/media/plugins/drupalmedia/ckeditor.drupalmedia.css"
]
}

View File

@ -0,0 +1,8 @@
New minor (feature) releases of Drupal are released every six months and
patch (bugfix) releases are released every month. More information on the
Drupal release cycle: https://www.drupal.org/core/release-cycle-overview
* For a full list of fixes in the latest release, visit:
https://www.drupal.org/latest-release
* API change records for Drupal core:
https://www.drupal.org/list-changes/drupal

View File

@ -0,0 +1,64 @@
All Drupal code is Copyright 2001 - 2020 by the original authors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program as the file LICENSE.txt; if not, please see
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
Drupal is a registered trademark of Dries Buytaert.
Drupal includes works under other copyright notices and distributed
according to the terms of the GNU General Public License or a compatible
license, including:
JavaScript
Farbtastic - Copyright (c) 2010 Matt Farina
HTML5 Shiv - Copyright (c) 2014 Alexander Farkas, Jonathan Neal, Paul Irish,
and John-David Dalton
jQuery - Copyright (c) 2011 John Resig
jQuery Bgiframe - Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
jQuery BBQ - Copyright (c) 2010 "Cowboy" Ben Alman
jQuery Cookie - Copyright (c) 2014 Klaus Hartl
jQuery Form - Copyright (c) 2017 Kevin Morris
jQuery Globalize - Copyright (c) 2012 Software Freedom Conservancy, Inc.
jQuery Mousewheel - Copyright OpenJS Foundation and other contributors
(https://openjsf.org/)
jQuery Metadata - Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer,
Paul McLanahan
jQuery Once - Copyright (c) 2009 Konstantin Käfer
jQuery UI - Copyright (c) 2015 by the authors and other contributors
(http://jqueryui.com/about)
Sizzle.js - Copyright (c) 2016 JS Foundation and other contributors
(https://js.foundation)
PHP
Drupal depends on numerous PHP Composer packages. All Composer packages
retain the copyright of the authors.
Brand materials
Drupal brand materials under core/misc/logo have a dedicated license. See
core/misc/logo/LICENSE.txt.

View File

@ -0,0 +1,45 @@
CREATE THE MySQL DATABASE
--------------------------
This step is only necessary if you don't already have a database set up (e.g.,
by your host). In the following examples, 'username' is an example MySQL user
which has the CREATE and GRANT privileges. Use the appropriate user name for
your system.
First, you must create a new database for your Drupal site (here, 'databasename'
is the name of the new database):
mysqladmin -u username -p create databasename
MySQL will prompt for the 'username' database password and then create the
initial database files. Next you must log in and set the access database rights:
mysql -u username -p
Again, you will be asked for the 'username' database password. At the MySQL
prompt, enter the following command:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER,
CREATE TEMPORARY TABLES ON databasename.*
TO 'username'@'localhost' IDENTIFIED BY 'password';
where:
'databasename' is the name of your database
'username' is the username of your MySQL account
'localhost' is the web server host where Drupal is installed
'password' is the password required for that username
Note: Unless the database user/host combination for your Drupal installation
has all of the privileges listed above (except possibly CREATE TEMPORARY TABLES,
which is currently only used by Drupal core automated tests and some
contributed modules), you will not be able to install or run Drupal.
If successful, MySQL will reply with:
Query OK, 0 rows affected
If the InnoDB storage engine is available, it will be used for all database
tables. InnoDB provides features over MyISAM such as transaction support,
row-level locks, and consistent non-locking reads.

View File

@ -0,0 +1,44 @@
CREATE THE PostgreSQL DATABASE
------------------------------
Note that the database must be created with UTF-8 (Unicode) encoding.
1. CREATE DATABASE USER
This step is only necessary if you don't already have a user set up (e.g., by
your host), or want to create a new user for use with Drupal only. The
following command creates a new user named 'username' and asks for a password
for that user:
createuser --pwprompt --encrypted --no-createrole --no-createdb username
If there are no errors, then the command was successful.
2. CREATE DRUPAL DATABASE
This step is only necessary if you don't already have a database set up
(e.g., by your host) or want to create a new database for use with Drupal
only. The following command creates a new database named 'databasename',
which is owned by the previously created 'username':
createdb --encoding=UTF8 --owner=username databasename
If there are no errors, then the command was successful.
3. CREATE SCHEMA OR SCHEMAS (Optional advanced step)
Drupal will run across different schemas within your database if you so wish.
By default, Drupal runs inside the 'public' schema but you can use $db_prefix
inside settings.php to define a schema for Drupal to run inside of, or
specify tables that are shared inside of a separate schema. Drupal will not
create schemas for you. In fact, the user that Drupal runs as should not be
allowed to do this. You'll need to execute the SQL below as a superuser,
replace 'username' with the username that Drupal uses to connect to
PostgreSQL, and replace 'schema_name' with a schema name you wish to use,
such as 'shared':
CREATE SCHEMA schema_name AUTHORIZATION username;
Do this for as many schemas as you need. See default.settings.php for
instructions on how to set which tables use which schemas.

View File

@ -0,0 +1,39 @@
SQLITE REQUIREMENTS
-------------------
PHP's PDO SQLite driver must be enabled. If you do not have pdo_sqlite
available, depending on your system there are different ways to install it.
Windows
-------
Read more about it on http://www.php.net/manual/en/pdo.installation.php
Linux
-----
sudo apt-get install php-sqlite3
SQLITE DATABASE CREATION
------------------------
The Drupal installer will create the SQLite database for you. The only
requirement is that the installer must have write permissions to the directory
where the database file resides. This directory (not just the database file) also
has to remain writable by the web server going forward for SQLite to continue to
be able to operate.
On the "Database configuration" form in the "Database file" field, you must
supply the exact path to where you wish your database file to reside. It is
strongly suggested that you choose a path that is outside of the webroot, yet
ensure that the directory is writable by the web server.
If you must place your database file in your webroot, you could try using the
following in your "Database file" field:
sites/default/files/.ht.sqlite
Note: The .ht in the name will tell Apache to prevent the database from being
downloaded. Please check that the file is, indeed, protected by your webserver.
If not, please consult the documentation of your webserver on how to protect a
file from downloading.

View File

@ -0,0 +1,460 @@
CONTENTS OF THIS FILE
---------------------
* Quickstart
* Requirements and notes
* Optional server requirements
* Installation
* Reinstall
* Building and customizing your site
* Multisite configuration
* Multilingual configuration
QUICKSTART
----------------------
Prerequisites:
- PHP 7.3.0 (or greater) (https://php.net).
In the instructions below, replace the version x.y.z with the specific version
you wish to download. Example: 8.6.0.zip. You can find the latest stable version
at https://www.drupal.org/project/drupal.
Download and extract the Drupal package:
- curl -sS https://ftp.drupal.org/files/projects/drupal-x.y.z.zip --output drupal-x.y.z.zip
- unzip drupal-x.y.z.zip
- cd /path/to/drupal-x.y.z
- php core/scripts/drupal quick-start
Wait… installation can take a minute or two. A successful installation will
result in opening the new site in your browser.
Run the following command for a list of available options that you may need to
configure quick-start:
- php core/scripts/drupal quick-start --help
Follow the instructions in the REINSTALL section below to start over.
NOTE: This quick start solution uses PHP's built-in web server and is not
intended for production use. Read more about how to run Drupal in a production
environment below.
REQUIREMENTS AND NOTES
----------------------
Drupal requires:
- A web server with PHP support, for example:
- Apache 2.4.7 (or greater) (http://httpd.apache.org/).
- Nginx 1.1 (or greater) (http://nginx.com/).
- PHP 7.3.0 (or greater) (http://php.net/). For better security support it is
recommended to update to at least 7.3.13.
- One of the following databases:
- MySQL 5.7.8 (or greater) (http://www.mysql.com/).
- MariaDB 10.3.7 (or greater) (https://mariadb.org/). MariaDB is a fully
compatible drop-in replacement for MySQL.
- Percona Server 5.7.8 (or greater) (http://www.percona.com/). Percona
Server is a backwards-compatible replacement for MySQL.
- PostgreSQL 10 (or greater) (http://www.postgresql.org/).
- SQLite 3.26 (or greater) (http://www.sqlite.org/).
For more detailed information about Drupal requirements, including a list of
PHP extensions and configurations that are required, see "System requirements"
(https://www.drupal.org/docs/system-requirements) in the Drupal.org online
documentation.
For detailed information on how to configure a test server environment using a
variety of operating systems and web servers, see "Local server setup"
(https://www.drupal.org/node/157602) in the Drupal.org online documentation.
Note that all directories mentioned in this document are always relative to the
directory of your Drupal installation, and commands are meant to be run from
this directory (except for the initial commands that create that directory).
OPTIONAL SERVER REQUIREMENTS
----------------------------
- If you want to use Drupal's "Clean URLs" feature on an Apache web server, you
will need the mod_rewrite module and the ability to use local .htaccess
files. For Clean URLs support on IIS, see "Clean URLs with IIS"
(https://www.drupal.org/node/3854) in the Drupal.org online documentation.
- If you plan to use XML-based services such as RSS aggregation, you will need
PHP's XML extension. This extension is enabled by default on most PHP
installations.
- To serve gzip compressed CSS and JS files on an Apache web server, you will
need the mod_headers module and the ability to use local .htaccess files.
- Some Drupal functionality (e.g., checking whether Drupal and contributed
modules need updates, RSS aggregation, etc.) require that the web server be
able to go out to the web and download information. If you want to use this
functionality, you need to verify that your hosting provider or server
configuration allows the web server to initiate outbound connections. Most web
hosting setups allow this.
INSTALLATION
------------
1. Download and extract Drupal.
You can obtain the latest Drupal release from https://www.drupal.org -- the
files are available in .tar.gz and .zip formats and can be extracted using
most compression tools.
To download and extract the files, on a typical Unix/Linux command line, use
the following commands (assuming you want version x.y.z of Drupal in .tar.gz
format):
wget https://www.drupal.org/files/projects/drupal-x.y.z.tar.gz
tar -zxvf drupal-x.y.z.tar.gz
This will create a new directory drupal-x.y.z/ containing all Drupal files
and directories. Then, to move the contents of that directory into a
directory within your web server's document root or your public HTML
directory, continue with this command:
mv drupal-x.y.z/* drupal-x.y.z/.htaccess drupal-x.y.z/.csslintrc drupal-x.y.z/.editorconfig drupal-x.y.z/.eslintignore drupal-x.y.z/.eslintrc.json drupal-x.y.z/.gitattributes /path/to/your/installation
You can also download the latest version of Drupal using Git on the command
line and set up a repository by following the instructions at
https://www.drupal.org/project/drupal/git-instructions for "Setting up
repository for the first time".
Once you have downloaded Drupal successfully, you may install Composer
globally using the instructions at
https://getcomposer.org/doc/00-intro.md#globally
With Composer installed, run the following command from the Drupal web root:
composer install
2. Create the Drupal database.
Because Drupal stores all site information in a database, the Drupal
installer will attempt to create this database for you. If you create the
database manually, you must grant Drupal certain database privileges (such as
the ability to create tables). For details, consult INSTALL.mysql.txt,
INSTALL.pgsql.txt, or INSTALL.sqlite.txt. You may also need to consult your
web hosting provider for instructions specific to your web host.
Take note of the username, password, database name, and hostname as you
create the database. You will enter this information during the install.
3. Run the install script.
To run the install script, point your browser to the base URL of your
website (e.g., http://www.example.com).
You will be guided through several screens to set up the database, add the
site maintenance account (the first user, also known as user/1), and provide
basic website settings.
During installation, several files and directories need to be created, which
the install script will try to do automatically. However, on some hosting
environments, manual steps are required, and the install script will tell
you that it cannot proceed until you fix certain issues. This is normal and
does not indicate a problem with your server.
The most common steps you may need to perform are:
a. Missing files directory.
The install script will attempt to create a public file storage directory
in the default location at sites/default/files (the location of the files
directory may be changed after Drupal is installed).
If auto-creation fails, you can create the directory yourself. (If you are
creating a multisite installation, substitute the correct sites directory
for sites/default; see the Multisite Configuration section of this file,
below.) Sample commands from a Unix/Linux command line:
mkdir sites/default/files
chmod a+w sites/default/files
Alternatively, you can make the install script work by changing
permissions on the sites/default directory. The web server can then
create the files directory within it for you.
For example, on a Unix/Linux command line, you can grant everyone
(including the web server) permission to write to the sites/default
directory with this command:
chmod a+w sites/default
Then re-run install.php (e.g. by clicking "try again" at the bottom of
the Requirements problem page. Once the files directory is created, you
will need to grant everyone (including the web server) permission to
write to it with this command:
chmod a+w sites/default/files
Be sure to set the permissions for the default directory back after the
installation is finished! (Leave the files directory writable.)
Sample command:
chmod go-w sites/default
b. Missing settings file.
Drupal will try to automatically create a settings.php configuration file,
which is normally in the directory sites/default (to avoid problems when
upgrading, Drupal is not packaged with this file). If auto-creation fails,
you will need to create this file yourself, using the file
sites/default/default.settings.php as a template.
For example, on a Unix/Linux command line, you can make a copy of the
default.settings.php file with the command:
cp sites/default/default.settings.php sites/default/settings.php
Next, grant write privileges to the file to everyone (including the web
server) with the command:
chmod a+w sites/default/settings.php
Be sure to set the permissions back after the installation is finished!
Sample command:
chmod go-w sites/default/settings.php
c. Write permissions after install.
The install script will attempt to write-protect the settings.php file and
the sites/default directory after saving your configuration. If this
fails, you will be notified, and you can do it manually. Sample commands
from a Unix/Linux command line:
chmod go-w sites/default/settings.php
chmod go-w sites/default
4. Verify that the site is working.
When the install script finishes, you will be logged in with the site
maintenance account on a "Welcome" page. If the default Drupal theme is not
displaying properly and links on the page result in "Page Not Found" errors,
you may be experiencing problems with clean URLs. Visit
https://www.drupal.org/docs/8/clean-urls-in-drupal-8 to troubleshoot.
5. Change file system storage settings (optional).
The files directory created in step 3 is the default file system path used to
store all uploaded files, as well as some temporary files created by
Drupal. After installation, you can modify the file system path to store
uploaded files in a different location.
It is not necessary to modify this path, but you may wish to change it if:
- Your site runs multiple Drupal installations from a single codebase (modify
the file system path of each installation to a different directory so that
uploads do not overlap between installations).
- Your site runs on a number of web servers behind a load balancer or reverse
proxy (modify the file system path on each server to point to a shared file
repository).
- You want to restrict access to uploaded files.
To modify the file system path:
a. Ensure that the new location for the path exists and is writable by the
web server. For example, to create a new directory named uploads and grant
write permissions, use the following commands on a Unix/Linux command
line:
mkdir uploads
chmod a+w uploads
b. Open your settings.php in a plain-text editor, and uncomment (remove the #
at the start of line) this line:
# $settings['file_public_path'] = 'sites/default/files';
Enter the desired path and save the file.
If you want to use private file storage, you need to uncomment (remove
the # at the start of line) the following line in settings.php:
# $settings['file_private_path'] = '';
Enter the path for private files and save the file.
Changing the file system path after files have been uploaded may cause
unexpected problems on an existing site. If you modify the file system path
on an existing site, remember to copy all files from the original location
to the new location.
6. Revoke documentation file permissions (optional).
Some administrators suggest making the documentation files, especially
CHANGELOG.txt, non-readable so that the exact version of Drupal you are
running is slightly more difficult to determine. If you wish to implement
this optional security measure, from a Unix/Linux command line you can use
the following command:
chmod a-r core/CHANGELOG.txt
Note that the example only affects CHANGELOG.txt. To completely hide all
documentation files from public view, repeat this command for each of the
Drupal documentation files in the installation directory, substituting the
name of each file for CHANGELOG.txt in the example.
For more information on setting file permissions, see "Modifying Linux,
Unix, and Mac file permissions" (https://www.drupal.org/node/202483) or
"Modifying Windows file permissions" (https://www.drupal.org/node/202491) in
the Drupal.org online documentation.
7. Set up independent "cron" maintenance jobs.
Many Drupal modules have tasks that must be run periodically, including the
Search module (building and updating the index used for keyword searching),
the Aggregator module (retrieving feeds from other sites), and the System
module (performing routine maintenance and pruning of database tables). These
tasks are known as "cron maintenance tasks", named after the Unix/Linux
"cron" utility.
When you install Drupal, its built-in cron feature is enabled, which
automatically runs the cron tasks periodically, triggered by people visiting
pages of your site. You can configure the built-in cron feature by navigating
to Administration > Configuration > System > Cron.
It is also possible to run the cron tasks independent of site visits; this is
recommended for most sites. To do this, you will need to set up an automated
process to visit the page /cron on your site, which executes the cron
tasks.
The URL of the cron page requires a "cron key" to protect against
unauthorized access. Your site's cron key is automatically generated during
installation and is specific to your site. The full URL of the page, with the
cron key, is available in the "Cron maintenance tasks" section of the Status
report page at Administration > Reports > Status report.
As an example of how to set up this automated process, you can use the
crontab utility on Unix/Linux systems. The following crontab line uses the
wget command to visit the cron page, and runs each hour, on the hour:
0 * * * * wget -O - -q -t 1 http://example.com/cron/YOURKEY
Replace the text "http://example.com/cron/YOURKEY" in the example with the
full URL displayed under "Cron maintenance tasks" on the "Status report"
page.
More information about cron maintenance tasks is available at
https://www.drupal.org/cron, and sample cron shell scripts can be found in
the core/scripts/ directory. (Note that these scripts must be customized like
the above example, to add your site-specific cron key and domain name.)
REINSTALL
------------
Drupal can be reinstalled without downloading and extracting the Drupal release.
1. Drop all the tables in your database.
2. Remove everything in sites/default/files.
3. Remove sites/default/settings.php.
4. Follow the Installation Instructions above starting from Step 3 (Run the
install script).
BUILDING AND CUSTOMIZING YOUR SITE
----------------------------------
A new installation of Drupal defaults to a very basic configuration. To extend
your site, you use "modules" and "themes". A module is a plugin that adds
functionality to Drupal, while a theme changes the look of your site. The core
of Drupal provides several optional modules and themes, and you can download
more at https://www.drupal.org/project/project_module and
https://www.drupal.org/project/project_theme
Do not mix downloaded or custom modules and themes with Drupal's core modules
and themes. Drupal's modules and themes are located in the /core/modules and
/core/themes directories, while the modules and themes you add to Drupal are
normally placed in the /modules and /themes directories. If you run a multisite
installation, you can also place modules and themes in the site-specific
directories -- see the Multisite Configuration section, below.
Never edit Drupal's core modules and themes; instead, use the hooks available in
the Drupal API. To modify the behavior of Drupal, develop a module as described
at https://www.drupal.org/developing/modules. To modify the look of Drupal,
create a subtheme as described at https://www.drupal.org/node/2165673, or a
completely new theme as described at https://www.drupal.org/docs/8/theming
MULTISITE CONFIGURATION
-----------------------
A single Drupal installation can host several Drupal-powered sites, each with
its own individual configuration.
For this to work you need the file sites/sites.php to exist. Make a copy of
the example.sites.php file:
$ cp sites/example.sites.php sites/sites.php
Additional site configurations are created in subdirectories within the 'sites'
directory. Each subdirectory must have a 'settings.php' file, which specifies
the configuration settings. The easiest way to create additional sites is to
copy file 'default.settings.php' from the 'sites/default' directory into the
new site directory with file name 'settings.php' and modify as appropriate.
The new directory name is constructed from the site's URL. The configuration
for www.example.com could be in 'sites/example.com/settings.php' (note that
'www.' should be omitted if users can access your site at http://example.com/).
$ cp sites/default/default.settings.php sites/example.com/settings.php
Sites do not have to have a different domain. You can also use subdomains and
subdirectories for Drupal sites. For example, example.com, sub.example.com, and
sub.example.com/site3 can all be defined as independent Drupal sites. The setup
for a configuration such as this would look like the following:
sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.site3/settings.php
When searching for a site configuration (for example www.sub.example.com/site3),
Drupal will search for configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
sites/default/settings.php
If you are installing on a non-standard port, the port number is treated as the
deepest subdomain. For example: http://www.example.com:8080/ could be loaded
from sites/8080.www.example.com/. The port number will be removed according to
the pattern above if no port-specific configuration is found, just like a real
subdomain.
Each site configuration can have its own site-specific modules and themes in
addition to those installed in the standard 'modules' and 'themes' directories.
To use site-specific modules or themes, simply create a 'modules' or 'themes'
directory within the site configuration directory. For example, if
sub.example.com has a custom theme and a custom module that should not be
accessible to other sites, the setup would look like this:
sites/sub.example.com/
settings.php
themes/custom_theme
modules/custom_module
For more information about multiple virtual hosts or the configuration
settings, consult https://www.drupal.org/docs/8/multisite
For more information on configuring Drupal's file system path in a multisite
configuration, see step 6 above.
MULTILINGUAL CONFIGURATION
--------------------------
By default, Drupal is installed in one language, and further languages may be
installed later.
For detailed instructions, visit
https://www.drupal.org/docs/8/multilingual

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,553 @@
Drupal core is built and maintained by the Drupal project community. Everyone is
encouraged to submit issues and changes (patches) to improve Drupal, and to
contribute in other ways -- see https://www.drupal.org/contribute to find out
how.
This file lists the active maintainers. For a list of past maintainers, see:
https://www.drupal.org/core/maintainers/past
Core committers
---------------
The Drupal core committers oversee the development of Drupal as a whole. The
core committers for Drupal are (in alphabetical order):
BDFL
- Dries Buytaert 'dries' https://www.drupal.org/u/dries
Product managers
- Dries Buytaert 'dries' https://www.drupal.org/u/dries
- Angela Byron 'webchick' https://www.drupal.org/u/webchick
- Gábor Hojtsy 'Gábor Hojtsy' https://www.drupal.org/u/gábor-hojtsy
- Roy Scholten 'yoroy' https://www.drupal.org/u/yoroy
Framework managers
Backend
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
- Alex Pott 'alexpott' https://www.drupal.org/u/alexpott
- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
Frontend
- Lauri Eskola 'lauriii' https://www.drupal.org/u/lauriii
- (provisional) Cristina Chumillas 'ckrina' https://www.drupal.org/u/ckrina
- (provisional) Ben Mullins 'bnjmnm' https://www.drupal.org/u/bnjmnm
Release managers
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
- Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
- (provisional) Victoria Spagnolo 'quietone' https://www.drupal.org/u/quietone
Core JavaScript packages
- (provisional) Théodore Biadala 'nod_' https://www.drupal.org/u/nod_
- (provisional) Sally Young 'justafish' https://www.drupal.org/u/justafish
Committer team facilitators
- Pamela Barone 'pameeela' https://www.drupal.org/u/pameeela
Subsystem maintainers
---------------------
The Drupal core subsystem maintainers oversee the development of Drupal
subsystems. See https://www.drupal.org/contribute/core-maintainers for more
information on their responsibilities, and to find out how to become a subsystem
maintainer. Current subsystem maintainers:
Actions
- ?
Aggregator
- ?
Ajax
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Asset Library API
- ?
Authentication and Authorization
- ?
Automated Cron
- ?
Ban
- ?
Bartik
- Emma Maria Karayiannis 'emma.maria' https://www.drupal.org/u/emma.maria
Base system
- ?
Basic Auth
- Juampy Novillo Requena 'juampy' https://www.drupal.org/u/juampy
Batch API
- John Cook 'John Cook' https://www.drupal.org/u/john-cook
BigPipe
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
Block
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
- Ben Dougherty 'benjy' https://www.drupal.org/u/benjy
Block Content
- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
Book
- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
Bootstrap
- ?
Breakpoint
- Peter Droogmans 'attiks' https://www.drupal.org/u/attiks
- Marc Drummond 'mdrummond' https://www.drupal.org/u/mdrummond
Cache
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
CKEditor
- Henrik Danielsson 'TwoD' https://www.drupal.org/u/TwoD
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
- Marek 'mlewand' Lewandowski https://www.drupal.org/u/mlewand
Claro
- Cristina Chumillas 'ckrina' https://www.drupal.org/u/ckrina
- Sascha Eggenberger 'saschaeggi' https://www.drupal.org/u/saschaeggi
- Lauri Eskola 'lauriii' https://www.drupal.org/u/lauriii
- Ben Mullins 'bnjmnm' https://www.drupal.org/u/bnjmnm
Classy
- David Hernandez 'davidhernandez' https://www.drupal.org/u/davidhernandez
Color
- ?
Comment
- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
- Andrey Postnikov 'andypost' https://www.drupal.org/u/andypost
Configuration API
- Alex Pott 'alexpott' https://www.drupal.org/u/alexpott
- Matthew Tift 'mtift' https://www.drupal.org/u/mtift
Configuration Entity API
- Alex Pott 'alexpott' https://www.drupal.org/u/alexpott
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Configuration UI
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Configuration Translation
- Gábor Hojtsy 'Gábor Hojtsy' https://www.drupal.org/u/gábor-hojtsy
- Tobias Zimmermann 'tstoeckler' https://www.drupal.org/u/tstoeckler
- Vijayachandran Mani 'vijaycs85' https://www.drupal.org/u/vijaycs85
Contact
- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
- Jibran Ijaz 'jibran' https://www.drupal.org/u/jibran
- Andrey Postnikov 'andypost' https://www.drupal.org/u/andypost
Content Moderation
- Sam Becker 'Sam152' https://www.drupal.org/u/sam152
Content Translation
- ?
Contextual
- ?
Cron
- ?
CSS
- John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin
Database API
- ?
MySQL DB driver
- David Strauss 'David Strauss' https://www.drupal.org/u/david-strauss
PostgreSQL DB driver
- ?
Sqlite DB driver
- ?
Database Logging
- Mariano D'Agostino 'dagmar' https://www.drupal.org/u/dagmar
Database Update API
- ?
DateTime
- Jonathan Hedstrom 'jhedstrom' https://www.drupal.org/u/jhedstrom
- Matthew Donadio 'mpdonadio' https://www.drupal.org/u/mpdonadio
DateTime Range
- Jonathan Hedstrom 'jhedstrom' https://www.drupal.org/u/jhedstrom
- Matthew Donadio 'mpdonadio' https://www.drupal.org/u/mpdonadio
Dynamic Page Cache
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
Editor
- Henrik Danielsson 'TwoD' https://www.drupal.org/u/TwoD
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
Entity API
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
- Hristo Chonov 'hchonov' https://www.drupal.org/u/hchonov
- Sascha Grossenbacher 'Berdir' https://www.drupal.org/u/berdir
- Tobias Zimmermann 'tstoeckler' https://www.drupal.org/u/tstoeckler
Extension API
- ?
Field API
- Andrei Mateescu 'amateescu' https://www.drupal.org/u/amateescu
Field UI
- Yves Chedemois 'yched' https://www.drupal.org/u/yched
- Andrei Mateescu 'amateescu' https://www.drupal.org/u/amateescu
File
- Kim Pepper 'kim.pepper' https://www.drupal.org/u/kimpepper
Filter
- ?
Forum
- Lee Rowlands 'larowlan' https://www.drupal.org/u/larowlan
Form API
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
History
- Andrey Postnikov 'andypost' https://www.drupal.org/u/andypost
Hypertext Application Language (HAL)
- ?
Help
- ?
Help Topics
- Amber Matz 'Amber Himes Matz' https://www.drupal.org/u/amber-himes-matz
- Andrey Postnikov 'andypost' https://www.drupal.org/u/andypost
Image
- Claudiu Cristea 'claudiu.cristea' https://www.drupal.org/u/claudiu.cristea
Inline Form Errors
- Daniël Smidt 'dmsmidt' https://www.drupal.org/u/dmsmidt
Installer
- ?
Interface Translation (locale)
- Gábor Hojtsy 'Gábor Hojtsy' https://www.drupal.org/u/gábor-hojtsy
JavaScript
- Théodore Biadala 'nod_' https://www.drupal.org/u/nod_
- Sally Young 'justafish' https://www.drupal.org/u/justafish
JSON:API
- Mateu Aguiló Bosch 'e0ipso' https://www.drupal.org/u/e0ipso
- Björn Brala 'bbrala' https://www.drupal.org/u/bbrala
- Gabe Sullice 'gabesullice' https://www.drupal.org/u/gabesullice
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
Language
- Daniel F. Kudwien 'sun' https://www.drupal.org/u/sun
Layout Builder
- Ted Bowman 'tedbow' https://www.drupal.org/u/tedbow
- Emilie Nouveau 'DyanneNova' https://www.drupal.org/u/dyannenova
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Link Field
- Weber Macedo 'Mac_Weber' https://www.drupal.org/u/mac_weber
Lock
- ?
Mail
- ?
Markup
- ?
Media
- Sean Blommaert 'seanB' https://www.drupal.org/u/seanb
- Marcos Cano 'marcoscano' https://www.drupal.org/u/marcoscano
- Christian Fritsch 'chr.fritsch' https://www.drupal.org/u/chr.fritsch
- Adam Globus-Hoenich 'phenaproxima' https://www.drupal.org/u/phenaproxima
Media Library
- Sean Blommaert 'seanB' https://www.drupal.org/u/seanb
- Adam Globus-Hoenich 'phenaproxima' https://www.drupal.org/u/phenaproxima
Menu
- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
Menu Link Content
- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
Menu UI
- ?
Migrate
- Benji Fisher 'benjifisher' https://www.drupal.org/u/benjifisher
- Adam Globus-Hoenich 'phenaproxima' https://www.drupal.org/u/phenaproxima
- Lucas Hedding 'heddn' https://www.drupal.org/u/heddn
- Michael Lutz 'mikelutz' https://www.drupal.org/u/mikelutz
- Victoria Spagnolo 'quietone' https://www.drupal.org/u/quietone
Node
- ?
Node Access
- Ken Rickard 'agentrickard' https://www.drupal.org/u/agentrickard
- Moshe Weitzman 'moshe weitzman' https://www.drupal.org/u/moshe-weitzman
- Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
Olivero
- Mike Herchel 'mherchel' https://www.drupal.org/u/mherchel
- Putra Bonaccorsi 'proeung' https://www.drupal.org/u/proeung
- Jen Witkowski 'jwitkowski79' https://www.drupal.org/u/jwitkowski79
- Konstantin Shupenko 'kostyashupenko' https://www.drupal.org/u/kostyashupenko
Options
- ?
Page Cache
- Lorenz Schori 'znerol' https://www.drupal.org/u/znerol
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
Path
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
Path Alias
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
Plugin
- Kris Vanderwater 'EclipseGc' https://www.drupal.org/u/eclipseGc
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Queue
- James Gilliland 'neclimdul' https://www.drupal.org/u/neclimdul
Quick Edit
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
- Théodore Biadala 'nod_' https://www.drupal.org/u/nod_
RDF
- ?
Render API
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Moshe Weitzman 'moshe weitzman' https://www.drupal.org/u/moshe-weitzman
Request Processing
- ?
REST
- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers
Responsive Image
- Peter Droogmans 'attiks' https://www.drupal.org/u/attiks
- Marc Drummond 'mdrummond' https://www.drupal.org/u/mdrummond
- Jelle Sebreghts 'Jelle_S' https://www.drupal.org/u/jelle_s
Routing
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
Search
- Peter Wolanin 'pwolanin' https://www.drupal.org/u/pwolanin
Serialization
- Damian Lee 'damiankloip' https://www.drupal.org/u/damiankloip
Settings Tray
- Ted Bowman 'tedbow' https://www.drupal.org/u/tedbow
Seven
- ?
Shortcut
- Tobias Zimmermann 'tstoeckler' https://www.drupal.org/u/tstoeckler
- Jibran Ijaz 'jibran' https://www.drupal.org/u/jibran
Stable
- ?
Stark
- John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin
Statistics
- ?
Syslog
- Mariano D'Agostino 'dagmar' https://www.drupal.org/u/dagmar
System (module)
- ?
Taxonomy
- Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
Telephone
- ?
Testing framework
- Alex Pott 'alexpott' https://www.drupal.org/u/alexpott
- Sascha Grossenbacher 'Berdir' https://www.drupal.org/u/berdir
- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
- Alberto M. 'mondrake' https://www.drupal.org/u/mondrake
Text Field
- ?
Theme API
- Alex Bronstein 'effulgentsia' https://www.drupal.org/u/effulgentsia
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
- Joël Pittet 'joelpittet' https://www.drupal.org/u/joelpittet
- Lauri Eskola 'lauriii' https://www.drupal.org/u/lauriii
Token
- ?
Toolbar
- Théodore Biadala 'nod_' https://www.drupal.org/u/nod_
Tour
- Nick Schuch 'nick_schuch' https://www.drupal.org/u/nick_schuch
Tracker
- ?
Transliteration
- Andrei Mateescu 'amateescu' https://www.drupal.org/u/amateescu
Typed Data
- Wolfgang Ziegler 'fago' https://www.drupal.org/u/fago
Umami demo
- Mark Conroy 'markconroy' https://www.drupal.org/u/markconroy
- Gareth Goodwin 'smaz' https://www.drupal.org/u/smaz
- Keith Jay 'kjay' https://www.drupal.org/u/kjay
- Ofer Shaal 'shaal' https://www.drupal.org/u/shaal
Update Manager
- Ted Bowman 'tedbow' https://www.drupal.org/u/tedbow
- Derek Wright 'dww' https://www.drupal.org/u/dww
User
- Moshe Weitzman 'moshe weitzman' https://www.drupal.org/u/moshe-weitzman
Views
- Daniel Wehner 'dawehner' https://www.drupal.org/u/dawehner
- Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett
- Damian Lee 'damiankloip' https://www.drupal.org/u/damiankloip
- Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
- Len Swaneveld 'Lendude' https://www.drupal.org/u/lendude
Workflows
- Sam Becker 'Sam152' https://www.drupal.org/u/sam152
Topic maintainers
-----------------
The Drupal Core topic maintainers are subject-matter experts in a topic that
spans multiple subsystems. These correspond to the core gates which all
proposed changes must pass. https://www.drupal.org/contribute/core/maintainers
provides more information on their responsibilities.
Accessibility
- Rain Breaw Michaels 'rainbreaw' https://www.drupal.org/u/rainbreaw
- Mike Gifford 'mgifford' https://www.drupal.org/u/mgifford
- Andrew Macpherson 'andrewmacpherson' https://www.drupal.org/u/andrewmacpherson
- (provisional) Ben Mullins 'bnjmnm' https://www.drupal.org/u/bnjmnm
Documentation
- ?
Performance
- Nathaniel Catchpole 'catch' https://www.drupal.org/u/catch
Testing
- ?
Usability
- Cristina Chumillas 'ckrina' https://www.drupal.org/u/ckrina
- Roy Scholten 'yoroy' https://www.drupal.org/u/yoroy
- Bojhan Somers 'Bojhan' https://www.drupal.org/u/bojhan
Security team
-------------
To report a security issue, see:
https://www.drupal.org/security-team/report-issue
The Drupal security team provides Security Advisories for vulnerabilities,
assists developers in resolving security issues, and provides security
documentation. See https://www.drupal.org/security-team for more information.
The security team lead is:
- Michael Hess 'mlhess' https://www.drupal.org/u/mlhess
Initiative coordinators
-----------------------
The Drupal core initiative coordinators oversee approved projects that
re-architect or otherwise improve large areas of Drupal core. See
https://www.drupal.org/contribute/core/maintainers for more information on
their responsibilities. The initiative coordinators are:
Decoupled Menus Initiative
- Théodore Biadala 'nod_' https://www.drupal.org/u/nod_
- Brian Perry 'brianperry' https://www.drupal.org/u/brianperry
Media Initiative
- Janez Urevc 'slashrsm' https://www.drupal.org/u/slashrsm
Core mentoring coordinators
---------------------------
The Drupal core mentors inspire, enable, and encourage new core contributors.
See https://www.drupal.org/core-mentoring for more information about mentoring.
Mentoring coordinators recruit and coach other mentors. They work on contributor
tools, documentation, and processes to make it easier for new contributors to
get involved. They organize communications and logistics, and actively
participate in mentoring.
- Chris Darke 'chrisdarke' https://www.drupal.org/u/chrisdarke
- Mauricio Dinarte 'dinarcon' https://www.drupal.org/u/dinarcon
- Brian Gilbert 'realityloop' https://www.drupal.org/u/realityloop
- Lucas Hedding 'heddn' https://www.drupal.org/u/heddn
- AmyJune Hineline 'volkswagenchick' https://www.drupal.org/u/volkswagenchick
- Tara King 'sparklingrobots' https://www.drupal.org/u/sparklingrobots
- Rachel Lawson 'rachel_norfolk' https://www.drupal.org/u/rachel_norfolk
- Elli Ludwigson 'ekl1773' https://www.drupal.org/u/ekl1773
- Jess Myrbo 'xjm' https://www.drupal.org/u/xjm
- Matthew Radcliffe 'mradcliffe' https://www.drupal.org/u/mradcliffe

View File

@ -0,0 +1,77 @@
CONTENTS OF THIS FILE
---------------------
* Introduction
* Minor and patch version updates
* Is my site using Composer?
* Updating code manually
* Updating code with Composer
* Updating Drupal 8 to Drupal 9
* Updating Drupal 6 or 7 to Drupal 9
INTRODUCTION
------------
This document provides links to resources on how to update or migrate your
Drupal site.
MINOR AND PATCH VERSION UPDATES
-------------------------------
Minor and patch updates are done either manually or with Composer, depending on
how the site was installed. Refer to the sections below on updating with
Composer or updating manually for tarball/zip installations.
Minor and patch versions are updates such as:
* Patch releases (e.g. 9.1.2 to 9.1.3)
* Scheduled minor releases (e.g 9.3.5 to 9.4.0)
* Beta to final releases (e.g. 9.1.0-beta2 to 9.1.0)
IS MY SITE USING COMPOSER?
--------------------------
Before updating, determine if your site is currently managed by Composer.
On a typical Unix/Linux command line, this can be determined by running the
following command (replace /PATH/TO/composer with the appropriate location
for your system):
/PATH/TO/composer info drupal/core
UPDATING CODE WITH COMPOSER
---------------------------
* Refer to 'Update Drupal core via Composer' for details on using Composer:
https://www.drupal.org/docs/8/update/update-drupal-core-via-composer
UPDATING CODE MANUALLY
----------------------
* Refer to 'Updating the Core Software' for details on updating manually:
https://www.drupal.org/docs/8/update/update-core-manually
UPDATING DRUPAL 8 TO DRUPAL 9
-----------------------------
1. Prepare the Drupal 8 site for Drupal 9:
https://www.drupal.org/docs/9/how-to-prepare-your-drupal-7-or-8-site-for-drupal-9/upgrading-a-drupal-8-site-to-drupal-9
2. Update the Drupal 8 codebase to Drupal 9:
https://www.drupal.org/docs/8/upgrade/upgrading-between-drupal-8-major-versions-eg-from-drupal-8-to-drupal-9
3. Navigate to /update.php to initiate the update process.
UPDATING DRUPAL 6 OR 7 TO DRUPAL 9
----------------------------------
* Updating from a previous major version, such as Drupal 6 or 7, requires
importing the old site configuration and content into a new Drupal 9 site.
Refer to the 'Migrate Guide' for more details on this process:
https://www.drupal.org/upgrade/migrate

95
web/core/USAGE.txt 100644
View File

@ -0,0 +1,95 @@
CONFIGURATION AND FEATURES
--------------------------
Drupal core (what you get when you download and extract a drupal-x.y.tar.gz or
drupal-x.y.zip file from https://www.drupal.org/project/drupal) has what you
need to get started with your website. It includes several modules (extensions
that add functionality) for common website features, such as managing content,
user accounts, image uploading, and search. Core comes with many options that
allow site-specific configuration. In addition to the core modules, there are
thousands of contributed modules (for functionality not included with Drupal
core) available for download.
More about configuration:
* Install, update, and maintain Drupal:
See INSTALL.txt and UPDATE.txt in the "core" directory.
* Learn about how to use Drupal to create your site:
https://www.drupal.org/documentation
* Follow best practices:
https://www.drupal.org/best-practices
* Download contributed modules to /modules to extend Drupal's functionality:
https://www.drupal.org/project/project_module
* See also: "Developing for Drupal" for writing your own modules, below.
INSTALLATION PROFILES
---------------------
Installation profiles define additional steps (such as enabling modules,
defining content types, etc.) that run after the base installation provided
by core when Drupal is first installed. There are two basic installation
profiles provided with Drupal core.
Installation profiles from the Drupal community modify the installation process
to provide a website for a specific use case, such as a CMS for media
publishers, a web-based project tracking tool, or a full-fledged CRM for
non-profit organizations raising money and accepting donations. They can be
distributed as bare installation profiles or as "distributions". Distributions
include Drupal core, the installation profile, and all other required
extensions, such as contributed and custom modules, themes, and third-party
libraries. Bare installation profiles require you to download Drupal Core and
the required extensions separately; place the downloaded profile in the
/profiles directory before you start the installation process.
More about installation profiles and distributions:
* Read about the difference between installation profiles and distributions:
https://www.drupal.org/docs/distributions/creating-distributions
* Download contributed installation profiles and distributions:
https://www.drupal.org/project/project_distribution
* Develop your own installation profile or distribution:
https://www.drupal.org/docs/distributions/creating-distributions
APPEARANCE
----------
In Drupal, the appearance of your site is set by the theme (themes are
extensions that set fonts, colors, and layout). Drupal core comes with several
themes. More themes are available for download, and you can also create your own
custom theme.
More about themes:
* Download contributed themes to /themes to modify Drupal's appearance:
https://www.drupal.org/project/project_theme
* Develop your own theme:
https://www.drupal.org/docs/theming-drupal
DEVELOPING FOR DRUPAL
---------------------
Drupal contains an extensive API that allows you to add to and modify the
functionality of your site. This means that you should never need to directly
modify the files that come with Drupal core to achieve the behavior you want;
instead, modifications take the form of modules.
When you need new functionality for your Drupal site, search for existing
contributed modules. If you find a module that matches except for a bug or an
additional needed feature, change the module and contribute your improvements
back to the project in the form of a "patch". Create new custom modules only
when nothing existing comes close to what you need.
More about developing:
* Extending and altering Drupal
https://api.drupal.org/api/drupal/core%21core.api.php/group/extending
* Search for existing contributed modules:
https://www.drupal.org/project/project_module
* Contribute a patch:
https://www.drupal.org/patch/submit
* Develop your own module:
https://www.drupal.org/developing/modules
* Follow programming best practices:
https://www.drupal.org/docs/develop/standards
* Refer to the API documentation:
https://api.drupal.org
* Learn from documented Drupal API examples:
https://www.drupal.org/project/examples

View File

@ -0,0 +1,10 @@
Drupal Scaffold Files are files that are contained inside drupal/core, but are
installed outside of the core directory (e.g. at the Drupal root).
For now, the scaffold files are being maintained in their original
locations. This is done so that Drupal sites based on the template project
drupal-composer/drupal-project may continue to download these files from the
same URLs they have historically been found at.
Those will be deleted from their original location in a future version.
See https://www.drupal.org/project/drupal/issues/3075954 for follow-on work.

View File

@ -0,0 +1,16 @@
HOW-TO: Test these Drupal scaffold files
In order to test these scaffold files, you'll need to get the entire Drupal repo and
run the tests there.
You'll find the tests in core/tests/Drupal/Tests/ComposerIntegrationTest.php.
You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions
You can find more information about running PHPUnit tests with Drupal here:
https://www.drupal.org/node/2116263
You can run a single phpunit test file like so:
$ ./vendor/bin/phpunit -c core core/tests/Drupal/Tests/ComposerIntegrationTest.php

View File

@ -0,0 +1,40 @@
--errors=box-model,
display-property-grouping,
duplicate-background-images,
duplicate-properties,
empty-rules,
ids,
import,
important,
known-properties,
outline-none,
overqualified-elements,
qualified-headings,
shorthand,
star-property-hack,
text-indent,
underscore-property-hack,
unique-headings,
unqualified-attributes,
vendor-prefix,
zero-units
--ignore=adjoining-classes,
box-sizing,
bulletproof-font-face,
compatible-vendor-prefixes,
errors,
fallback-colors,
floats,
font-faces,
font-sizes,
gradients,
import-ie-limit,
order-alphabetical,
regex-selectors,
rules-count,
selector-max,
selector-max-approaching,
selector-newline,
universal-selector
--exclude-list=core/assets,
vendor

View File

@ -0,0 +1,191 @@
parameters:
session.storage.options:
# Default ini options for sessions.
#
# Some distributions of Linux (most notably Debian) ship their PHP
# installations with garbage collection (gc) disabled. Since Drupal depends
# on PHP's garbage collection for clearing sessions, ensure that garbage
# collection occurs by using the most common settings.
# @default 1
gc_probability: 1
# @default 100
gc_divisor: 100
#
# Set session lifetime (in seconds), i.e. the grace period for session
# data. Sessions are deleted by the session garbage collector after one
# session lifetime has elapsed since the user's last visit. When a session
# is deleted, authenticated users are logged out, and the contents of the
# user's session is discarded.
# @default 200000
gc_maxlifetime: 200000
#
# Set session cookie lifetime (in seconds), i.e. the time from the session
# is created to the cookie expires, i.e. when the browser is expected to
# discard the cookie. The value 0 means "until the browser is closed".
# @default 2000000
cookie_lifetime: 2000000
#
# Drupal automatically generates a unique session cookie name based on the
# full domain name used to access the site. This mechanism is sufficient
# for most use-cases, including multi-site deployments. However, if it is
# desired that a session can be reused across different subdomains, the
# cookie domain needs to be set to the shared base domain. Doing so assures
# that users remain logged in as they cross between various subdomains.
# To maximize compatibility and normalize the behavior across user agents,
# the cookie domain should start with a dot.
#
# @default none
# cookie_domain: '.example.com'
#
# Set the session ID string length. The length can be between 22 to 256. The
# PHP recommended value is 48. See
# https://www.php.net/manual/session.security.ini.php for more information.
# This value should be kept in sync with
# \Drupal\Core\Session\SessionConfiguration::__construct()
# @default 48
sid_length: 48
#
# Set the number of bits in encoded session ID character. The possible
# values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-",
# ","). The PHP recommended value is 6. See
# https://www.php.net/manual/session.security.ini.php for more information.
# This value should be kept in sync with
# \Drupal\Core\Session\SessionConfiguration::__construct()
# @default 6
sid_bits_per_character: 6
twig.config:
# Twig debugging:
#
# When debugging is enabled:
# - The markup of each Twig template is surrounded by HTML comments that
# contain theming information, such as template file name suggestions.
# - Note that this debugging markup will cause automated tests that directly
# check rendered HTML to fail. When running automated tests, 'debug'
# should be set to FALSE.
# - The dump() function can be used in Twig templates to output information
# about template variables.
# - Twig templates are automatically recompiled whenever the source code
# changes (see auto_reload below).
#
# For more information about debugging Twig templates, see
# https://www.drupal.org/node/1906392.
#
# Enabling Twig debugging is not recommended in production environments.
# @default false
debug: false
# Twig auto-reload:
#
# Automatically recompile Twig templates whenever the source code changes.
# If you don't provide a value for auto_reload, it will be determined
# based on the value of debug.
#
# Enabling auto-reload is not recommended in production environments.
# @default null
auto_reload: null
# Twig cache:
#
# By default, Twig templates will be compiled and stored in the filesystem
# to increase performance. Disabling the Twig cache will recompile the
# templates from source each time they are used. In most cases the
# auto_reload setting above should be enabled rather than disabling the
# Twig cache.
#
# Disabling the Twig cache is not recommended in production environments.
# @default true
cache: true
renderer.config:
# Renderer required cache contexts:
#
# The Renderer will automatically associate these cache contexts with every
# render array, hence varying every render array by these cache contexts.
#
# @default ['languages:language_interface', 'theme', 'user.permissions']
required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
# Renderer automatic placeholdering conditions:
#
# Drupal allows portions of the page to be automatically deferred when
# rendering to improve cache performance. That is especially helpful for
# cache contexts that vary widely, such as the active user. On some sites
# those may be different, however, such as sites with only a handful of
# users. If you know what the high-cardinality cache contexts are for your
# site, specify those here. If you're not sure, the defaults are fairly safe
# in general.
#
# For more information about rendering optimizations see
# https://www.drupal.org/developing/api/8/render/arrays/cacheability#optimizing
auto_placeholder_conditions:
# Max-age at or below which caching is not considered worthwhile.
#
# Disable by setting to -1.
#
# @default 0
max-age: 0
# Cache contexts with a high cardinality.
#
# Disable by setting to [].
#
# @default ['session', 'user']
contexts: ['session', 'user']
# Tags with a high invalidation frequency.
#
# Disable by setting to [].
#
# @default []
tags: []
# Cacheability debugging:
#
# Responses with cacheability metadata (CacheableResponseInterface instances)
# get X-Drupal-Cache-Tags, X-Drupal-Cache-Contexts and X-Drupal-Cache-Max-Age
# headers.
#
# For more information about debugging cacheable responses, see
# https://www.drupal.org/developing/api/8/response/cacheable-response-interface
#
# Enabling cacheability debugging is not recommended in production
# environments.
# @default false
http.response.debug_cacheability_headers: false
factory.keyvalue: {}
# Default key/value storage service to use.
# @default keyvalue.database
# default: keyvalue.database
# Collection-specific overrides.
# state: keyvalue.database
factory.keyvalue.expirable: {}
# Default key/value expirable storage service to use.
# @default keyvalue.database.expirable
# default: keyvalue.database.expirable
# Allowed protocols for URL generation.
filter_protocols:
- http
- https
- ftp
- news
- nntp
- tel
- telnet
- mailto
- irc
- ssh
- sftp
- webcal
- rtsp
# Configure Cross-Site HTTP requests (CORS).
# Read https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
# for more information about the topic in general.
# Note: By default the configuration is disabled.
cors.config:
enabled: false
# Specify allowed headers, like 'x-allowed-header'.
allowedHeaders: []
# Specify allowed request methods, specify ['*'] to allow all possible ones.
allowedMethods: []
# Configure requests allowed from specific origins.
allowedOrigins: ['*']
# Sets the Access-Control-Expose-Headers header.
exposedHeaders: false
# Sets the Access-Control-Max-Age header.
maxAge: false
# Sets the Access-Control-Allow-Credentials header.
supportsCredentials: false

View File

@ -0,0 +1,771 @@
<?php
// phpcs:ignoreFile
/**
* @file
* Drupal site-specific configuration file.
*
* IMPORTANT NOTE:
* This file may have been set to read-only by the Drupal installation program.
* If you make changes to this file, be sure to protect it again after making
* your modifications. Failure to remove write permissions to this file is a
* security risk.
*
* In order to use the selection rules below the multisite aliasing file named
* sites/sites.php must be present. Its optional settings will be loaded, and
* the aliases in the array $sites will override the default directory rules
* below. See sites/example.sites.php for more information about aliases.
*
* The configuration directory will be discovered by stripping the website's
* hostname from left to right and pathname from right to left. The first
* configuration file found will be used and any others will be ignored. If no
* other configuration file is found then the default configuration file at
* 'sites/default' will be used.
*
* For example, for a fictitious site installed at
* https://www.drupal.org:8080/mysite/test/, the 'settings.php' file is searched
* for in the following directories:
*
* - sites/8080.www.drupal.org.mysite.test
* - sites/www.drupal.org.mysite.test
* - sites/drupal.org.mysite.test
* - sites/org.mysite.test
*
* - sites/8080.www.drupal.org.mysite
* - sites/www.drupal.org.mysite
* - sites/drupal.org.mysite
* - sites/org.mysite
*
* - sites/8080.www.drupal.org
* - sites/www.drupal.org
* - sites/drupal.org
* - sites/org
*
* - sites/default
*
* Note that if you are installing on a non-standard port number, prefix the
* hostname with that number. For example,
* https://www.drupal.org:8080/mysite/test/ could be loaded from
* sites/8080.www.drupal.org.mysite.test/.
*
* @see example.sites.php
* @see \Drupal\Core\DrupalKernel::getSitePath()
*
* In addition to customizing application settings through variables in
* settings.php, you can create a services.yml file in the same directory to
* register custom, site-specific service definitions and/or swap out default
* implementations with custom ones.
*/
/**
* Database settings:
*
* The $databases array specifies the database connection or
* connections that Drupal may use. Drupal is able to connect
* to multiple databases, including multiple types of databases,
* during the same request.
*
* One example of the simplest connection array is shown below. To use the
* sample settings, copy and uncomment the code below between the @code and
* @endcode lines and paste it after the $databases declaration. You will need
* to replace the database username and password and possibly the host and port
* with the appropriate credentials for your database system.
*
* The next section describes how to customize the $databases array for more
* specific needs.
*
* @code
* $databases['default']['default'] = [
* 'database' => 'databasename',
* 'username' => 'sqlusername',
* 'password' => 'sqlpassword',
* 'host' => 'localhost',
* 'port' => '3306',
* 'driver' => 'mysql',
* 'prefix' => '',
* 'collation' => 'utf8mb4_general_ci',
* ];
* @endcode
*/
$databases = [];
/**
* Customizing database settings.
*
* Many of the values of the $databases array can be customized for your
* particular database system. Refer to the sample in the section above as a
* starting point.
*
* The "driver" property indicates what Drupal database driver the
* connection should use. This is usually the same as the name of the
* database type, such as mysql or sqlite, but not always. The other
* properties will vary depending on the driver. For SQLite, you must
* specify a database file name in a directory that is writable by the
* webserver. For most other drivers, you must specify a
* username, password, host, and database name.
*
* Drupal core implements drivers for mysql, pgsql, and sqlite. Other drivers
* can be provided by contributed or custom modules. To use a contributed or
* custom driver, the "namespace" property must be set to the namespace of the
* driver. The code in this namespace must be autoloadable prior to connecting
* to the database, and therefore, prior to when module root namespaces are
* added to the autoloader. To add the driver's namespace to the autoloader,
* set the "autoload" property to the PSR-4 base directory of the driver's
* namespace. This is optional for projects managed with Composer if the
* driver's namespace is in Composer's autoloader.
*
* For each database, you may optionally specify multiple "target" databases.
* A target database allows Drupal to try to send certain queries to a
* different database if it can but fall back to the default connection if not.
* That is useful for primary/replica replication, as Drupal may try to connect
* to a replica server when appropriate and if one is not available will simply
* fall back to the single primary server (The terms primary/replica are
* traditionally referred to as master/slave in database server documentation).
*
* The general format for the $databases array is as follows:
* @code
* $databases['default']['default'] = $info_array;
* $databases['default']['replica'][] = $info_array;
* $databases['default']['replica'][] = $info_array;
* $databases['extra']['default'] = $info_array;
* @endcode
*
* In the above example, $info_array is an array of settings described above.
* The first line sets a "default" database that has one primary database
* (the second level default). The second and third lines create an array
* of potential replica databases. Drupal will select one at random for a given
* request as needed. The fourth line creates a new database with a name of
* "extra".
*
* You can optionally set a prefix for all database table names by using the
* 'prefix' setting. If a prefix is specified, the table name will be prepended
* with its value. Be sure to use valid database characters only, usually
* alphanumeric and underscore. If no prefix is desired, do not set the 'prefix'
* key or set its value to an empty string ''.
*
* For example, to have all database table prefixed with 'main_', set:
* @code
* 'prefix' => 'main_',
* @endcode
*
* Advanced users can add or override initial commands to execute when
* connecting to the database server, as well as PDO connection settings. For
* example, to enable MySQL SELECT queries to exceed the max_join_size system
* variable, and to reduce the database connection timeout to 5 seconds:
* @code
* $databases['default']['default'] = [
* 'init_commands' => [
* 'big_selects' => 'SET SQL_BIG_SELECTS=1',
* ],
* 'pdo' => [
* PDO::ATTR_TIMEOUT => 5,
* ],
* ];
* @endcode
*
* WARNING: The above defaults are designed for database portability. Changing
* them may cause unexpected behavior, including potential data loss. See
* https://www.drupal.org/developing/api/database/configuration for more
* information on these defaults and the potential issues.
*
* More details can be found in the constructor methods for each driver:
* - \Drupal\Core\Database\Driver\mysql\Connection::__construct()
* - \Drupal\Core\Database\Driver\pgsql\Connection::__construct()
* - \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
*
* Sample Database configuration format for PostgreSQL (pgsql):
* @code
* $databases['default']['default'] = [
* 'driver' => 'pgsql',
* 'database' => 'databasename',
* 'username' => 'sqlusername',
* 'password' => 'sqlpassword',
* 'host' => 'localhost',
* 'prefix' => '',
* ];
* @endcode
*
* Sample Database configuration format for SQLite (sqlite):
* @code
* $databases['default']['default'] = [
* 'driver' => 'sqlite',
* 'database' => '/path/to/databasefilename',
* ];
* @endcode
*
* Sample Database configuration format for a driver in a contributed module:
* @code
* $databases['default']['default'] = [
* 'driver' => 'my_driver',
* 'namespace' => 'Drupal\my_module\Driver\Database\my_driver',
* 'autoload' => 'modules/my_module/src/Driver/Database/my_driver/',
* 'database' => 'databasename',
* 'username' => 'sqlusername',
* 'password' => 'sqlpassword',
* 'host' => 'localhost',
* 'prefix' => '',
* ];
* @endcode
*/
/**
* Location of the site configuration files.
*
* The $settings['config_sync_directory'] specifies the location of file system
* directory used for syncing configuration data. On install, the directory is
* created. This is used for configuration imports.
*
* The default location for this directory is inside a randomly-named
* directory in the public files path. The setting below allows you to set
* its location.
*/
# $settings['config_sync_directory'] = '/directory/outside/webroot';
/**
* Settings:
*
* $settings contains environment-specific configuration, such as the files
* directory and reverse proxy address, and temporary configuration, such as
* security overrides.
*
* @see \Drupal\Core\Site\Settings::get()
*/
/**
* Salt for one-time login links, cancel links, form tokens, etc.
*
* This variable will be set to a random value by the installer. All one-time
* login links will be invalidated if the value is changed. Note that if your
* site is deployed on a cluster of web servers, you must ensure that this
* variable has the same value on each server.
*
* For enhanced security, you may set this variable to the contents of a file
* outside your document root; you should also ensure that this file is not
* stored with backups of your database.
*
* Example:
* @code
* $settings['hash_salt'] = file_get_contents('/home/example/salt.txt');
* @endcode
*/
$settings['hash_salt'] = '';
/**
* Deployment identifier.
*
* Drupal's dependency injection container will be automatically invalidated and
* rebuilt when the Drupal core version changes. When updating contributed or
* custom code that changes the container, changing this identifier will also
* allow the container to be invalidated as soon as code is deployed.
*/
# $settings['deployment_identifier'] = \Drupal::VERSION;
/**
* Access control for update.php script.
*
* If you are updating your Drupal installation using the update.php script but
* are not logged in using either an account with the "Administer software
* updates" permission or the site maintenance account (the account that was
* created during installation), you will need to modify the access check
* statement below. Change the FALSE to a TRUE to disable the access check.
* After finishing the upgrade, be sure to open this file again and change the
* TRUE back to a FALSE!
*/
$settings['update_free_access'] = FALSE;
/**
* Fallback to HTTP for Update Manager and for fetching security advisories.
*
* If your site fails to connect to updates.drupal.org over HTTPS (either when
* fetching data on available updates, or when fetching the feed of critical
* security announcements), you may uncomment this setting and set it to TRUE to
* allow an insecure fallback to HTTP. Note that doing so will open your site up
* to a potential man-in-the-middle attack. You should instead attempt to
* resolve the issues before enabling this option.
* @see https://www.drupal.org/docs/system-requirements/php-requirements#openssl
* @see https://en.wikipedia.org/wiki/Man-in-the-middle_attack
* @see \Drupal\update\UpdateFetcher
* @see \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher
*/
# $settings['update_fetch_with_http_fallback'] = TRUE;
/**
* External access proxy settings:
*
* If your site must access the Internet via a web proxy then you can enter the
* proxy settings here. Set the full URL of the proxy, including the port, in
* variables:
* - $settings['http_client_config']['proxy']['http']: The proxy URL for HTTP
* requests.
* - $settings['http_client_config']['proxy']['https']: The proxy URL for HTTPS
* requests.
* You can pass in the user name and password for basic authentication in the
* URLs in these settings.
*
* You can also define an array of host names that can be accessed directly,
* bypassing the proxy, in $settings['http_client_config']['proxy']['no'].
*/
# $settings['http_client_config']['proxy']['http'] = 'http://proxy_user:proxy_pass@example.com:8080';
# $settings['http_client_config']['proxy']['https'] = 'http://proxy_user:proxy_pass@example.com:8080';
# $settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost'];
/**
* Reverse Proxy Configuration:
*
* Reverse proxy servers are often used to enhance the performance
* of heavily visited sites and may also provide other site caching,
* security, or encryption benefits. In an environment where Drupal
* is behind a reverse proxy, the real IP address of the client should
* be determined such that the correct client IP address is available
* to Drupal's logging, statistics, and access management systems. In
* the most simple scenario, the proxy server will add an
* X-Forwarded-For header to the request that contains the client IP
* address. However, HTTP headers are vulnerable to spoofing, where a
* malicious client could bypass restrictions by setting the
* X-Forwarded-For header directly. Therefore, Drupal's proxy
* configuration requires the IP addresses of all remote proxies to be
* specified in $settings['reverse_proxy_addresses'] to work correctly.
*
* Enable this setting to get Drupal to determine the client IP from the
* X-Forwarded-For header. If you are unsure about this setting, do not have a
* reverse proxy, or Drupal operates in a shared hosting environment, this
* setting should remain commented out.
*
* In order for this setting to be used you must specify every possible
* reverse proxy IP address in $settings['reverse_proxy_addresses'].
* If a complete list of reverse proxies is not available in your
* environment (for example, if you use a CDN) you may set the
* $_SERVER['REMOTE_ADDR'] variable directly in settings.php.
* Be aware, however, that it is likely that this would allow IP
* address spoofing unless more advanced precautions are taken.
*/
# $settings['reverse_proxy'] = TRUE;
/**
* Specify every reverse proxy IP address in your environment.
* This setting is required if $settings['reverse_proxy'] is TRUE.
*/
# $settings['reverse_proxy_addresses'] = ['a.b.c.d', ...];
/**
* Reverse proxy trusted headers.
*
* Sets which headers to trust from your reverse proxy.
*
* Common values are:
* - \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR
* - \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST
* - \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT
* - \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO
* - \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
*
* Note the default value of
* @code
* \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
* @endcode
* is not secure by default. The value should be set to only the specific
* headers the reverse proxy uses. For example:
* @code
* \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO
* @endcode
* This would trust the following headers:
* - X_FORWARDED_FOR
* - X_FORWARDED_HOST
* - X_FORWARDED_PROTO
* - X_FORWARDED_PORT
*
* @see \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR
* @see \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST
* @see \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT
* @see \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO
* @see \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
* @see \Symfony\Component\HttpFoundation\Request::setTrustedProxies
*/
# $settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;
/**
* Page caching:
*
* By default, Drupal sends a "Vary: Cookie" HTTP header for anonymous page
* views. This tells a HTTP proxy that it may return a page from its local
* cache without contacting the web server, if the user sends the same Cookie
* header as the user who originally requested the cached page. Without "Vary:
* Cookie", authenticated users would also be served the anonymous page from
* the cache. If the site has mostly anonymous users except a few known
* editors/administrators, the Vary header can be omitted. This allows for
* better caching in HTTP proxies (including reverse proxies), i.e. even if
* clients send different cookies, they still get content served from the cache.
* However, authenticated users should access the site directly (i.e. not use an
* HTTP proxy, and bypass the reverse proxy if one is used) in order to avoid
* getting cached pages from the proxy.
*/
# $settings['omit_vary_cookie'] = TRUE;
/**
* Cache TTL for client error (4xx) responses.
*
* Items cached per-URL tend to result in a large number of cache items, and
* this can be problematic on 404 pages which by their nature are unbounded. A
* fixed TTL can be set for these items, defaulting to one hour, so that cache
* backends which do not support LRU can purge older entries. To disable caching
* of client error responses set the value to 0. Currently applies only to
* page_cache module.
*/
# $settings['cache_ttl_4xx'] = 3600;
/**
* Expiration of cached forms.
*
* Drupal's Form API stores details of forms in a cache and these entries are
* kept for at least 6 hours by default. Expired entries are cleared by cron.
*
* @see \Drupal\Core\Form\FormCache::setCache()
*/
# $settings['form_cache_expiration'] = 21600;
/**
* Class Loader.
*
* If the APCu extension is detected, the classloader will be optimized to use
* it. Set to FALSE to disable this.
*
* @see https://getcomposer.org/doc/articles/autoloader-optimization.md
*/
# $settings['class_loader_auto_detect'] = FALSE;
/**
* Authorized file system operations:
*
* The Update Manager module included with Drupal provides a mechanism for
* site administrators to securely install missing updates for the site
* directly through the web user interface. On securely-configured servers,
* the Update manager will require the administrator to provide SSH or FTP
* credentials before allowing the installation to proceed; this allows the
* site to update the new files as the user who owns all the Drupal files,
* instead of as the user the webserver is running as. On servers where the
* webserver user is itself the owner of the Drupal files, the administrator
* will not be prompted for SSH or FTP credentials (note that these server
* setups are common on shared hosting, but are inherently insecure).
*
* Some sites might wish to disable the above functionality, and only update
* the code directly via SSH or FTP themselves. This setting completely
* disables all functionality related to these authorized file operations.
*
* @see https://www.drupal.org/node/244924
*
* Remove the leading hash signs to disable.
*/
# $settings['allow_authorize_operations'] = FALSE;
/**
* Default mode for directories and files written by Drupal.
*
* Value should be in PHP Octal Notation, with leading zero.
*/
# $settings['file_chmod_directory'] = 0775;
# $settings['file_chmod_file'] = 0664;
/**
* Public file base URL:
*
* An alternative base URL to be used for serving public files. This must
* include any leading directory path.
*
* A different value from the domain used by Drupal to be used for accessing
* public files. This can be used for a simple CDN integration, or to improve
* security by serving user-uploaded files from a different domain or subdomain
* pointing to the same server. Do not include a trailing slash.
*/
# $settings['file_public_base_url'] = 'http://downloads.example.com/files';
/**
* Public file path:
*
* A local file system path where public files will be stored. This directory
* must exist and be writable by Drupal. This directory must be relative to
* the Drupal installation directory and be accessible over the web.
*/
# $settings['file_public_path'] = 'sites/default/files';
/**
* Private file path:
*
* A local file system path where private files will be stored. This directory
* must be absolute, outside of the Drupal installation directory and not
* accessible over the web.
*
* Note: Caches need to be cleared when this value is changed to make the
* private:// stream wrapper available to the system.
*
* See https://www.drupal.org/documentation/modules/file for more information
* about securing private files.
*/
# $settings['file_private_path'] = '';
/**
* Temporary file path:
*
* A local file system path where temporary files will be stored. This directory
* must be absolute, outside of the Drupal installation directory and not
* accessible over the web.
*
* If this is not set, the default for the operating system will be used.
*
* @see \Drupal\Component\FileSystem\FileSystem::getOsTemporaryDirectory()
*/
# $settings['file_temp_path'] = '/tmp';
/**
* Session write interval:
*
* Set the minimum interval between each session write to database.
* For performance reasons it defaults to 180.
*/
# $settings['session_write_interval'] = 180;
/**
* String overrides:
*
* To override specific strings on your site with or without enabling the Locale
* module, add an entry to this list. This functionality allows you to change
* a small number of your site's default English language interface strings.
*
* Remove the leading hash signs to enable.
*
* The "en" part of the variable name, is dynamic and can be any langcode of
* any added language. (eg locale_custom_strings_de for german).
*/
# $settings['locale_custom_strings_en'][''] = [
# 'forum' => 'Discussion board',
# '@count min' => '@count minutes',
# ];
/**
* A custom theme for the offline page:
*
* This applies when the site is explicitly set to maintenance mode through the
* administration page or when the database is inactive due to an error.
* The template file should also be copied into the theme. It is located inside
* 'core/modules/system/templates/maintenance-page.html.twig'.
*
* Note: This setting does not apply to installation and update pages.
*/
# $settings['maintenance_theme'] = 'bartik';
/**
* PHP settings:
*
* To see what PHP settings are possible, including whether they can be set at
* runtime (by using ini_set()), read the PHP documentation:
* http://php.net/manual/ini.list.php
* See \Drupal\Core\DrupalKernel::bootEnvironment() for required runtime
* settings and the .htaccess file for non-runtime settings.
* Settings defined there should not be duplicated here so as to avoid conflict
* issues.
*/
/**
* If you encounter a situation where users post a large amount of text, and
* the result is stripped out upon viewing but can still be edited, Drupal's
* output filter may not have sufficient memory to process it. If you
* experience this issue, you may wish to uncomment the following two lines
* and increase the limits of these variables. For more information, see
* http://php.net/manual/pcre.configuration.php.
*/
# ini_set('pcre.backtrack_limit', 200000);
# ini_set('pcre.recursion_limit', 200000);
/**
* Add Permissions-Policy header to disable Google FLoC.
*
* By default, Drupal sends the 'Permissions-Policy: interest-cohort=()' header
* to disable Google's Federated Learning of Cohorts feature, introduced in
* Chrome 89.
*
* See https://en.wikipedia.org/wiki/Federated_Learning_of_Cohorts for more
* information about FLoC.
*
* If you don't wish to disable FLoC in Chrome, you can set this value
* to FALSE.
*/
# $settings['block_interest_cohort'] = TRUE;
/**
* Configuration overrides.
*
* To globally override specific configuration values for this site,
* set them here. You usually don't need to use this feature. This is
* useful in a configuration file for a vhost or directory, rather than
* the default settings.php.
*
* Note that any values you provide in these variable overrides will not be
* viewable from the Drupal administration interface. The administration
* interface displays the values stored in configuration so that you can stage
* changes to other environments that don't have the overrides.
*
* There are particular configuration values that are risky to override. For
* example, overriding the list of installed modules in 'core.extension' is not
* supported as module install or uninstall has not occurred. Other examples
* include field storage configuration, because it has effects on database
* structure, and 'core.menu.static_menu_link_overrides' since this is cached in
* a way that is not config override aware. Also, note that changing
* configuration values in settings.php will not fire any of the configuration
* change events.
*/
# $config['system.site']['name'] = 'My Drupal site';
# $config['user.settings']['anonymous'] = 'Visitor';
/**
* Fast 404 pages:
*
* Drupal can generate fully themed 404 pages. However, some of these responses
* are for images or other resource files that are not displayed to the user.
* This can waste bandwidth, and also generate server load.
*
* The options below return a simple, fast 404 page for URLs matching a
* specific pattern:
* - $config['system.performance']['fast_404']['exclude_paths']: A regular
* expression to match paths to exclude, such as images generated by image
* styles, or dynamically-resized images. The default pattern provided below
* also excludes the private file system. If you need to add more paths, you
* can add '|path' to the expression.
* - $config['system.performance']['fast_404']['paths']: A regular expression to
* match paths that should return a simple 404 page, rather than the fully
* themed 404 page. If you don't have any aliases ending in htm or html you
* can add '|s?html?' to the expression.
* - $config['system.performance']['fast_404']['html']: The html to return for
* simple 404 pages.
*
* Remove the leading hash signs if you would like to alter this functionality.
*/
# $config['system.performance']['fast_404']['exclude_paths'] = '/\/(?:styles)|(?:system\/files)\//';
# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
# $config['system.performance']['fast_404']['html'] = '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>';
/**
* Load services definition file.
*/
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
/**
* Override the default service container class.
*
* This is useful for example to trace the service container for performance
* tracking purposes, for testing a service container with an error condition or
* to test a service container that throws an exception.
*/
# $settings['container_base_class'] = '\Drupal\Core\DependencyInjection\Container';
/**
* Override the default yaml parser class.
*
* Provide a fully qualified class name here if you would like to provide an
* alternate implementation YAML parser. The class must implement the
* \Drupal\Component\Serialization\SerializationInterface interface.
*/
# $settings['yaml_parser_class'] = NULL;
/**
* Trusted host configuration.
*
* Drupal core can use the Symfony trusted host mechanism to prevent HTTP Host
* header spoofing.
*
* To enable the trusted host mechanism, you enable your allowable hosts
* in $settings['trusted_host_patterns']. This should be an array of regular
* expression patterns, without delimiters, representing the hosts you would
* like to allow.
*
* For example:
* @code
* $settings['trusted_host_patterns'] = [
* '^www\.example\.com$',
* ];
* @endcode
* will allow the site to only run from www.example.com.
*
* If you are running multisite, or if you are running your site from
* different domain names (eg, you don't redirect http://www.example.com to
* http://example.com), you should specify all of the host patterns that are
* allowed by your site.
*
* For example:
* @code
* $settings['trusted_host_patterns'] = [
* '^example\.com$',
* '^.+\.example\.com$',
* '^example\.org$',
* '^.+\.example\.org$',
* ];
* @endcode
* will allow the site to run off of all variants of example.com and
* example.org, with all subdomains included.
*/
/**
* The default list of directories that will be ignored by Drupal's file API.
*
* By default ignore node_modules and bower_components folders to avoid issues
* with common frontend tools and recursive scanning of directories looking for
* extensions.
*
* @see \Drupal\Core\File\FileSystemInterface::scanDirectory()
* @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory()
*/
$settings['file_scan_ignore_directories'] = [
'node_modules',
'bower_components',
];
/**
* The default number of entities to update in a batch process.
*
* This is used by update and post-update functions that need to go through and
* change all the entities on a site, so it is useful to increase this number
* if your hosting configuration (i.e. RAM allocation, CPU speed) allows for a
* larger number of entities to be processed in a single batch run.
*/
$settings['entity_update_batch_size'] = 50;
/**
* Entity update backup.
*
* This is used to inform the entity storage handler that the backup tables as
* well as the original entity type and field storage definitions should be
* retained after a successful entity update process.
*/
$settings['entity_update_backup'] = TRUE;
/**
* Node migration type.
*
* This is used to force the migration system to use the classic node migrations
* instead of the default complete node migrations. The migration system will
* use the classic node migration only if there are existing migrate_map tables
* for the classic node migrations and they contain data. These tables may not
* exist if you are developing custom migrations and do not want to use the
* complete node migrations. Set this to TRUE to force the use of the classic
* node migrations.
*/
$settings['migrate_node_migrate_type_classic'] = FALSE;
/**
* Load local development override configuration, if available.
*
* Create a settings.local.php file to override variables on secondary (staging,
* development, etc.) installations of this site.
*
* Typical uses of settings.local.php include:
* - Disabling caching.
* - Disabling JavaScript/CSS compression.
* - Rerouting outgoing emails.
*
* Keep this code block at the end of this file to take full effect.
*/
#
# if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
# include $app_root . '/' . $site_path . '/settings.local.php';
# }

View File

@ -0,0 +1,9 @@
# Local development services.
#
# To activate this feature, follow the instructions at the top of the
# 'example.settings.local.php' file, which sits next to this file.
parameters:
http.response.debug_cacheability_headers: true
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory

View File

@ -0,0 +1,3 @@
Please read core/INSTALL.txt for detailed installation instructions for your
Drupal website.

View File

@ -0,0 +1,75 @@
<img alt="Drupal Logo" src="https://www.drupal.org/files/Wordmark_blue_RGB.png" height="60px">
Drupal is an open source content management platform supporting a variety of
websites ranging from personal weblogs to large community-driven websites. For
more information, visit the Drupal website, [Drupal.org][Drupal.org], and join
the [Drupal community][Drupal community].
## Contributing
Drupal is developed on [Drupal.org][Drupal.org], the home of the international
Drupal community since 2001!
[Drupal.org][Drupal.org] hosts Drupal's [GitLab repository][GitLab repository],
its [issue queue][issue queue], and its [documentation][documentation]. Before
you start working on code, be sure to search the [issue queue][issue queue] and
create an issue if your aren't able to find an existing issue.
Every issue on Drupal.org automatically creates a new community-accessible fork
that you can contribute to. Learn more about the code contribution process on
the [Issue forks & merge requests page][issue forks].
## Usage
For a brief introduction, see [USAGE.txt](/core/USAGE.txt). You can also find
guides, API references, and more by visiting Drupal's [documentation
page][documentation].
You can quickly extend Drupal's core feature set by installing any of its
[thousands of free and open source modules][modules]. With Drupal and its
module ecosystem, you can often build most or all of what your project needs
before writing a single line of code.
## Changelog
Drupal keeps detailed [change records][changelog]. You can search Drupal's
changes for a record of every notable breaking change and new feature since
2011.
## Security
For a list of security announcements, see the [Security advisories
page][Security advisories] (available as [an RSS feed][security RSS]). This
page also describes how to subscribe to these announcements via email.
For information about the Drupal security process, or to find out how to report
a potential security issue to the Drupal security team, see the [Security team
page][security team].
## Need a helping hand?
Visit the [Support page][support] or browse [over a thousand Drupal
providers][service providers] offering design, strategy, development, and
hosting services.
## Legal matters
Know your rights when using Drupal by reading Drupal core's
[license](/core/LICENSE.txt).
Learn about the [Drupal trademark and logo policy here][trademark].
[Drupal.org]: https://www.drupal.org
[Drupal community]: https://www.drupal.org/community
[GitLab repository]: https://git.drupalcode.org/project/drupal
[issue queue]: https://www.drupal.org/project/issues/drupal
[issue forks]: https://www.drupal.org/drupalorg/docs/gitlab-integration/issue-forks-merge-requests
[documentation]: https://www.drupal.org/documentation
[changelog]: https://www.drupal.org/list-changes/drupal
[modules]: https://www.drupal.org/project/project_module
[security advisories]: https://www.drupal.org/security
[security RSS]: https://www.drupal.org/security/rss.xml
[security team]: https://www.drupal.org/drupal-security-team
[service providers]: https://www.drupal.org/drupal-services
[support]: https://www.drupal.org/support
[trademark]: https://www.drupal.com/trademark

View File

@ -0,0 +1,17 @@
# Drupal editor configuration normalization
# @see http://editorconfig.org/
# This is the top-most .editorconfig file; do not search in parent directories.
root = true
# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[composer.{json,lock}]
indent_size = 4

View File

@ -0,0 +1,8 @@
core/**/*
vendor/**/*
sites/**/files/**/*
libraries/**/*
sites/**/libraries/**/*
profiles/**/libraries/**/*
**/js_test_files/**/*
**/node_modules/**/*

View File

@ -0,0 +1,3 @@
{
"extends": "./core/.eslintrc.json"
}

View File

@ -0,0 +1,42 @@
# This file contains default .gitignore rules. To use it, copy it to .gitignore,
# and it will cause files like your settings.php and user-uploaded files to be
# excluded from Git version control. This is a common strategy to avoid
# accidentally including private information in public repositories and patch
# files.
#
# Because .gitignore can be specific to your site, this file has a different
# name; updating Drupal core will not override your custom .gitignore file.
# Ignore core when managing all of a project's dependencies with Composer
# including Drupal core.
# core
# Ignore dependencies that are managed with Composer.
# Generally you should only ignore the root vendor directory. It's important
# that core/assets/vendor and any other vendor directories within contrib or
# custom module, theme, etc., are not ignored unless you purposely do so.
/vendor/
# Ignore configuration files that may contain sensitive information.
sites/*/settings*.php
sites/*/services*.yml
# Ignore paths that contain user-generated content.
sites/*/files
sites/*/private
# Ignore SimpleTest multi-site environment.
sites/simpletest
# If you prefer to store your .gitignore file in the sites/ folder, comment
# or delete the previous settings and uncomment the following ones, instead.
# Ignore configuration files that may contain sensitive information.
# */settings*.php
# Ignore paths that contain user-generated content.
# */files
# */private
# Ignore SimpleTest multi-site environment.
# simpletest

View File

@ -0,0 +1,155 @@
<?php
// phpcs:ignoreFile
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
* 'sites/default/settings.php' and uncomment the commented lines that mention
* 'settings.local.php'.
*
* If you are using a site name in the path, such as 'sites/example.com', copy
* this file to 'sites/example.com/settings.local.php', and uncomment the lines
* at the bottom of 'sites/example.com/settings.php'.
*/
/**
* Assertions.
*
* The Drupal project primarily uses runtime assertions to enforce the
* expectations of the API by failing when incorrect calls are made by code
* under development.
*
* @see http://php.net/assert
* @see https://www.drupal.org/node/2492225
*
* If you are using PHP 7.0 it is strongly recommended that you set
* zend.assertions=1 in the PHP.ini file (It cannot be changed from .htaccess
* or runtime) on development machines and to 0 in production.
*
* @see https://wiki.php.net/rfc/expectations
*/
assert_options(ASSERT_ACTIVE, TRUE);
\Drupal\Component\Assertion\Handle::register();
/**
* Enable local development services.
*/
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
/**
* Show all error messages, with backtrace information.
*
* In case the error level could not be fetched from the database, as for
* example the database connection failed, we rely only on this value.
*/
$config['system.logging']['error_level'] = 'verbose';
/**
* Disable CSS and JS aggregation.
*/
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
/**
* Disable the render cache.
*
* Note: you should test with the render cache enabled, to ensure the correct
* cacheability metadata is present. However, in the early stages of
* development, you may want to disable it.
*
* This setting disables the render cache by using the Null cache back-end
* defined by the development.services.yml file above.
*
* Only use this setting once the site has been installed.
*/
# $settings['cache']['bins']['render'] = 'cache.backend.null';
/**
* Disable caching for migrations.
*
* Uncomment the code below to only store migrations in memory and not in the
* database. This makes it easier to develop custom migrations.
*/
# $settings['cache']['bins']['discovery_migration'] = 'cache.backend.memory';
/**
* Disable Internal Page Cache.
*
* Note: you should test with Internal Page Cache enabled, to ensure the correct
* cacheability metadata is present. However, in the early stages of
* development, you may want to disable it.
*
* This setting disables the page cache by using the Null cache back-end
* defined by the development.services.yml file above.
*
* Only use this setting once the site has been installed.
*/
# $settings['cache']['bins']['page'] = 'cache.backend.null';
/**
* Disable Dynamic Page Cache.
*
* Note: you should test with Dynamic Page Cache enabled, to ensure the correct
* cacheability metadata is present (and hence the expected behavior). However,
* in the early stages of development, you may want to disable it.
*/
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
/**
* Allow test modules and themes to be installed.
*
* Drupal ignores test modules and themes by default for performance reasons.
* During development it can be useful to install test extensions for debugging
* purposes.
*/
# $settings['extension_discovery_scan_tests'] = TRUE;
/**
* Enable access to rebuild.php.
*
* This setting can be enabled to allow Drupal's php and database cached
* storage to be cleared via the rebuild.php page. Access to this page can also
* be gained by generating a query string from rebuild_token_calculator.sh and
* using these parameters in a request to rebuild.php.
*/
$settings['rebuild_access'] = TRUE;
/**
* Skip file system permissions hardening.
*
* The system module will periodically check the permissions of your site's
* site directory to ensure that it is not writable by the website user. For
* sites that are managed with a version control system, this can cause problems
* when files in that directory such as settings.php are updated, because the
* user pulling in the changes won't have permissions to modify files in the
* directory.
*/
$settings['skip_permissions_hardening'] = TRUE;
/**
* Exclude modules from configuration synchronization.
*
* On config export sync, no config or dependent config of any excluded module
* is exported. On config import sync, any config of any installed excluded
* module is ignored. In the exported configuration, it will be as if the
* excluded module had never been installed. When syncing configuration, if an
* excluded module is already installed, it will not be uninstalled by the
* configuration synchronization, and dependent configuration will remain
* intact. This affects only configuration synchronization; single import and
* export of configuration are not affected.
*
* Drupal does not validate or sanity check the list of excluded modules. For
* instance, it is your own responsibility to never exclude required modules,
* because it would mean that the exported configuration can not be imported
* anymore.
*
* This is an advanced feature and using it means opting out of some of the
* guarantees the configuration synchronization provides. It is not recommended
* to use this feature with modules that affect Drupal in a major way such as
* the language or field module.
*/
# $settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];

View File

@ -0,0 +1,57 @@
<?php
// phpcs:ignoreFile
/**
* @file
* Configuration file for multi-site support and directory aliasing feature.
*
* This file is required for multi-site support and also allows you to define a
* set of aliases that map hostnames, ports, and pathnames to configuration
* directories in the sites directory. These aliases are loaded prior to
* scanning for directories, and they are exempt from the normal discovery
* rules. See default.settings.php to view how Drupal discovers the
* configuration directory when no alias is found.
*
* Aliases are useful on development servers, where the domain name may not be
* the same as the domain of the live server. Since Drupal stores file paths in
* the database (files, system table, etc.) this will ensure the paths are
* correct when the site is deployed to a live server.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/sites.php'.
*
* Aliases are defined in an associative array named $sites. The array is
* written in the format: '<port>.<domain>.<path>' => 'directory'. As an
* example, to map https://www.drupal.org:8080/mysite/test to the configuration
* directory sites/example.com, the array should be defined as:
* @code
* $sites = [
* '8080.www.drupal.org.mysite.test' => 'example.com',
* ];
* @endcode
* The URL, https://www.drupal.org:8080/mysite/test/, could be a symbolic link
* or an Apache Alias directive that points to the Drupal root containing
* index.php. An alias could also be created for a subdomain. See the
* @link https://www.drupal.org/documentation/install online Drupal installation guide @endlink
* for more information on setting up domains, subdomains, and subdirectories.
*
* The following examples look for a site configuration in sites/example.com:
* @code
* URL: http://dev.drupal.org
* $sites['dev.drupal.org'] = 'example.com';
*
* URL: http://localhost/example
* $sites['localhost.example'] = 'example.com';
*
* URL: http://localhost:8080/example
* $sites['8080.localhost.example'] = 'example.com';
*
* URL: https://www.drupal.org:8080/mysite/test/
* $sites['8080.www.drupal.org.mysite.test'] = 'example.com';
* @endcode
*
* @see default.settings.php
* @see \Drupal\Core\DrupalKernel::getSitePath()
* @see https://www.drupal.org/documentation/install/multi-site
*/

View File

@ -0,0 +1,61 @@
# Drupal git normalization
# @see https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# @see https://www.drupal.org/node/1542048
# Normally these settings would be done with macro attributes for improved
# readability and easier maintenance. However macros can only be defined at the
# repository root directory. Drupal avoids making any assumptions about where it
# is installed.
# Define text file attributes.
# - Treat them as text.
# - Ensure no CRLF line-endings, neither on checkout nor on checkin.
# - Detect whitespace errors.
# - Exposed by default in `git diff --color` on the CLI.
# - Validate with `git diff --check`.
# - Deny applying with `git apply --whitespace=error-all`.
# - Fix automatically with `git apply --whitespace=fix`.
*.config text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.dist text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.engine text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=html
*.inc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.install text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.map text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.module text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.po text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.profile text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.script text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.sql text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.svg text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.theme text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php
*.twig text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
# Define binary file attributes.
# - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ."
*.eot -text diff
*.exe -text diff
*.gif -text diff
*.gz -text diff
*.ico -text diff
*.jpeg -text diff
*.jpg -text diff
*.otf -text diff
*.phar -text diff
*.png -text diff
*.svgz -text diff
*.ttf -text diff
*.woff -text diff
*.woff2 -text diff

View File

@ -0,0 +1,65 @@
<?php
/**
* @file
* Router script for the built-in PHP web server.
*
* The built-in web server should only be used for development and testing as it
* has a number of limitations that makes running Drupal on it highly insecure
* and somewhat limited.
*
* Note that:
* - The server is single-threaded, any requests made during the execution of
* the main request will hang until the main request has been completed.
* - The web server does not enforce any of the settings in .htaccess in
* particular a remote user will be able to download files that normally would
* be protected from direct access such as .module files.
*
* The router script is needed to work around a bug in PHP, see
* https://bugs.php.net/bug.php?id=61286.
*
* Usage:
* php -S localhost:8888 .ht.router.php
*
* @see http://php.net/manual/en/features.commandline.webserver.php
*/
$url = parse_url($_SERVER['REQUEST_URI']);
if (file_exists(__DIR__ . $url['path'])) {
// Serve the requested resource as-is.
return FALSE;
}
// Work around the PHP bug.
$path = $url['path'];
$script = 'index.php';
if (strpos($path, '.php') !== FALSE) {
// Work backwards through the path to check if a script exists. Otherwise
// fallback to index.php.
do {
$path = dirname($path);
if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) {
// Discovered that the path contains an existing PHP file. Use that as the
// script to include.
$script = ltrim($path, '/');
break;
}
} while ($path !== '/' && $path !== '.');
}
// Update $_SERVER variables to point to the correct index-file.
$index_file_absolute = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $script;
$index_file_relative = DIRECTORY_SEPARATOR . $script;
// SCRIPT_FILENAME will point to the router script itself, it should point to
// the full path of index.php.
$_SERVER['SCRIPT_FILENAME'] = $index_file_absolute;
// SCRIPT_NAME and PHP_SELF will either point to index.php or contain the full
// virtual path being requested depending on the URL being requested. They
// should always point to index.php relative to document root.
$_SERVER['SCRIPT_NAME'] = $index_file_relative;
$_SERVER['PHP_SELF'] = $index_file_relative;
// Require the script and let core take over.
require $_SERVER['SCRIPT_FILENAME'];

View File

@ -0,0 +1,182 @@
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
</IfModule>
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Set the default handler.
DirectoryIndex index.php index.html index.htm
# Add correct encoding for SVGZ.
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Most of the following PHP settings cannot be changed at runtime. See
# sites/default/default.settings.php and
# Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
# changed at runtime.
# PHP 7, Apache 1 and 2.
<IfModule mod_php7.c>
php_value assert.active 0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>
# Set a fallback resource if mod_rewrite is not enabled. This allows Drupal to
# work without clean URLs. This requires Apache version >= 2.2.16. If Drupal is
# not accessed by the top level URL (i.e.: http://example.com/drupal/ instead of
# http://example.com/), the path to index.php will need to be adjusted.
<IfModule !mod_rewrite.c>
FallbackResource /index.php
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "/\.|^\.(?!well-known/)" - [F]
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/foo will be redirected to http://www.example.com/foo)
# uncomment the following:
# RewriteCond %{HTTP_HOST} .
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/foo will be redirected to http://example.com/foo)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
# Redirect common PHP files to their new locations.
RewriteCond %{REQUEST_URI} ^(.*)?/(install\.php) [OR]
RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild\.php)
RewriteCond %{REQUEST_URI} !core
RewriteRule ^ %1/core/%2 [L,QSA,R=301]
# Rewrite install.php during installation to see if mod_rewrite is working
RewriteRule ^core/install\.php core/install.php?rewrite=ok [QSA,L]
# Pass all requests not referring directly to files in the filesystem to
# index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
# For security reasons, deny access to other PHP files on public sites.
# Note: The following URI conditions are not anchored at the start (^),
# because Drupal may be located in a subdirectory. To further improve
# security, you can replace '!/' with '!^/'.
# Allow access to PHP files in /core (like authorize.php or install.php):
RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
# Allow access to test-specific PHP files:
RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?\.php
# Allow access to Statistics module's custom front controller.
# Copy and adapt this rule to directly execute PHP files in contributed or
# custom modules or to run another PHP application in the same directory.
RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics\.php$
# Deny access to any other PHP files that do not match the rules above.
# Specifically, disallow autoload.php from being served directly.
RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
# Serve correct content types, and prevent double compression.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header set Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>
# Various header fixes.
<IfModule mod_headers.c>
# Disable content sniffing, since it's an attack vector.
Header always set X-Content-Type-Options nosniff
# Disable Proxy header, since it's an attack vector.
RequestHeader unset Proxy
</IfModule>

View File

@ -0,0 +1,22 @@
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$kernel = new DrupalKernel('prod', $autoloader);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

View File

@ -0,0 +1,42 @@
Modules extend your site functionality beyond Drupal core.
WHAT TO PLACE IN THIS DIRECTORY?
--------------------------------
Placing downloaded and custom modules in this directory separates downloaded and
custom modules from Drupal core's modules. This allows Drupal core to be updated
without overwriting these files.
DOWNLOAD ADDITIONAL MODULES
---------------------------
Contributed modules from the Drupal community may be downloaded at
https://www.drupal.org/project/project_module.
ORGANIZING MODULES IN THIS DIRECTORY
------------------------------------
You may create subdirectories in this directory, to organize your added modules,
without breaking the site. Some common subdirectories include "contrib" for
contributed modules, and "custom" for custom modules. Note that if you move a
module to a subdirectory after it has been enabled, you may need to clear the
Drupal cache so it can be found.
There are number of directories that are ignored when looking for modules. These
are 'src', 'lib', 'vendor', 'assets', 'css', 'files', 'images', 'js', 'misc',
'templates', 'includes', 'fixtures' and 'Drupal'.
MULTISITE CONFIGURATION
-----------------------
In multisite configurations, modules found in this directory are available to
all sites. You may also put modules in the sites/all/modules directory, and the
versions in sites/all/modules will take precedence over versions of the same
module that are here. Alternatively, the sites/your_site_name/modules directory
pattern may be used to restrict modules to a specific site instance.
MORE INFORMATION
----------------
Refer to the “Developing for Drupal” section of the README.txt in the Drupal
root directory for further information on extending Drupal with custom modules.

View File

@ -0,0 +1,28 @@
Installation profiles define additional steps that run after the base
installation of Drupal is completed. They may also offer additional
functionality and change the behavior of the site.
WHAT TO PLACE IN THIS DIRECTORY?
--------------------------------
Place downloaded and custom installation profiles in this directory.
Note that installation profiles are generally provided as part of a Drupal
distribution.
DOWNLOAD ADDITIONAL DISTRIBUTIONS
---------------------------------
Contributed distributions from the Drupal community may be downloaded at
https://www.drupal.org/project/project_distribution.
MULTISITE CONFIGURATION
-----------------------
In multisite configurations, installation profiles found in this directory are
available to all sites during their initial site installation.
MORE INFORMATION
----------------
Refer to the "Installation profiles" section of the README.txt in the Drupal
root directory for further information on extending Drupal with custom profiles.

View File

@ -0,0 +1,61 @@
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used: http://example.com/robots.txt
# Ignored: http://example.com/site/robots.txt
#
# For more information about the robots.txt standard, see:
# http://www.robotstxt.org/robotstxt.html
User-agent: *
# CSS, JS, Images
Allow: /core/*.css$
Allow: /core/*.css?
Allow: /core/*.js$
Allow: /core/*.js?
Allow: /core/*.gif
Allow: /core/*.jpg
Allow: /core/*.jpeg
Allow: /core/*.png
Allow: /core/*.svg
Allow: /profiles/*.css$
Allow: /profiles/*.css?
Allow: /profiles/*.js$
Allow: /profiles/*.js?
Allow: /profiles/*.gif
Allow: /profiles/*.jpg
Allow: /profiles/*.jpeg
Allow: /profiles/*.png
Allow: /profiles/*.svg
# Directories
Disallow: /core/
Disallow: /profiles/
# Files
Disallow: /README.txt
Disallow: /web.config
# Paths (clean URLs)
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register
Disallow: /user/password
Disallow: /user/login
Disallow: /user/logout
# Paths (no clean URLs)
Disallow: /index.php/admin/
Disallow: /index.php/comment/reply/
Disallow: /index.php/filter/tips
Disallow: /index.php/node/add/
Disallow: /index.php/search/
Disallow: /index.php/user/password
Disallow: /index.php/user/register
Disallow: /index.php/user/login
Disallow: /index.php/user/logout

View File

@ -0,0 +1,10 @@
This directory structure contains the settings and configuration files specific
to your site or sites and is an integral part of multisite configurations.
It is now recommended to place your custom and downloaded extensions in the
/modules, /themes, and /profiles directories located in the Drupal root. The
sites/all/ subdirectory structure, which was recommended in previous versions
of Drupal, is still supported.
See core/INSTALL.txt for information about single-site installation or
multisite configuration.

View File

@ -0,0 +1,31 @@
Themes allow you to change the look and feel of your Drupal site. You can use
themes contributed by others or create your own.
WHAT TO PLACE IN THIS DIRECTORY?
--------------------------------
Placing downloaded and custom themes in this directory separates downloaded and
custom themes from Drupal core's themes. This allows Drupal core to be updated
without overwriting these files.
DOWNLOAD ADDITIONAL THEMES
--------------------------
Contributed themes from the Drupal community may be downloaded at
https://www.drupal.org/project/project_theme.
MULTISITE CONFIGURATION
-----------------------
In multisite configurations, themes found in this directory are available to
all sites. You may also put themes in the sites/all/themes directory, and the
versions in sites/all/themes will take precedence over versions of the same
themes that are here. Alternatively, the sites/your_site_name/themes directory
pattern may be used to restrict themes to a specific site instance.
MORE INFORMATION
-----------------
Refer to the "Appearance" section of the README.txt in the Drupal root directory
for further information on customizing the appearance of Drupal with custom
themes.

View File

@ -0,0 +1,30 @@
<?php
/**
* @file
* The PHP page that handles updating the Drupal installation.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
use Drupal\Core\Update\UpdateKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
// Disable garbage collection during test runs. Under certain circumstances the
// update path will create so many objects that garbage collection causes
// segmentation faults.
if (drupal_valid_test_ua()) {
gc_collect_cycles();
gc_disable();
}
$kernel = new UpdateKernel('prod', $autoloader, FALSE);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- Don't show directory listings for URLs which map to a directory. -->
<directoryBrowse enabled="false" />
<!--
Caching configuration was not delegated by default. Some hosters may not
delegate the caching configuration to site owners by default and that
may cause errors when users install. Uncomment this if you want to and
are allowed to enable caching.
-->
<!--
<caching>
<profiles>
<add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />
<add extension=".html" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="14:00:00" />
</profiles>
</caching>
-->
<rewrite>
<rules>
<rule name="Protect files and directories from prying eyes" stopProcessing="true">
<match url="\.(engine|inc|install|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format|composer\.(json|lock)|\.htaccess)$" />
<action type="CustomResponse" statusCode="403" subStatusCode="0" statusReason="Forbidden" statusDescription="Access is forbidden." />
</rule>
<rule name="Force simple error message for requests for non-existent favicon.ico" stopProcessing="true">
<match url="favicon\.ico" />
<action type="CustomResponse" statusCode="404" subStatusCode="1" statusReason="File Not Found" statusDescription="The requested file favicon.ico was not found" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
</rule>
<!-- To redirect all users to access the site WITH the 'www.' prefix,
http://example.com/foo will be redirected to http://www.example.com/foo)
adapt and uncomment the following: -->
<!--
<rule name="Redirect to add www" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example\.com$" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}" />
</rule>
-->
<!-- To redirect all users to access the site WITHOUT the 'www.' prefix,
http://www.example.com/foo will be redirected to http://example.com/foo)
adapt and uncomment the following: -->
<!--
<rule name="Redirect to remove www" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.example\.com$" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="http://example.com/{R:1}" />
</rule>
-->
<!-- Pass all requests not referring directly to files in the filesystem
to index.php. -->
<rule name="Short URLS" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<!-- If running Windows Server 2008 R2 this can be commented out -->
<!-- httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
</httpErrors -->
<defaultDocument>
<!-- Set the default document -->
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

View File

@ -0,0 +1,202 @@
<?php
/**
* @file
* Administrative script for running authorized file operations.
*
* Using this script, the site owner (the user actually owning the files on the
* webserver) can authorize certain file-related operations to proceed with
* elevated privileges, for example to deploy and upgrade modules or themes.
* Users should not visit this page directly, but instead use an administrative
* user interface which knows how to redirect the user to this script as part of
* a multistep process. This script actually performs the selected operations
* without loading all of Drupal, to be able to more gracefully recover from
* errors. Access to the script is controlled by a global killswitch in
* settings.php ('allow_authorize_operations') and via the 'administer software
* updates' permission.
*
* There are helper functions for setting up an operation to run via this
* system in modules/system/system.module. For more information, see:
* @link authorize Authorized operation helper functions @endlink
*/
use Drupal\Core\DrupalKernel;
use Drupal\Core\Form\EnforcedResponseException;
use Drupal\Core\Url;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Site\Settings;
use Drupal\Core\Routing\RouteObjectInterface;
use Symfony\Component\Routing\Route;
// Change the directory to the Drupal root.
chdir('..');
$autoloader = require_once 'autoload.php';
/**
* Global flag to identify update.php and authorize.php runs.
*
* Identifies update.php and authorize.php runs, avoiding unwanted operations
* such as css/js preprocessing and translation, and solves some theming issues.
* The flag is checked in other places in Drupal code (not just authorize.php).
*/
const MAINTENANCE_MODE = 'update';
/**
* Determines if the current user is allowed to run authorize.php.
*
* The killswitch in settings.php overrides all else, otherwise, the user must
* have access to the 'administer software updates' permission.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The incoming request.
*
* @return bool
* TRUE if the current user can run authorize.php, and FALSE if not.
*/
function authorize_access_allowed(Request $request) {
$account = \Drupal::service('authentication')->authenticate($request);
if ($account) {
\Drupal::currentUser()->setAccount($account);
}
return Settings::get('allow_authorize_operations', TRUE) && \Drupal::currentUser()->hasPermission('administer software updates');
}
try {
$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();
// A route is required for route matching.
$request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
$request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<none>');
$kernel->preHandle($request);
// Ensure our request includes the session if appropriate.
if (PHP_SAPI !== 'cli') {
$request->setSession($kernel->getContainer()->get('session'));
}
}
catch (HttpExceptionInterface $e) {
$response = new Response('', $e->getStatusCode());
$response->prepare($request)->send();
exit;
}
// We have to enable the user and system modules, even to check access and
// display errors via the maintenance theme.
\Drupal::moduleHandler()->addModule('system', 'core/modules/system');
\Drupal::moduleHandler()->addModule('user', 'core/modules/user');
\Drupal::moduleHandler()->load('system');
\Drupal::moduleHandler()->load('user');
// Initialize the maintenance theme for this administrative script.
drupal_maintenance_theme();
$content = [];
$show_messages = TRUE;
$is_allowed = authorize_access_allowed($request);
// Build content.
if ($is_allowed) {
// Load both the Form API and Batch API.
require_once __DIR__ . '/includes/form.inc';
require_once __DIR__ . '/includes/batch.inc';
$page_title = $request->getSession()->get('authorize_page_title', t('Authorize file system changes'));
// See if we've run the operation and need to display a report.
if ($results = $request->getSession()->remove('authorize_results')) {
// Clear the session out.
$request->getSession()->remove('authorize_operation');
$request->getSession()->remove('authorize_filetransfer_info');
if (!empty($results['page_title'])) {
$page_title = $results['page_title'];
}
if (!empty($results['page_message'])) {
\Drupal::messenger()->addMessage($results['page_message']['message'], $results['page_message']['type']);
}
$content['authorize_report'] = [
'#theme' => 'authorize_report',
'#messages' => $results['messages'],
];
if (is_array($results['tasks'])) {
$links = $results['tasks'];
}
else {
// Since this is being called outside of the primary front controller,
// the base_url needs to be set explicitly to ensure that links are
// relative to the site root.
// @todo Simplify with https://www.drupal.org/node/2548095
$default_options = [
'#type' => 'link',
'#options' => [
'absolute' => TRUE,
'base_url' => $GLOBALS['base_url'],
],
];
$links = [
$default_options + [
'#url' => Url::fromRoute('system.admin'),
'#title' => t('Administration pages'),
],
$default_options + [
'#url' => Url::fromRoute('<front>'),
'#title' => t('Front page'),
],
];
}
$content['next_steps'] = [
'#theme' => 'item_list',
'#items' => $links,
'#title' => t('Next steps'),
];
}
// If a batch is running, let it run.
elseif ($request->query->has('batch')) {
$content = _batch_page($request);
// If _batch_page() returns a response object (likely a JsonResponse for
// JavaScript-based batch processing), send it immediately.
if ($content instanceof Response) {
$content->send();
exit;
}
}
else {
if (!$request->getSession()->has('authorize_operation') || !$request->getSession()->has('authorize_filetransfer_info')) {
$content = ['#markup' => t('It appears you have reached this page in error.')];
}
elseif (!$batch = batch_get()) {
// We have a batch to process, show the filetransfer form.
try {
$content = \Drupal::formBuilder()->getForm('Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm');
}
catch (EnforcedResponseException $e) {
$e->getResponse()->send();
exit;
}
}
}
// We defer the display of messages until all operations are done.
$show_messages = !(($batch = batch_get()) && isset($batch['running']));
}
else {
\Drupal::logger('access denied')->warning('authorize.php');
$page_title = t('Access denied');
$content = ['#markup' => t('You are not allowed to access this page.')];
}
$bare_html_page_renderer = \Drupal::service('bare_html_page_renderer');
$response = $bare_html_page_renderer->renderBarePage($content, $page_title, 'maintenance_page', [
'#show_messages' => $show_messages,
]);
if (!$is_allowed) {
$response->setStatusCode(403);
}
$response->send();

View File

@ -0,0 +1,249 @@
{
"name": "drupal/core",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type": "drupal-core",
"license": "GPL-2.0-or-later",
"require": {
"ext-date": "*",
"ext-dom": "*",
"ext-filter": "*",
"ext-gd": "*",
"ext-hash": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-PDO": "*",
"ext-session": "*",
"ext-SimpleXML": "*",
"ext-SPL": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"php": ">=7.3.0",
"symfony/console": "^4.4",
"symfony/dependency-injection": "^4.4",
"symfony/event-dispatcher": "^4.4",
"symfony/http-foundation": "^4.4.7",
"symfony/http-kernel": "^4.4",
"symfony/mime": "^5.4",
"symfony/routing": "^4.4",
"symfony/serializer": "^4.4",
"symfony/translation": "^4.4",
"symfony/validator": "^4.4",
"symfony/process": "^4.4",
"symfony/polyfill-iconv": "^1.0",
"symfony/polyfill-php80": "^1.16",
"symfony/yaml": "^4.4.19",
"typo3/phar-stream-wrapper": "^3.1.3",
"twig/twig": "^2.12.0",
"doctrine/reflection": "^1.1",
"doctrine/annotations": "^1.12",
"guzzlehttp/guzzle": "^6.5.2",
"symfony-cmf/routing": "^2.1",
"laminas/laminas-feed": "^2.12",
"stack/builder": "^1.0",
"egulias/email-validator": "^2.1.22|^3.0",
"masterminds/html5": "^2.1",
"symfony/psr-http-message-bridge": "^2.0",
"laminas/laminas-diactoros": "^2.1",
"composer/semver": "^3.0",
"asm89/stack-cors": "^1.1",
"pear/archive_tar": "^1.4.14",
"psr/log": "^1.0"
},
"conflict": {
"drush/drush": "<8.1.10"
},
"replace": {
"drupal/action": "self.version",
"drupal/aggregator": "self.version",
"drupal/automated_cron": "self.version",
"drupal/bartik": "self.version",
"drupal/ban": "self.version",
"drupal/basic_auth": "self.version",
"drupal/big_pipe": "self.version",
"drupal/block": "self.version",
"drupal/block_content": "self.version",
"drupal/book": "self.version",
"drupal/breakpoint": "self.version",
"drupal/ckeditor": "self.version",
"drupal/ckeditor5": "self.version",
"drupal/claro": "self.version",
"drupal/classy": "self.version",
"drupal/color": "self.version",
"drupal/comment": "self.version",
"drupal/config": "self.version",
"drupal/config_translation": "self.version",
"drupal/contact": "self.version",
"drupal/content_moderation": "self.version",
"drupal/content_translation": "self.version",
"drupal/contextual": "self.version",
"drupal/core-annotation": "self.version",
"drupal/core-assertion": "self.version",
"drupal/core-bridge": "self.version",
"drupal/core-class-finder": "self.version",
"drupal/core-datetime": "self.version",
"drupal/core-dependency-injection": "self.version",
"drupal/core-diff": "self.version",
"drupal/core-discovery": "self.version",
"drupal/core-event-dispatcher": "self.version",
"drupal/core-file-cache": "self.version",
"drupal/core-file-security": "self.version",
"drupal/core-filesystem": "self.version",
"drupal/core-front-matter": "self.version",
"drupal/core-gettext": "self.version",
"drupal/core-graph": "self.version",
"drupal/core-http-foundation": "self.version",
"drupal/core-php-storage": "self.version",
"drupal/core-plugin": "self.version",
"drupal/core-proxy-builder": "self.version",
"drupal/core-render": "self.version",
"drupal/core-serialization": "self.version",
"drupal/core-transliteration": "self.version",
"drupal/core-utility": "self.version",
"drupal/core-uuid": "self.version",
"drupal/core-version": "self.version",
"drupal/datetime": "self.version",
"drupal/datetime_range": "self.version",
"drupal/dblog": "self.version",
"drupal/dynamic_page_cache": "self.version",
"drupal/editor": "self.version",
"drupal/entity_reference": "self.version",
"drupal/field": "self.version",
"drupal/field_layout": "self.version",
"drupal/field_ui": "self.version",
"drupal/file": "self.version",
"drupal/filter": "self.version",
"drupal/forum": "self.version",
"drupal/hal": "self.version",
"drupal/help": "self.version",
"drupal/help_topics": "self.version",
"drupal/history": "self.version",
"drupal/image": "self.version",
"drupal/inline_form_errors": "self.version",
"drupal/jsonapi": "self.version",
"drupal/language": "self.version",
"drupal/layout_builder": "self.version",
"drupal/layout_discovery": "self.version",
"drupal/link": "self.version",
"drupal/locale": "self.version",
"drupal/minimal": "self.version",
"drupal/media": "self.version",
"drupal/media_library": "self.version",
"drupal/menu_link_content": "self.version",
"drupal/menu_ui": "self.version",
"drupal/migrate": "self.version",
"drupal/migrate_drupal": "self.version",
"drupal/migrate_drupal_multilingual": "self.version",
"drupal/migrate_drupal_ui": "self.version",
"drupal/node": "self.version",
"drupal/olivero": "self.version",
"drupal/options": "self.version",
"drupal/page_cache": "self.version",
"drupal/path": "self.version",
"drupal/path_alias": "self.version",
"drupal/quickedit": "self.version",
"drupal/rdf": "self.version",
"drupal/responsive_image": "self.version",
"drupal/rest": "self.version",
"drupal/search": "self.version",
"drupal/serialization": "self.version",
"drupal/settings_tray": "self.version",
"drupal/seven": "self.version",
"drupal/shortcut": "self.version",
"drupal/standard": "self.version",
"drupal/stark": "self.version",
"drupal/statistics": "self.version",
"drupal/syslog": "self.version",
"drupal/system": "self.version",
"drupal/taxonomy": "self.version",
"drupal/telephone": "self.version",
"drupal/text": "self.version",
"drupal/toolbar": "self.version",
"drupal/tour": "self.version",
"drupal/tracker": "self.version",
"drupal/update": "self.version",
"drupal/user": "self.version",
"drupal/views": "self.version",
"drupal/views_ui": "self.version",
"drupal/workflows": "self.version",
"drupal/workspaces": "self.version"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Drupal\\Core\\": "lib/Drupal/Core",
"Drupal\\Component\\": "lib/Drupal/Component",
"Drupal\\Driver\\": "../drivers/lib/Drupal/Driver"
},
"classmap": [
"lib/Drupal.php",
"lib/Drupal/Component/DependencyInjection/Container.php",
"lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php",
"lib/Drupal/Component/FileCache/FileCacheFactory.php",
"lib/Drupal/Component/Utility/Timer.php",
"lib/Drupal/Component/Utility/Unicode.php",
"lib/Drupal/Core/Cache/Cache.php",
"lib/Drupal/Core/Cache/CacheBackendInterface.php",
"lib/Drupal/Core/Cache/CacheTagsChecksumInterface.php",
"lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php",
"lib/Drupal/Core/Cache/CacheTagsInvalidatorInterface.php",
"lib/Drupal/Core/Cache/DatabaseBackend.php",
"lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php",
"lib/Drupal/Core/Database/Connection.php",
"lib/Drupal/Core/Database/Database.php",
"lib/Drupal/Core/Database/Driver/mysql/Connection.php",
"lib/Drupal/Core/Database/Driver/pgsql/Connection.php",
"lib/Drupal/Core/Database/Driver/sqlite/Connection.php",
"lib/Drupal/Core/Database/Statement.php",
"lib/Drupal/Core/Database/StatementInterface.php",
"lib/Drupal/Core/DependencyInjection/Container.php",
"lib/Drupal/Core/DrupalKernel.php",
"lib/Drupal/Core/DrupalKernelInterface.php",
"lib/Drupal/Core/Http/InputBag.php",
"lib/Drupal/Core/Installer/InstallerRedirectTrait.php",
"lib/Drupal/Core/Site/Settings.php"
],
"files": [
"includes/bootstrap.inc",
"includes/guzzle_php81_shim.php"
]
},
"config": {
"preferred-install": "dist"
},
"extra": {
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
"[web-root]/.htaccess": "assets/scaffold/files/htaccess",
"[web-root]/example.gitignore": "assets/scaffold/files/example.gitignore",
"[web-root]/index.php": "assets/scaffold/files/index.php",
"[web-root]/INSTALL.txt": "assets/scaffold/files/drupal.INSTALL.txt",
"[web-root]/README.md": "assets/scaffold/files/drupal.README.md",
"[web-root]/robots.txt": "assets/scaffold/files/robots.txt",
"[web-root]/update.php": "assets/scaffold/files/update.php",
"[web-root]/web.config": "assets/scaffold/files/web.config",
"[web-root]/sites/README.txt": "assets/scaffold/files/sites.README.txt",
"[web-root]/sites/development.services.yml": "assets/scaffold/files/development.services.yml",
"[web-root]/sites/example.settings.local.php": "assets/scaffold/files/example.settings.local.php",
"[web-root]/sites/example.sites.php": "assets/scaffold/files/example.sites.php",
"[web-root]/sites/default/default.services.yml": "assets/scaffold/files/default.services.yml",
"[web-root]/sites/default/default.settings.php": "assets/scaffold/files/default.settings.php",
"[web-root]/modules/README.txt": "assets/scaffold/files/modules.README.txt",
"[web-root]/profiles/README.txt": "assets/scaffold/files/profiles.README.txt",
"[web-root]/themes/README.txt": "assets/scaffold/files/themes.README.txt"
}
}
},
"scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": [
"Drupal\\Core\\Composer\\Composer::ensureHtaccess"
]
}
}

View File

@ -0,0 +1,3 @@
module: {}
theme: {}
profile: ''

View File

@ -0,0 +1 @@
definitions: []

View File

@ -0,0 +1,855 @@
# Base types provided by Drupal core.
# Read https://www.drupal.org/node/1905070 for more details about configuration
# schema, types and type resolution.
# Undefined type used by the system to assign to elements at any level where
# configuration schema is not defined. Using explicitly has the same effect as
# not defining schema, so there is no point in doing that.
undefined:
label: 'Undefined'
class: '\Drupal\Core\Config\Schema\Undefined'
# Explicit type to use when no data typing is possible. Instead of using this
# type, we strongly suggest you use configuration structures that can be
# described with other structural elements of schema, and describe your schema
# with those elements.
ignore:
label: 'Ignore'
class: '\Drupal\Core\Config\Schema\Ignore'
# Basic scalar data types from typed data.
boolean:
label: 'Boolean'
class: '\Drupal\Core\TypedData\Plugin\DataType\BooleanData'
email:
label: 'Email'
class: '\Drupal\Core\TypedData\Plugin\DataType\Email'
integer:
label: 'Integer'
class: '\Drupal\Core\TypedData\Plugin\DataType\IntegerData'
timestamp:
label: 'Timestamp'
class: '\Drupal\Core\TypedData\Plugin\DataType\Timestamp'
float:
label: 'Float'
class: '\Drupal\Core\TypedData\Plugin\DataType\FloatData'
string:
label: 'String'
class: '\Drupal\Core\TypedData\Plugin\DataType\StringData'
uri:
label: 'Uri'
class: '\Drupal\Core\TypedData\Plugin\DataType\Uri'
# Container data types for lists with known and unknown keys.
mapping:
label: Mapping
class: '\Drupal\Core\Config\Schema\Mapping'
definition_class: '\Drupal\Core\TypedData\MapDataDefinition'
sequence:
label: Sequence
class: '\Drupal\Core\Config\Schema\Sequence'
definition_class: '\Drupal\Core\Config\Schema\SequenceDataDefinition'
# Simple extended data types:
# Human readable string that must be plain text and editable with a text field.
label:
type: string
label: 'Label'
translatable: true
# String containing plural variants, separated by EXT.
plural_label:
type: label
label: 'Plural variants'
# Internal Drupal path
path:
type: string
label: 'Path'
# Human readable string that can contain multiple lines of text or HTML.
text:
type: string
label: 'Text'
translatable: true
# A UUID.
uuid:
type: string
label: 'UUID'
constraints:
Uuid: {}
# PHP Date format string that is translatable.
date_format:
type: string
label: 'Date format'
translatable: true
translation context: 'PHP date format'
# HTML color value.
color_hex:
type: string
label: 'Color'
# Complex extended data types:
# Root of a configuration object.
_core_config_info:
type: mapping
mapping:
default_config_hash:
type: string
label: 'Default configuration hash'
config_object:
type: mapping
mapping:
_core:
type: _core_config_info
langcode:
type: string
label: 'Language code'
# Mail text with subject and body parts.
mail:
type: mapping
label: 'Mail'
mapping:
subject:
type: label
label: 'Subject'
body:
type: text
label: 'Body'
# Filter with module and status.
filter:
type: mapping
label: 'Filter'
mapping:
id:
type: string
label: 'ID'
provider:
type: string
label: 'Provider'
status:
type: boolean
label: 'Status'
weight:
type: integer
label: 'Weight'
settings:
type: filter_settings.[%parent.id]
# System action configuration base.
action_configuration_default:
type: sequence
label: 'Action configuration'
sequence:
type: string
theme_settings:
type: config_object
mapping:
favicon:
type: mapping
label: 'Shortcut icon settings'
mapping:
mimetype:
type: string
label: 'MIME type'
path:
type: string
label: 'Path'
url:
type: string
label: 'URL'
use_default:
type: boolean
label: 'Use the default shortcut icon supplied by the theme'
features:
type: mapping
label: 'Optional features'
mapping:
comment_user_picture:
type: boolean
label: 'User pictures in comments'
comment_user_verification:
type: boolean
label: 'User verification status in comments'
favicon:
type: boolean
label: 'Shortcut icon'
logo:
type: boolean
label: 'Logo'
name:
type: boolean
label: 'Site name'
node_user_picture:
type: boolean
label: 'User pictures in posts'
slogan:
type: boolean
label: 'Site slogan'
logo:
type: mapping
label: 'Logo settings'
mapping:
path:
type: string
label: 'Logo path'
url:
type: uri
label: 'URL'
use_default:
type: boolean
label: 'Use default'
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: theme_settings.third_party.[%key]
# Array of routes with route_name and route_params keys.
route:
type: mapping
label: 'Route'
mapping:
route_name:
type: string
label: 'Route Name'
route_params:
type: sequence
label: 'Route Params'
sequence:
type: string
label: 'Param'
# Config dependencies.
config_dependencies_base:
type: mapping
mapping:
config:
type: sequence
label: 'Configuration entity dependencies'
sequence:
type: string
content:
type: sequence
label: 'Content entity dependencies'
sequence:
type: string
module:
type: sequence
label: 'Module dependencies'
sequence:
type: string
theme:
type: sequence
label: 'Theme dependencies'
sequence:
type: string
config_dependencies:
type: config_dependencies_base
label: 'Configuration dependencies'
mapping:
enforced:
type: config_dependencies_base
label: 'Enforced configuration dependencies'
config_entity:
type: mapping
mapping:
uuid:
type: uuid
label: 'UUID'
langcode:
type: string
label: 'Language code'
status:
type: boolean
label: 'Status'
dependencies:
type: config_dependencies
label: 'Dependencies'
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: '[%parent.%parent.%type].third_party.[%key]'
_core:
type: _core_config_info
block.settings.*:
type: block_settings
block_settings:
type: mapping
label: 'Block settings'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Description'
label_display:
type: string
label: 'Display title'
provider:
type: string
label: 'Provider'
status:
type: boolean
label: 'Status'
info:
type: label
label: 'Admin info'
view_mode:
type: string
label: 'View mode'
context_mapping:
type: sequence
label: 'Context assignments'
sequence:
type: string
condition.plugin:
type: mapping
label: 'Condition'
mapping:
id:
type: string
label: 'ID'
negate:
type: boolean
label: 'Negate'
uuid:
type: uuid
context_mapping:
type: sequence
label: 'Context assignments'
sequence:
type: string
condition.plugin.entity_bundle:*:
type: condition.plugin
mapping:
bundles:
type: sequence
sequence:
type: string
display_variant.plugin:
type: mapping
label: 'Display variant'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Label'
weight:
type: integer
label: 'Weight'
uuid:
type: uuid
layout_plugin.settings:
type: mapping
label: 'Layout settings'
mapping:
label:
type: label
label: 'Label'
context_mapping:
type: sequence
label: 'Context assignments'
sequence:
type: string
layout_plugin.settings.*:
type: layout_plugin.settings
base_entity_reference_field_settings:
type: mapping
mapping:
target_type:
type: string
label: 'Type of item to reference'
field_config_base:
type: config_entity
mapping:
id:
type: string
label: 'ID'
field_name:
type: string
label: 'Field name'
entity_type:
type: string
label: 'Entity type'
bundle:
type: string
label: 'Bundle'
label:
type: label
label: 'Label'
description:
type: text
label: 'Help text'
required:
type: boolean
label: 'Required field'
translatable:
type: boolean
label: 'Translatable'
default_value:
type: sequence
label: 'Default values'
sequence:
type: field.value.[%parent.%parent.field_type]
label: 'Default value'
default_value_callback:
type: string
label: 'Default value callback'
settings:
type: field.field_settings.[%parent.field_type]
field_type:
type: string
label: 'Field type'
core.base_field_override.*.*.*:
type: field_config_base
label: 'Base field bundle override'
core.date_format.*:
type: config_entity
label: 'Date format'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Label'
locked:
type: boolean
label: 'Locked'
pattern:
type: core_date_format_pattern.[%parent.locked]
label: 'PHP date format'
# Unlocked date formats should use the translatable type.
core_date_format_pattern.0:
type: date_format
label: 'Date format'
# Locked date formats are just used to transport the value.
core_date_format_pattern.1:
type: string
label: 'Date format'
# Generic field settings schemas.
field.storage_settings.*:
type: mapping
label: 'Settings'
field.field_settings.*:
type: mapping
label: 'Settings'
field.value.*:
type: mapping
label: 'Default value'
# Schema for the configuration of the String field type.
field.storage_settings.string:
type: mapping
label: 'String settings'
mapping:
max_length:
type: integer
label: 'Maximum length'
case_sensitive:
type: boolean
label: 'Case sensitive'
is_ascii:
type: boolean
label: 'Contains US ASCII characters only'
field.field_settings.string:
type: mapping
label: 'String settings'
field.value.string:
type: mapping
label: 'Default value'
mapping:
value:
type: label
label: 'Value'
# Schema for the configuration of the String (long) field type.
field.storage_settings.string_long:
type: mapping
label: 'String (long) settings'
mapping:
case_sensitive:
type: boolean
label: 'Case sensitive'
field.field_settings.string_long:
type: mapping
label: 'String (long) settings'
field.value.string_long:
type: mapping
label: 'Default value'
mapping:
value:
type: text
label: 'Value'
# Schema for the configuration of the Password field type.
field.storage_settings.password:
type: field.storage_settings.string
label: 'Password settings'
field.field_settings.password:
type: mapping
label: 'Password settings'
# Schema for the configuration of the URI field type.
field.storage_settings.uri:
type: field.storage_settings.string
label: 'URI settings'
mapping:
max_length:
type: integer
label: 'Maximum length'
case_sensitive:
type: boolean
label: 'Case sensitive'
field.field_settings.uri:
type: mapping
label: 'URI settings'
field.value.uri:
type: mapping
label: 'Default value'
mapping:
value:
type: string
label: 'Value'
# Schema for the configuration of the Created field type.
field.storage_settings.created:
type: mapping
label: 'Created timestamp settings'
field.field_settings.created:
type: mapping
label: 'Created timestamp settings'
field.value.created:
type: mapping
label: 'Default value'
mapping:
value:
type: integer
label: 'Value'
# Schema for the configuration of the Changed field type.
field.storage_settings.changed:
type: mapping
label: 'Changed timestamp settings'
field.field_settings.changed:
type: mapping
label: 'Changed timestamp settings'
field.value.changed:
type: mapping
label: 'Default value'
mapping:
value:
type: integer
label: 'Value'
# Schema for the configuration of the Entity reference field type.
field.storage_settings.entity_reference:
type: mapping
label: 'Entity reference field storage settings'
mapping:
target_type:
type: string
label: 'Type of item to reference'
field.field_settings.entity_reference:
type: mapping
label: 'Entity reference field settings'
mapping:
handler:
type: string
label: 'Reference method'
handler_settings:
type: entity_reference_selection.[%parent.handler]
label: 'Entity reference selection plugin settings'
field.value.entity_reference:
type: mapping
label: 'Default value'
mapping:
target_id:
type: string
label: 'Value'
target_uuid:
type: uuid
# Schema for the configuration of the Boolean field type.
field.field_settings.boolean:
label: 'Boolean settings'
type: mapping
mapping:
on_label:
type: label
label: 'On label'
off_label:
type: label
label: 'Off label'
field.value.boolean:
type: mapping
mapping:
value:
type: integer
label: 'Value'
# Schema for the configuration of the Email field type.
field.storage_settings.email:
type: mapping
label: 'Email settings'
field.field_settings.email:
type: mapping
label: 'Email settings'
sequence:
type: string
label: 'Setting'
field.value.email:
type: mapping
label: 'Default value'
mapping:
value:
type: email
label: 'Value'
# Schema for the configuration of the Integer field type.
field.storage_settings.integer:
type: mapping
label: 'Integer settings'
mapping:
unsigned:
type: boolean
label: 'Unsigned'
size:
type: string
label: 'Database storage size'
field.field_settings.integer:
type: mapping
label: 'Integer'
mapping:
min:
type: integer
label: 'Minimum'
max:
type: integer
label: 'Maximum'
prefix:
type: label
label: 'Prefix'
suffix:
type: label
label: 'Suffix'
field.value.integer:
type: mapping
label: 'Default value'
mapping:
value:
type: integer
label: 'Value'
# Schema for the configuration of the Decimal field type.
field.storage_settings.decimal:
type: mapping
label: 'Decimal settings'
mapping:
precision:
type: integer
label: 'Precision'
scale:
type: integer
label: 'Scale'
field.field_settings.decimal:
type: mapping
label: 'Decimal settings'
mapping:
min:
type: float
label: 'Minimum'
max:
type: float
label: 'Maximum'
prefix:
type: label
label: 'Prefix'
suffix:
type: label
label: 'Suffix'
field.value.decimal:
type: mapping
label: 'Default value'
mapping:
value:
type: float
label: 'Value'
# Schema for the configuration of the Float field type.
field.storage_settings.float:
type: mapping
label: 'Float settings'
field.field_settings.float:
type: mapping
label: 'Float settings'
mapping:
min:
type: float
label: 'Minimum'
max:
type: float
label: 'Maximum'
prefix:
type: label
label: 'Prefix'
suffix:
type: label
label: 'Suffix'
field.value.float:
type: mapping
label: 'Default value'
mapping:
value:
type: float
label: 'Value'
# Schema for the configuration of the Timestamp field type.
field.value.timestamp:
type: mapping
label: 'Timestamp value'
mapping:
value:
type: timestamp
label: 'Value'
# Text with a text format.
text_format:
type: mapping
label: 'Text with text format'
# We declare the entire mapping of text and text format as translatable. This
# causes the entire mapping to be saved to the language overrides of the
# configuration. Storing only the (to be formatted) text could result in
# security problems in case the text format of the source text is changed.
translatable: true
mapping:
value:
type: text
label: 'Text'
# Mark the actual text as translatable (in addition to the entire mapping
# being marked as translatable) so that shipped configuration with
# formatted text can participate in the string translation system.
translatable: true
format:
type: string
label: 'Text format'
# The text format should not be translated as part of the string
# translation system, so this is not marked as translatable.
# Base schema for all entity reference selection handler schemas.
entity_reference_selection:
type: mapping
label: 'Entity reference selection handler settings'
mapping:
target_type:
type: string
label: 'Type of item to reference'
# Schema for all entity reference selection handlers that are not providing a
# specific schema.
entity_reference_selection.*:
type: entity_reference_selection
# Schema for the entity reference 'default' selection handler settings.
entity_reference_selection.default:
type: entity_reference_selection
label: 'Default selection handler settings'
mapping:
target_bundles:
type: sequence
label: 'types'
nullable: true
sequence:
type: string
label: 'Bundle'
sort:
type: mapping
label: 'Sort settings'
mapping:
field:
type: string
label: 'Sort by'
direction:
type: string
label: 'Sort direction'
auto_create:
type: boolean
label: 'Create referenced entities if they don''t already exist'
auto_create_bundle:
type: string
label: 'Bundle assigned to the auto-created entities.'
# Schema for all entity reference 'default:*' selection handlers that are not
# providing a specific schema.
entity_reference_selection.default:*:
type: entity_reference_selection.default

View File

@ -0,0 +1,423 @@
# Schema for Configuration files of the entity module.
core.entity_view_mode.*.*:
type: config_entity
label: 'Entity view mode settings'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'The human-readable name of the view mode'
targetEntityType:
type: string
label: 'Target entity type'
cache:
type: boolean
label: 'Cached'
core.entity_form_mode.*.*:
type: config_entity
label: 'Entity form mode settings'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Label'
targetEntityType:
type: string
label: 'Target entity type'
cache:
type: boolean
label: 'Cache'
# Overview configuration information for view mode or form mode displays.
core.entity_view_display.*.*.*:
type: config_entity
label: 'Entity display'
mapping:
id:
type: string
label: 'ID'
targetEntityType:
type: string
label: 'Target entity type'
bundle:
type: string
label: 'Bundle'
mode:
type: string
label: 'View or form mode machine name'
content:
type: sequence
label: 'Field formatters'
sequence:
type: field_formatter.entity_view_display
hidden:
type: sequence
label: 'Field display setting'
sequence:
type: boolean
label: 'Value'
field_formatter:
type: mapping
label: 'Field formatter'
mapping:
type:
type: string
label: 'Format type machine name'
label:
type: string
label: 'Label setting machine name'
settings:
type: field.formatter.settings.[%parent.type]
label: 'Settings'
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: field.formatter.third_party.[%key]
field_formatter.entity_view_display:
type: field_formatter
mapping:
weight:
type: integer
label: 'Weight'
region:
type: string
label: 'Region'
# Overview configuration information for form mode displays.
core.entity_form_display.*.*.*:
type: config_entity
label: 'Entity form display'
mapping:
id:
type: string
label: 'ID'
targetEntityType:
type: string
label: 'Target entity type'
bundle:
type: string
label: 'Bundle'
mode:
type: string
label: 'View or form mode machine name'
status:
type: boolean
label: 'Enabled'
content:
type: sequence
label: 'Field widgets'
sequence:
type: mapping
label: 'Field widget'
mapping:
type:
type: string
label: 'Widget type machine name'
weight:
type: integer
label: 'Weight'
region:
type: string
label: 'Region'
settings:
type: field.widget.settings.[%parent.type]
label: 'Settings'
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: field.widget.third_party.[%key]
hidden:
type: sequence
label: 'Hidden'
sequence:
type: boolean
label: 'Component'
# Default schema for entity display field with undefined type.
field.formatter.settings.*:
type: mapping
# Default schema for entity form display field with undefined type.
field.widget.settings.*:
type: mapping
field.widget.settings.string_textfield:
type: mapping
label: 'Text field display format settings'
mapping:
size:
type: integer
label: 'Size of textfield'
placeholder:
type: label
label: 'Placeholder'
field.widget.settings.string_textarea:
type: mapping
label: 'Textarea display format settings'
mapping:
rows:
type: integer
label: 'Rows'
placeholder:
type: label
label: 'Placeholder'
field.widget.settings.uri:
type: mapping
label: 'URI field'
mapping:
size:
type: integer
label: 'Size of URI field'
placeholder:
type: label
label: 'Placeholder'
field.widget.settings.email_default:
type: mapping
label: 'Email field display format settings'
mapping:
placeholder:
type: label
label: 'Placeholder'
size:
type: integer
label: 'Size of email field'
field.widget.settings.datetime_timestamp:
type: mapping
label: 'Datetime timestamp display format settings'
field.widget.settings.boolean_checkbox:
type: mapping
label: 'Boolean checkbox display format settings'
mapping:
display_label:
type: boolean
label: 'Display label'
field.widget.settings.hidden:
type: mapping
label: '- Hidden - format settings'
field.widget.settings.number:
type: mapping
label: 'Number default display format settings'
mapping:
placeholder:
type: label
label: 'Placeholder'
field.widget.settings.checkbox:
type: mapping
label: 'Single on/off checkbox format settings'
mapping:
display_label:
type: boolean
label: 'Use field label instead of the "On value" as label'
field.widget.settings.entity_reference_autocomplete_tags:
type: mapping
label: 'Entity reference autocomplete (Tags style) display format settings'
mapping:
match_operator:
type: string
label: 'Autocomplete matching'
match_limit:
type: integer
label: 'Maximum number of autocomplete suggestions.'
size:
type: integer
label: 'Size of textfield'
placeholder:
type: label
label: 'Placeholder'
field.widget.settings.entity_reference_autocomplete:
type: mapping
label: 'Entity reference autocomplete display format settings'
mapping:
match_operator:
type: string
label: 'Autocomplete matching'
match_limit:
type: integer
label: 'Maximum number of autocomplete suggestions.'
size:
type: integer
label: 'Size of textfield'
placeholder:
type: label
label: 'Placeholder'
field.formatter.settings.boolean:
type: mapping
mapping:
format:
type: string
label: 'Output format'
format_custom_false:
type: label
label: 'Custom output for FALSE'
format_custom_true:
type: label
label: 'Custom output for TRUE'
field.formatter.settings.string:
type: mapping
mapping:
link_to_entity:
type: boolean
label: 'Link to the entity'
field.formatter.settings.language:
type: field.formatter.settings.string
mapping:
native_language:
type: boolean
label: 'Display in native language'
field.formatter.settings.number_decimal:
type: mapping
label: 'Number decimal display format settings'
mapping:
thousand_separator:
type: string
label: 'Thousand marker'
decimal_separator:
type: string
label: 'Decimal marker'
scale:
type: integer
label: 'Scale'
prefix_suffix:
type: boolean
label: 'Display prefix and suffix.'
field.formatter.settings.number_integer:
type: mapping
label: 'Number integer display format settings'
mapping:
thousand_separator:
type: string
label: 'Thousand marker'
prefix_suffix:
type: boolean
label: 'Display prefix and suffix.'
field.formatter.settings.number_unformatted:
type: mapping
label: 'Number unformatted display format settings'
field.formatter.settings.uri_link:
type: mapping
label: 'URI as link display format settings'
field.formatter.settings.timestamp:
type: mapping
label: 'Timestamp display format settings'
mapping:
date_format:
type: string
label: 'Date format'
custom_date_format:
type: string
label: 'Custom date format'
timezone:
type: string
label: 'Time zone'
field.formatter.settings.timestamp_ago:
type: mapping
label: 'Timestamp ago display format settings'
mapping:
future_format:
type: label
label: 'Future format'
past_format:
type: label
label: 'Past format'
granularity:
type: integer
label: 'Granularity'
field.formatter.settings.entity_reference_entity_view:
type: mapping
label: 'Entity reference rendered entity display format settings'
mapping:
view_mode:
type: string
label: 'View mode'
link:
type: boolean
label: 'Show links'
field.formatter.settings.entity_reference_entity_id:
type: mapping
label: 'Entity reference entity ID display format settings'
field.formatter.settings.entity_reference_label:
type: mapping
label: 'Entity reference label display format settings'
mapping:
link:
type: boolean
label: 'Link label to the referenced entity'
block.settings.field_block:*:*:*:
type: block_settings
mapping:
formatter:
type: field_formatter
block.settings.extra_field_block:*:*:*:
type: block_settings
mapping:
formatter:
type: field_formatter
# Schema for entity actions.
action.configuration.entity:*:*:
type: action_configuration_default
label: 'Entity action'
action.configuration.action_send_email_action:
type: mapping
label: 'Send email configuration'
mapping:
recipient:
type: string
label: 'Recipient'
subject:
type: label
label: 'Subject'
message:
type: text
label: 'Message'
action.configuration.action_goto_action:
type: mapping
label: 'Redirect to URL configuration'
mapping:
url:
type: string
label: 'URL'
action.configuration.action_message_action:
type: mapping
label: 'Display a message to the user configuration'
mapping:
message:
type: text
label: 'Message'

View File

@ -0,0 +1,19 @@
core.extension:
type: config_object
label: 'Extension settings'
mapping:
module:
type: sequence
label: 'Enabled modules'
sequence:
type: integer
label: 'Weight'
theme:
type: sequence
label: 'Installed themes'
sequence:
type: integer
label: 'Weight'
profile:
type: string
label: 'Install profile'

View File

@ -0,0 +1,26 @@
core.menu.static_menu_link_overrides:
type: config_object
label: 'Static menu link overrides'
mapping:
definitions:
type: sequence
label: Definitions
sequence:
type: mapping
label: Definition
mapping:
menu_name:
type: string
label: 'Menu name'
parent:
type: string
label: 'Parent'
weight:
type: integer
label: 'Weight'
expanded:
type: boolean
label: 'Expanded'
enabled:
type: boolean
label: 'Enabled'

2639
web/core/core.api.php 100644

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,305 @@
# Drupal core's extension relation types.
# See https://tools.ietf.org/html/rfc5988#section-4.2.
add-form:
uri: https://drupal.org/link-relations/add-form
description: A form where a resource of this type can be created.
add-page:
uri: https://drupal.org/link-relations/add-page
description: A page where a resource of this type and related types can be created.
delete-form:
uri: https://drupal.org/link-relations/delete-form
description: A form where a resource of this type can be deleted.
delete-multiple-form:
uri: https://drupal.org/link-relations/delete-multiple-form
description: A form where multiple resources of this type can be deleted.
revision:
uri: https://drupal.org/link-relations/revision
description: A particular version of this resource.
create:
uri: https://drupal.org/link-relations/create
description: A REST resource URL where a resource of this type can be created.
enable:
uri: https://drupal.org/link-relations/enable
description: A REST resource URL where a resource of this type can be enabled.
disable:
uri: https://drupal.org/link-relations/disable
description: A REST resource URL where a resource of this type can be disabled.
edit-permissions-form:
uri: https://drupal.org/link-relations/edit-permissions-form
description: A form where permissions assigned to a resource of this type can be edited.
overview-form:
uri: https://drupal.org/link-relations/overview-form
description: A form where an overview of the collection of resources belonging to a resource of this type can be edited in bulk.
reset-form:
uri: https://drupal.org/link-relations/reset-form
description: A form where an overview of the collection of resources belonging to a resource of this type can be reset.
cancel-form:
uri: https://drupal.org/link-relations/cancel-form
description: A form where a resource of this type can be canceled.
flush-form:
uri: https://drupal.org/link-relations/flush-form
description: A form where a resource of this type can be flushed.
duplicate-form:
uri: https://drupal.org/link-relations/duplicate-form
description: A form where a resource of this type can be duplicated.
# All registered relation types.
# See https://tools.ietf.org/html/rfc5988#section-4.1.
# See https://www.iana.org/assignments/link-relations/link-relations.xhtml.
about:
description: "Refers to a resource that is the subject of the link's context."
reference: '[RFC6903], section 2'
alternate:
description: 'Refers to a substitute for this context'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-alternate]'
appendix:
description: 'Refers to an appendix.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
archives:
description: "Refers to a collection of records, documents, or other materials of historical interest."
reference: '[http://www.w3.org/TR/2011/WD-html5-20110113/links.html#rel-archives]'
author:
description: "Refers to the context's author."
reference: '[http://www.w3.org/TR/html5/links.html#link-type-author]'
blocked-by:
description: "Identifies the entity that blocks access to a resource following receipt of a legal demand."
reference: '[RFC7725]'
bookmark:
description: 'Gives a permanent link to use for bookmarking purposes.'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-bookmark]'
canonical:
description: 'Designates the preferred version of a resource (the IRI and its contents).'
reference: '[RFC6596]'
chapter:
description: 'Refers to a chapter in a collection of resources.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
collection:
description: 'The target IRI points to a resource which represents the collection resource for the context IRI.'
reference: '[RFC6573]'
contents:
description: 'Refers to a table of contents.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
copyright:
description: "Refers to a copyright statement that applies to the link's context."
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
create-form:
description: 'The target IRI points to a resource where a submission form can be obtained.'
reference: '[RFC6861]'
current:
description: "Refers to a resource containing the most recent item(s) in a collection of resources."
reference: '[RFC5005]'
customize-form:
description: "The target URI points to a resource where a submission form for customizing associated resource can be obtained."
reference: '[RFC6861]'
derivedfrom:
description: 'The target IRI points to a resource from which this material was derived.'
reference: '[draft-hoffman-xml2rfc]'
describedby:
description: "Refers to a resource providing information about the link's context."
reference: '[http://www.w3.org/TR/powder-dr/#assoc-linking]'
describes:
description: "The relationship A 'describes' B asserts that resource A provides a description of resource B. There are no constraints on the format or representation of either A or B, neither are there any further constraints on either resource."
reference: '[RFC6892]'
notes: "This link relation type is the inverse of the 'describedby' relation type. While 'describedby' establishes a relation from the described resource back to the resource that describes it, 'describes' established a relation from the describing resource to the resource it describes. If B is 'describedby' A, then A 'describes' B."
disclosure:
description: "Refers to a list of patent disclosures made with respect to material for which 'disclosure' relation is specified."
reference: '[RFC6579]'
dns-prefetch:
description: "Used to indicate an origin that will be used to fetch required resources for the link context, and that the user agent ought to resolve as early as possible."
reference: '[https://www.w3.org/TR/resource-hints/]'
duplicate:
description: "Refers to a resource whose available representations are byte-for-byte identical with the corresponding representations of the context IRI."
reference: '[RFC6249]'
notes: "This relation is for static resources. That is, an HTTP GET request on any duplicate will return the same representation. It does not make sense for dynamic or POSTable resources and should not be used for them."
edit:
description: "Refers to a resource that can be used to edit the link's context."
reference: '[RFC5023]'
edit-form:
description: "The target IRI points to a resource where a submission form for editing associated resource can be obtained."
reference: '[RFC6861]'
edit-media:
description: "Refers to a resource that can be used to edit media associated with the link's context."
reference: '[RFC5023]'
enclosure:
description: "Identifies a related resource that is potentially large and might require special handling."
reference: '[RFC4287]'
first:
description: "An IRI that refers to the furthest preceding resource in a series of resources."
reference: '[RFC5988]'
notes: "This relation type registration did not indicate a reference. Originally requested by Mark Nottingham in December 2004."
glossary:
description: 'Refers to a glossary of terms.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
help:
description: 'Refers to context-sensitive help.'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-help]'
hosts:
description: "Refers to a resource hosted by the server indicated by the link context."
reference: '[RFC6690]'
notes: "This relation is used in CoRE where links are retrieved as a \"/.well-known/core\" resource representation, and is the default relation type in the CoRE Link Format."
hub:
description: "Refers to a hub that enables registration for notification of updates to the context."
reference: '[http://pubsubhubbub.googlecode.com]'
notes: 'This relation type was requested by Brett Slatkin.'
icon:
description: "Refers to an icon representing the link's context."
reference: '[http://www.w3.org/TR/html5/links.html#link-type-icon]'
index:
description: 'Refers to an index.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
item:
description: 'The target IRI points to a resource that is a member of the collection represented by the context IRI.'
reference: '[RFC6573]'
last:
description: "An IRI that refers to the furthest following resource in a series of resources."
reference: '[RFC5988]'
notes: "This relation type registration did not indicate a reference. Originally requested by Mark Nottingham in December 2004."
latest-version:
description: "Points to a resource containing the latest (e.g., current) version of the context."
reference: '[RFC5829]'
license:
description: 'Refers to a license associated with this context.'
reference: '[RFC4946]'
notes: "For implications of use in HTML, see: http://www.w3.org/TR/html5/links.html#link-type-license"
lrdd:
description: "Refers to further information about the link's context, expressed as a LRDD (\"Link-based Resource Descriptor Document\") resource. See [RFC6415] for information about processing this relation type in host-meta documents. When used elsewhere, it refers to additional links and other metadata. Multiple instances indicate additional LRDD resources. LRDD resources MUST have an \"application/xrd+xml\" representation, and MAY have others."
reference: '[RFC6415]'
memento:
description: 'The Target IRI points to a Memento, a fixed resource that will not change state anymore.'
reference: '[RFC7089]'
notes: "A Memento for an Original Resource is a resource that encapsulates a prior state of the Original Resource."
monitor:
description: 'Refers to a resource that can be used to monitor changes in an HTTP resource.'
reference: '[RFC5989]'
monitor-group:
description: 'Refers to a resource that can be used to monitor changes in a specified group of HTTP resources.'
reference: '[RFC5989]'
next:
description: "Indicates that the link's context is a part of a series, and that the next in the series is the link target."
reference: '[http://www.w3.org/TR/html5/links.html#link-type-next]'
next-archive:
description: 'Refers to the immediately following archive resource.'
reference: '[RFC5005]'
nofollow:
description: 'Indicates that the contexts original author or publisher does not endorse the link target.'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-nofollow]'
noreferrer:
description: 'Indicates that no referrer information is to be leaked when following the link.'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-noreferrer]'
original:
description: 'The Target IRI points to an Original Resource.'
reference: '[RFC7089]'
notes: "An Original Resource is a resource that exists or used to exist, and for which access to one of its prior states may be required."
payment:
description: 'Indicates a resource where payment is accepted.'
reference: '[RFC5988]'
notes: "This relation type registration did not indicate a reference. Requested by Joshua Kinberg and Robert Sayre. It is meant as a general way to facilitate acts of payment, and thus this specification makes no assumptions on the type of payment or transaction protocol. Examples may include a web page where donations are accepted or where goods and services are available for purchase. rel=\"payment\" is not intended to initiate an automated transaction. In Atom documents, a link element with a rel=\"payment\" attribute may exist at the feed/channel level and/or the entry/item level. For example, a rel=\"payment\" link at the feed/channel level may point to a \"tip jar\" URI, whereas an entry/ item containing a book review may include a rel=\"payment\" link that points to the location where the book may be purchased through an online retailer."
pingback:
description: 'Gives the address of the pingback resource for the link context.'
reference: '[http://www.hixie.ch/specs/pingback/pingback]'
preconnect:
description: "Used to indicate an origin that will be used to fetch required resources for the link context. Initiating an early connection, which includes the DNS lookup, TCP handshake, and optional TLS negotiation, allows the user agent to mask the high latency costs of establishing a connection."
reference: '[https://www.w3.org/TR/resource-hints/]'
predecessor-version:
description: "Points to a resource containing the predecessor version in the version history."
reference: '[RFC5829]'
prefetch:
description: "The prefetch link relation type is used to identify a resource that might be required by the next navigation from the link context, and that the user agent ought to fetch, such that the user agent can deliver a faster response once the resource is requested in the future."
reference: '[http://www.w3.org/TR/resource-hints/]'
preload:
description: "Refers to a resource that should be loaded early in the processing of the link's context, without blocking rendering."
reference: '[http://www.w3.org/TR/preload/]'
notes: 'Additional target attributes establish the detailed fetch properties of the link.'
prerender:
description: "Used to identify a resource that might be required by the next navigation from the link context, and that the user agent ought to fetch and execute, such that the user agent can deliver a faster response once the resource is requested in the future."
reference: '[https://www.w3.org/TR/resource-hints/]'
prev:
description: "Indicates that the link's context is a part of a series, and that the previous in the series is the link target."
reference: '[http://www.w3.org/TR/html5/links.html#link-type-prev]'
preview:
description: "Refers to a resource that provides a preview of the link's context."
reference: '[RFC6903], section 3'
previous:
description: "Refers to the previous resource in an ordered series of resources. Synonym for \"prev\"."
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
prev-archive:
description: 'Refers to the immediately preceding archive resource.'
reference: '[RFC5005]'
privacy-policy:
description: "Refers to a privacy policy associated with the link's context."
reference: '[RFC6903], section 4'
profile:
description: "Identifying that a resource representation conforms to a certain profile, without affecting the non-profile semantics of the resource representation."
reference: '[RFC6906]'
notes: "Profile URIs are primarily intended to be used as identifiers, and thus clients SHOULD NOT indiscriminately access profile URIs."
related:
description: 'Identifies a related resource.'
reference: '[RFC4287]'
replies:
description: "Identifies a resource that is a reply to the context of the link."
reference: '[RFC4685]'
search:
description: "Refers to a resource that can be used to search through the link's context and related resources."
reference: '[http://www.opensearch.org/Specifications/OpenSearch/1.1]'
section:
description: 'Refers to a section in a collection of resources.'
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
self:
description: "Conveys an identifier for the link's context."
reference: '[RFC4287]'
set-default:
description: "Indicates a URI that can be used to set a resource as the default."
reference: '[RFC5023]'
service:
description: "Indicates a URI that can be used to retrieve a service document."
reference: '[RFC5023]'
notes: "When used in an Atom document, this relation type specifies Atom Publishing Protocol service documents by default. Requested by James Snell."
start:
description: "Refers to the first resource in a collection of resources."
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
stylesheet:
description: 'Refers to a stylesheet.'
reference: '[http://www.w3.org/TR/html5/links.html#link-type-stylesheet]'
subsection:
description: "Refers to a resource serving as a subsection in a collection of resources."
reference: '[http://www.w3.org/TR/1999/REC-html401-19991224]'
successor-version:
description: "Points to a resource containing the successor version in the version history."
reference: '[RFC5829]'
tag:
description: "Gives a tag (identified by the given address) that applies to the current document."
reference: '[http://www.w3.org/TR/html5/links.html#link-type-tag]'
terms-of-service:
description: "Refers to the terms of service associated with the link's context."
reference: '[RFC6903], section 5'
timegate:
description: 'The Target IRI points to a TimeGate for an Original Resource.'
reference: '[RFC7089]'
notes: "A TimeGate for an Original Resource is a resource that is capable of datetime negotiation to support access to prior states of the Original Resource."
timemap:
description: 'The Target IRI points to a TimeMap for an Original Resource.'
reference: '[RFC7089]'
notes: "A TimeMap for an Original Resource is a resource from which a list of URIs of Mementos of the Original Resource is available."
type:
description: "Refers to a resource identifying the abstract semantic type of which the link's context is considered to be an instance."
reference: '[RFC6903], section 6'
up:
description: "Refers to a parent document in a hierarchy of documents."
reference: '[RFC5988]'
notes: "This relation type registration did not indicate a reference. Requested by Noah Slater."
version-history:
description: "Points to a resource containing the version history for the context."
reference: '[RFC5829]'
via:
description: "Identifies a resource that is the source of the information in the link's context."
reference: '[RFC4287]'
webmention:
description: "Identifies a target URI that supports the Webmention protocol. This allows clients that mention a resource in some form of publishing process to contact that endpoint and inform it that this resource has been mentioned."
reference: '[http://www.w3.org/TR/webmention/]'
notes: "This is a similar \"Linkback\" mechanism to the ones of Refback, Trackback, and Pingback. It uses a different protocol, though, and thus should be discoverable through its own link relation type."
working-copy:
description: 'Points to a working copy for this resource.'
reference: '[RFC5829]'
working-copy-of:
description: "Points to the versioned resource from which this working copy was obtained."
reference: '[RFC5829]'

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
# This is the DrupalCI testbot build file for Drupal core.
# Learn to make one for your own drupal.org project:
# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing
build:
assessment:
testing:
# Run code quality checks.
container_command.commit-checks:
commands:
- "core/scripts/dev/commit-code-check.sh --drupalci"
halt-on-fail: true
# run_tests task is executed several times in order of performance speeds.
# halt-on-fail can be set on the run_tests tasks in order to fail fast.
# suppress-deprecations is false in order to be alerted to usages of
# deprecated code.
run_tests.phpunit:
types: 'PHPUnit-Unit'
testgroups: '--all'
suppress-deprecations: false
halt-on-fail: false
run_tests.kernel:
types: 'PHPUnit-Kernel'
testgroups: '--all'
suppress-deprecations: false
halt-on-fail: false
run_tests.build:
# Limit concurrency due to disk space concerns.
concurrency: 15
types: 'PHPUnit-Build'
testgroups: '--all'
suppress-deprecations: false
halt-on-fail: false
run_tests.functional:
types: 'PHPUnit-Functional'
testgroups: '--all'
suppress-deprecations: false
halt-on-fail: false
run_tests.javascript:
concurrency: 15
types: 'PHPUnit-FunctionalJavascript'
testgroups: '--all'
suppress-deprecations: false
halt-on-fail: false
# Run nightwatch testing.
# @see https://www.drupal.org/project/drupal/issues/2869825
nightwatchjs: {}

View File

@ -0,0 +1,67 @@
<?php
/**
* @file
* These are the global variables that Drupal uses.
*/
/**
* The insecure base URL of the Drupal installation.
*
* @see \Drupal\Core\DrupalKernel::initializeRequestGlobals()
*/
global $base_insecure_url;
/**
* The base path of the Drupal installation.
*
* This will at least default to '/'.
*
* @see \Drupal\Core\DrupalKernel::initializeRequestGlobals()
*/
global $base_path;
/**
* The root URL of the host, excluding the path.
*
* @see \Drupal\Core\DrupalKernel::initializeRequestGlobals()
*/
global $base_root;
/**
* The secure base URL of the Drupal installation.
*
* @see \Drupal\Core\DrupalKernel::initializeRequestGlobals()
*/
global $base_secure_url;
/**
* The base URL of the Drupal installation.
*
* @see \Drupal\Core\DrupalKernel::initializeRequestGlobals()
*/
global $base_url;
/**
* Allows defining of site-specific service providers for the Drupal kernel.
*
* To define a site-specific service provider class, use code like this:
* @code
* $GLOBALS['conf']['container_service_providers']['MyClassName'] = 'Drupal\My\Namespace\MyClassName';
* @endcode
*
* @see \Drupal\Core\DrupalKernel::$serviceProviderClasses
*/
global $conf;
/**
* Array of configuration overrides from the settings.php file.
*/
global $config;
/**
* Store settings and profile information during installation process.
*
* @see install_drupal()
*/
global $install_state;

View File

@ -0,0 +1,557 @@
<?php
/**
* @file
* Batch processing API for processes to run in multiple HTTP requests.
*
* Note that batches are usually invoked by form submissions, which is
* why the core interaction functions of the batch processing API live in
* form.inc.
*
* @see form.inc
* @see batch_set()
* @see batch_process()
* @see batch_get()
*/
use Drupal\Component\Utility\Timer;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Batch\Percentage;
use Drupal\Core\Form\FormState;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Renders the batch processing page based on the current state of the batch.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request object.
*
* @see _batch_shutdown()
*/
function _batch_page(Request $request) {
$batch = &batch_get();
if (!($request_id = $request->query->get('id'))) {
return FALSE;
}
// Retrieve the current state of the batch.
if (!$batch) {
$batch = \Drupal::service('batch.storage')->load($request_id);
if (!$batch) {
\Drupal::messenger()->addError(t('No active batch.'));
return new RedirectResponse(Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString());
}
}
// We need to store the updated batch information in the batch storage after
// processing the batch. In order for the error page to work correctly this
// needs to be done even in case of a PHP fatal error in which case the end of
// this function is never reached. Therefore we register a shutdown function
// to handle this case. Because with FastCGI and fastcgi_finish_request()
// shutdown functions are called after the HTTP connection is closed, updating
// the batch information in a shutdown function would lead to race conditions
// between consecutive requests if the batch processing continues. In case of
// a fatal error the processing stops anyway, so it works even with FastCGI.
// However, we must ensure to only update in the shutdown phase in this
// particular case we track whether the batch information still needs to be
// updated.
// @see _batch_shutdown()
// @see \Symfony\Component\HttpFoundation\Response::send()
drupal_register_shutdown_function('_batch_shutdown');
_batch_needs_update(TRUE);
$build = [];
// Add batch-specific libraries.
foreach ($batch['sets'] as $batch_set) {
if (isset($batch_set['library'])) {
foreach ($batch_set['library'] as $library) {
$build['#attached']['library'][] = $library;
}
}
}
$op = $request->query->get('op', '');
switch ($op) {
case 'start':
case 'do_nojs':
// Display the full progress page on startup and on each additional
// non-JavaScript iteration.
$current_set = _batch_current_set();
$build['#title'] = $current_set['title'];
$build['content'] = _batch_progress_page();
$response = $build;
break;
case 'do':
// JavaScript-based progress page callback.
$response = _batch_do();
break;
case 'finished':
// _batch_finished() returns a RedirectResponse.
$response = _batch_finished();
break;
}
if ($batch) {
\Drupal::service('batch.storage')->update($batch);
}
_batch_needs_update(FALSE);
return $response;
}
/**
* Checks whether the batch information needs to be updated in the storage.
*
* @param bool $new_value
* (optional) A new value to set.
*
* @return bool
* TRUE if the batch information needs to be updated; FALSE otherwise.
*/
function _batch_needs_update($new_value = NULL) {
$needs_update = &drupal_static(__FUNCTION__, FALSE);
if (isset($new_value)) {
$needs_update = $new_value;
}
return $needs_update;
}
/**
* Does one execution pass with JavaScript and returns progress to the browser.
*
* @see _batch_progress_page_js()
* @see _batch_process()
*/
function _batch_do() {
// Perform actual processing.
[$percentage, $message, $label] = _batch_process();
return new JsonResponse(['status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label]);
}
/**
* Outputs a batch processing page.
*
* @see _batch_process()
*/
function _batch_progress_page() {
$batch = &batch_get();
$current_set = _batch_current_set();
$new_op = 'do_nojs';
if (!isset($batch['running'])) {
// This is the first page so we return some output immediately.
$percentage = 0;
$message = $current_set['init_message'];
$label = '';
$batch['running'] = TRUE;
}
else {
// This is one of the later requests; do some processing first.
// Error handling: if PHP dies due to a fatal error (e.g. a nonexistent
// function), it will output whatever is in the output buffer, followed by
// the error message.
ob_start();
$fallback = $current_set['error_message'] . '<br />' . $batch['error_message'];
// We strip the end of the page using a marker in the template, so any
// additional HTML output by PHP shows up inside the page rather than below
// it. While this causes invalid HTML, the same would be true if we didn't,
// as content is not allowed to appear after </html> anyway.
$bare_html_page_renderer = \Drupal::service('bare_html_page_renderer');
$response = $bare_html_page_renderer->renderBarePage(['#markup' => $fallback], $current_set['title'], 'maintenance_page', [
'#show_messages' => FALSE,
]);
// Just use the content of the response.
$fallback = $response->getContent();
[$fallback] = explode('<!--partial-->', $fallback);
print $fallback;
// Perform actual processing.
[$percentage, $message, $label] = _batch_process($batch);
if ($percentage == 100) {
$new_op = 'finished';
}
// PHP did not die; remove the fallback output.
ob_end_clean();
}
// Merge required query parameters for batch processing into those provided by
// batch_set() or hook_batch_alter().
$query_options = $batch['url']->getOption('query');
$query_options['id'] = $batch['id'];
$query_options['op'] = $new_op;
$batch['url']->setOption('query', $query_options);
$url = $batch['url']->toString(TRUE)->getGeneratedUrl();
$build = [
'#theme' => 'progress_bar',
'#percent' => $percentage,
'#message' => ['#markup' => $message],
'#label' => $label,
'#attached' => [
'html_head' => [
[
[
// Redirect through a 'Refresh' meta tag if JavaScript is disabled.
'#tag' => 'meta',
'#noscript' => TRUE,
'#attributes' => [
'http-equiv' => 'Refresh',
'content' => '0; URL=' . $url,
],
],
'batch_progress_meta_refresh',
],
],
// Adds JavaScript code and settings for clients where JavaScript is enabled.
'drupalSettings' => [
'batch' => [
'errorMessage' => $current_set['error_message'] . '<br />' . $batch['error_message'],
'initMessage' => $current_set['init_message'],
'uri' => $url,
],
],
'library' => [
'core/drupal.batch',
],
],
];
return $build;
}
/**
* Processes sets in a batch.
*
* If the batch was marked for progressive execution (default), this executes as
* many operations in batch sets until an execution time of 1 second has been
* exceeded. It will continue with the next operation of the same batch set in
* the next request.
*
* @return array
* An array containing a completion value (in percent) and a status message.
*/
function _batch_process() {
$batch = &batch_get();
$current_set = &_batch_current_set();
// Indicate that this batch set needs to be initialized.
$set_changed = TRUE;
$task_message = '';
// If this batch was marked for progressive execution (e.g. forms submitted by
// \Drupal::formBuilder()->submitForm(), initialize a timer to determine
// whether we need to proceed with the same batch phase when a processing time
// of 1 second has been exceeded.
if ($batch['progressive']) {
Timer::start('batch_processing');
}
if (empty($current_set['start'])) {
$current_set['start'] = microtime(TRUE);
}
$queue = _batch_queue($current_set);
while (!$current_set['success']) {
// If this is the first time we iterate this batch set in the current
// request, we check if it requires an additional file for functions
// definitions.
if ($set_changed && isset($current_set['file']) && is_file($current_set['file'])) {
include_once \Drupal::root() . '/' . $current_set['file'];
}
$task_message = '';
// Assume a single pass operation and set the completion level to 1 by
// default.
$finished = 1;
if ($item = $queue->claimItem()) {
[$callback, $args] = $item->data;
// Build the 'context' array and execute the function call.
$batch_context = [
'sandbox' => &$current_set['sandbox'],
'results' => &$current_set['results'],
'finished' => &$finished,
'message' => &$task_message,
];
call_user_func_array($callback, array_merge($args, [&$batch_context]));
if ($finished >= 1) {
// Make sure this step is not counted twice when computing $current.
$finished = 0;
// Remove the processed operation and clear the sandbox.
$queue->deleteItem($item);
$current_set['count']--;
$current_set['sandbox'] = [];
}
}
// When all operations in the current batch set are completed, browse
// through the remaining sets, marking them 'successfully processed'
// along the way, until we find a set that contains operations.
// _batch_next_set() executes form submit handlers stored in 'control'
// sets (see \Drupal::service('form_submitter')), which can in turn add new
// sets to the batch.
$set_changed = FALSE;
$old_set = $current_set;
while (empty($current_set['count']) && ($current_set['success'] = TRUE) && _batch_next_set()) {
$current_set = &_batch_current_set();
$current_set['start'] = microtime(TRUE);
$set_changed = TRUE;
}
// At this point, either $current_set contains operations that need to be
// processed or all sets have been completed.
$queue = _batch_queue($current_set);
// If we are in progressive mode, break processing after 1 second.
if ($batch['progressive'] && Timer::read('batch_processing') > 1000) {
// Record elapsed wall clock time.
$current_set['elapsed'] = round((microtime(TRUE) - $current_set['start']) * 1000, 2);
break;
}
}
if ($batch['progressive']) {
// Gather progress information.
// Reporting 100% progress will cause the whole batch to be considered
// processed. If processing was paused right after moving to a new set,
// we have to use the info from the new (unprocessed) set.
if ($set_changed && isset($current_set['queue'])) {
// Processing will continue with a fresh batch set.
$remaining = $current_set['count'];
$total = $current_set['total'];
$progress_message = $current_set['init_message'];
$task_message = '';
}
else {
// Processing will continue with the current batch set.
$remaining = $old_set['count'];
$total = $old_set['total'];
$progress_message = $old_set['progress_message'];
}
// Total progress is the number of operations that have fully run plus the
// completion level of the current operation.
$current = $total - $remaining + $finished;
$percentage = _batch_api_percentage($total, $current);
$elapsed = $current_set['elapsed'] ?? 0;
$values = [
'@remaining' => $remaining,
'@total' => $total,
'@current' => floor($current),
'@percentage' => $percentage,
'@elapsed' => \Drupal::service('date.formatter')->formatInterval((int) ($elapsed / 1000)),
// If possible, estimate remaining processing time.
'@estimate' => ($current > 0) ? \Drupal::service('date.formatter')->formatInterval((int) (($elapsed * ($total - $current) / $current) / 1000)) : '-',
];
$message = strtr($progress_message, $values);
return [$percentage, $message, $task_message];
}
else {
// If we are not in progressive mode, the entire batch has been processed.
return _batch_finished();
}
}
/**
* Formats the percent completion for a batch set.
*
* @param int $total
* The total number of operations.
* @param int|float $current
* The number of the current operation. This may be a floating point number
* rather than an integer in the case of a multi-step operation that is not
* yet complete; in that case, the fractional part of $current represents the
* fraction of the operation that has been completed.
*
* @return string
* The properly formatted percentage, as a string. We output percentages
* using the correct number of decimal places so that we never print "100%"
* until we are finished, but we also never print more decimal places than
* are meaningful.
*
* @see _batch_process()
*/
function _batch_api_percentage($total, $current) {
return Percentage::format($total, $current);
}
/**
* Returns the batch set being currently processed.
*/
function &_batch_current_set() {
$batch = &batch_get();
return $batch['sets'][$batch['current_set']];
}
/**
* Retrieves the next set in a batch.
*
* If there is a subsequent set in this batch, assign it as the new set to
* process and execute its form submit handler (if defined), which may add
* further sets to this batch.
*
* @return true|null
* TRUE if a subsequent set was found in the batch; no value will be returned
* if no subsequent set was found.
*/
function _batch_next_set() {
$batch = &batch_get();
$set_indexes = array_keys($batch['sets']);
$current_set_index_key = array_search($batch['current_set'], $set_indexes);
if (isset($set_indexes[$current_set_index_key + 1])) {
$batch['current_set'] = $set_indexes[$current_set_index_key + 1];
$current_set = &_batch_current_set();
if (isset($current_set['form_submit']) && ($callback = $current_set['form_submit']) && is_callable($callback)) {
// We use our stored copies of $form and $form_state to account for
// possible alterations by previous form submit handlers.
$complete_form = &$batch['form_state']->getCompleteForm();
call_user_func_array($callback, [&$complete_form, &$batch['form_state']]);
}
return TRUE;
}
}
/**
* Ends the batch processing.
*
* Call the 'finished' callback of each batch set to allow custom handling of
* the results and resolve page redirection.
*/
function _batch_finished() {
$batch = &batch_get();
$batch_finished_redirect = NULL;
// Execute the 'finished' callbacks for each batch set, if defined.
foreach ($batch['sets'] as $batch_set) {
if (isset($batch_set['finished'])) {
// Check if the set requires an additional file for function definitions.
if (isset($batch_set['file']) && is_file($batch_set['file'])) {
include_once \Drupal::root() . '/' . $batch_set['file'];
}
if (is_callable($batch_set['finished'])) {
$queue = _batch_queue($batch_set);
$operations = $queue->getAllItems();
$batch_set_result = call_user_func_array($batch_set['finished'], [$batch_set['success'], $batch_set['results'], $operations, \Drupal::service('date.formatter')->formatInterval((int) ($batch_set['elapsed'] / 1000))]);
// If a batch 'finished' callback requested a redirect after the batch
// is complete, save that for later use. If more than one batch set
// returned a redirect, the last one is used.
if ($batch_set_result instanceof RedirectResponse) {
$batch_finished_redirect = $batch_set_result;
}
}
}
}
// Clean up the batch table and unset the static $batch variable.
if ($batch['progressive']) {
\Drupal::service('batch.storage')->delete($batch['id']);
foreach ($batch['sets'] as $batch_set) {
if ($queue = _batch_queue($batch_set)) {
$queue->deleteQueue();
}
}
// Clean-up the session. Not needed for CLI updates.
if (isset($_SESSION)) {
unset($_SESSION['batches'][$batch['id']]);
if (empty($_SESSION['batches'])) {
unset($_SESSION['batches']);
}
}
}
$_batch = $batch;
$batch = NULL;
// Redirect if needed.
if ($_batch['progressive']) {
// Revert the 'destination' that was saved in batch_process().
if (isset($_batch['destination'])) {
\Drupal::request()->query->set('destination', $_batch['destination']);
}
// Determine the target path to redirect to. If a batch 'finished' callback
// returned a redirect response object, use that. Otherwise, fall back on
// the form redirection.
if (isset($batch_finished_redirect)) {
return $batch_finished_redirect;
}
elseif (!isset($_batch['form_state'])) {
$_batch['form_state'] = new FormState();
}
if ($_batch['form_state']->getRedirect() === NULL) {
$redirect = $_batch['batch_redirect'] ?: $_batch['source_url'];
// Any path with a scheme does not correspond to a route.
if (!$redirect instanceof Url) {
$options = UrlHelper::parse($redirect);
if (parse_url($options['path'], PHP_URL_SCHEME)) {
$redirect = Url::fromUri($options['path'], $options);
}
else {
$redirect = \Drupal::pathValidator()->getUrlIfValid($options['path']);
if (!$redirect) {
// Stay on the same page if the redirect was invalid.
$redirect = Url::fromRoute('<current>');
}
$redirect->setOptions($options);
}
}
$_batch['form_state']->setRedirectUrl($redirect);
}
// Use \Drupal\Core\Form\FormSubmitterInterface::redirectForm() to handle
// the redirection logic.
$redirect = \Drupal::service('form_submitter')->redirectForm($_batch['form_state']);
if (is_object($redirect)) {
return $redirect;
}
// If no redirection happened, redirect to the originating page. In case the
// form needs to be rebuilt, save the final $form_state for
// \Drupal\Core\Form\FormBuilderInterface::buildForm().
if ($_batch['form_state']->isRebuilding()) {
$_SESSION['batch_form_state'] = $_batch['form_state'];
}
$callback = $_batch['redirect_callback'];
$_batch['source_url']->mergeOptions(['query' => ['op' => 'finish', 'id' => $_batch['id']]]);
if (is_callable($callback)) {
$callback($_batch['source_url'], $_batch['source_url']->getOption('query'));
}
elseif ($callback === NULL) {
// Default to RedirectResponse objects when nothing specified.
return new RedirectResponse($_batch['source_url']->setAbsolute()->toString());
}
}
}
/**
* Shutdown function: Stores the current batch data for the next request.
*
* @see _batch_page()
* @see drupal_register_shutdown_function()
*/
function _batch_shutdown() {
if (($batch = batch_get()) && _batch_needs_update()) {
\Drupal::service('batch.storage')->update($batch);
}
}

View File

@ -0,0 +1,764 @@
<?php
/**
* @file
* Functions that need to be loaded on every Drupal request.
*/
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Http\InputBag;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Test\TestDatabase;
use Drupal\Core\Utility\Error;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\InputBag as SymfonyInputBag;
/**
* Minimum allowed version of PHP for Drupal to be bootstrapped.
*
* Below this version:
* - The installer cannot be run.
* - Updates cannot be run.
* - Modules and themes cannot be enabled.
* - If a site managed to bypass all of the above, then an error is shown in
* the status report and various fatal errors occur on various pages.
*
* @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
* \Drupal::MINIMUM_PHP instead.
*
* @see https://www.drupal.org/node/2909361
* @see install.php
*/
const DRUPAL_MINIMUM_PHP = \Drupal::MINIMUM_PHP;
/**
* Minimum supported version of PHP.
*
* Below this version:
* - New sites cannot be installed, except from within tests.
* - Updates from previous Drupal versions can be run, but users are warned
* that Drupal no longer supports that PHP version.
* - An error is shown in the status report that the PHP version is too old.
*
* @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
* \Drupal::MINIMUM_SUPPORTED_PHP instead.
*
* @see https://www.drupal.org/node/2909361
*/
const DRUPAL_MINIMUM_SUPPORTED_PHP = \Drupal::MINIMUM_SUPPORTED_PHP;
/**
* Minimum recommended version of PHP.
*
* Sites installing Drupal on PHP versions lower than this will see a warning
* message, but Drupal can still be installed. Used for (e.g.) PHP versions
* that have reached their EOL or will in the near future.
*
* @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
* \Drupal::RECOMMENDED_PHP instead.
*
* @see https://www.drupal.org/node/2909361
*/
const DRUPAL_RECOMMENDED_PHP = \Drupal::RECOMMENDED_PHP;
/**
* Minimum recommended value of PHP memory_limit.
*
* 64M was chosen as a minimum requirement in order to allow for additional
* contributed modules to be installed prior to hitting the limit. However,
* 40M is the target for the Standard installation profile.
*
* @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
* \Drupal::MINIMUM_PHP_MEMORY_LIMIT instead.
*
* @see https://www.drupal.org/node/2909361
*/
const DRUPAL_MINIMUM_PHP_MEMORY_LIMIT = \Drupal::MINIMUM_PHP_MEMORY_LIMIT;
/**
* Error reporting level: display no errors.
*/
const ERROR_REPORTING_HIDE = 'hide';
/**
* Error reporting level: display errors and warnings.
*/
const ERROR_REPORTING_DISPLAY_SOME = 'some';
/**
* Error reporting level: display all messages.
*/
const ERROR_REPORTING_DISPLAY_ALL = 'all';
/**
* Error reporting level: display all messages, plus backtrace information.
*/
const ERROR_REPORTING_DISPLAY_VERBOSE = 'verbose';
/**
* The maximum number of characters in a module or theme name.
*/
const DRUPAL_EXTENSION_NAME_MAX_LENGTH = 50;
/**
* Time of the current request in seconds elapsed since the Unix Epoch.
*
* This differs from $_SERVER['REQUEST_TIME'], which is stored as a float
* since PHP 5.4.0. Float timestamps confuse most PHP functions
* (including date_create()).
*
* @see http://php.net/manual/reserved.variables.server.php
* @see http://php.net/manual/function.time.php
*
* @deprecated in drupal:8.3.0 and is removed from drupal:10.0.0.
* Use \Drupal::time()->getRequestTime();
*
* @see https://www.drupal.org/node/2785211
*/
define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);
/**
* Defines the root directory of the Drupal installation.
*
* This strips two levels of directories off the current directory.
*/
define('DRUPAL_ROOT', dirname(__DIR__, 2));
/**
* Declare class aliases that will be added by the autoloader.
*/
// @todo https://www.drupal.org/project/drupal/issues/3197482 Remove this class
// alias once Drupal is running Symfony 5.3 or higher.
class_alias('Drupal\Core\Http\KernelEvent', 'Symfony\Component\HttpKernel\Event\KernelEvent', TRUE);
/**
* Set up the Symfony Request factory for forward compatibility with Symfony 5.
*
* @todo Remove this when Symfony 4 is no longer supported.
*/
Request::setFactory(
function ($query, $request, $attributes, $cookies, $files, $server, $content) {
$request = new Request($query, $request, $attributes, $cookies, $files, $server, $content);
foreach (['request', 'query', 'cookies'] as $bag) {
if (!($bag instanceof SymfonyInputBag)) {
$request->$bag = new InputBag($request->$bag->all());
}
}
return $request;
}
);
/**
* Returns and optionally sets the filename for a system resource.
*
* The filename, whether provided, cached, or retrieved from the database, is
* only returned if the file exists.
*
* This function plays a key role in allowing Drupal's resources (modules
* and themes) to be located in different places depending on a site's
* configuration. For example, a module 'foo' may legally be located
* in any of these three places:
*
* core/modules/foo/foo.info.yml
* modules/foo/foo.info.yml
* sites/example.com/modules/foo/foo.info.yml
*
* Calling drupal_get_filename('module', 'foo') will give you one of
* the above, depending on where the module is located.
*
* @param $type
* The type of the item; one of 'core', 'profile', 'module', 'theme', or
* 'theme_engine'.
* @param $name
* The name of the item for which the filename is requested. Ignored for
* $type 'core'.
* @param $filename
* The filename of the item if it is to be set explicitly rather
* than by consulting the database.
*
* @return string
* The filename of the requested item or NULL if the item is not found.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\Core\Extension\ExtensionPathResolver::getPathname() instead.
*
* @see https://www.drupal.org/node/2940438
*/
function drupal_get_filename($type, $name, $filename = NULL) {
@trigger_error('drupal_get_filename() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionPathResolver::getPathname() instead. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
// Type 'core' only exists to simplify application-level logic; it always maps
// to the /core directory, whereas $name is ignored. It is only requested via
// \Drupal\Core\Extension\ExtensionList::getPath(). The file
// /core/core.info.yml does not exist, but is required since
// ExtensionList::getPath() returns the dirname() of the returned pathname.
if ($type === 'core') {
return 'core/core.info.yml';
}
try {
/** @var \Drupal\Core\Extension\ExtensionList $extension_list */
$extension_list = \Drupal::service("extension.list.$type");
if (isset($filename)) {
// Manually add the info file path of an extension.
$extension_list->setPathname($name, $filename);
}
return $extension_list->getPathname($name);
}
catch (ServiceNotFoundException $e) {
// Catch the exception. This will result in triggering an error.
// If the service is unknown, create a user-level error message.
trigger_error(
sprintf('Unknown type specified: "%s". Must be one of: "core", "profile", "module", "theme", or "theme_engine".', $type),
E_USER_WARNING
);
}
catch (\InvalidArgumentException $e) {
// Catch the exception. This will result in triggering an error.
// If the filename is still unknown, create a user-level error message.
trigger_error(
sprintf('The following %s is missing from the file system: %s', $type, $name),
E_USER_WARNING
);
}
}
/**
* Returns the path to a system item (module, theme, etc.).
*
* @param $type
* The type of the item; one of 'core', 'profile', 'module', 'theme', or
* 'theme_engine'.
* @param $name
* The name of the item for which the path is requested. Ignored for
* $type 'core'.
*
* @return string
* The path to the requested item or an empty string if the item is not found.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.
*
* @see https://www.drupal.org/node/2940438
* @see \Drupal\Core\Extension\ExtensionList::getPath()
*/
function drupal_get_path($type, $name) {
@trigger_error('drupal_get_path() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
return dirname(drupal_get_filename($type, $name));
}
/**
* Translates a string to the current language or to a given language.
*
* In order for strings to be localized, make them available in one of the ways
* supported by the @link i18n Localization API. @endlink When possible, use
* the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t().
* Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup
* object directly.
*
* See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for
* important security information and usage guidelines.
*
* @param string $string
* A string containing the English text to translate.
* @param array $args
* (optional) An associative array of replacements to make after translation.
* Based on the first character of the key, the value is escaped and/or
* themed. See
* \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for
* details.
* @param array $options
* (optional) An associative array of additional options, with the following
* elements:
* - 'langcode' (defaults to the current language): A language code, to
* translate to a language other than what is used to display the page.
* - 'context' (defaults to the empty context): The context the source string
* belongs to. See the @link i18n Internationalization topic @endlink for
* more information about string contexts.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* An object that, when cast to a string, returns the translated string.
*
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
* @see \Drupal\Core\StringTranslation\StringTranslationTrait::t()
* @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct()
*
* @ingroup sanitization
*/
function t($string, array $args = [], array $options = []) {
return new TranslatableMarkup($string, $args, $options);
}
/**
* Logs an exception.
*
* This is a wrapper logging function which automatically decodes an exception.
*
* @param $type
* The category to which this message belongs.
* @param $exception
* The exception that is going to be logged.
* @param $message
* The message to store in the log. If empty, a text that contains all useful
* information about the passed-in exception is used.
* @param $variables
* Array of variables to replace in the message on display or
* NULL if message is already translated or not possible to
* translate.
* @param $severity
* The severity of the message, as per RFC 3164.
* @param $link
* A link to associate with the message.
*
* @see \Drupal\Core\Utility\Error::decodeException()
*/
function watchdog_exception($type, Exception $exception, $message = NULL, $variables = [], $severity = RfcLogLevel::ERROR, $link = NULL) {
// Use a default value if $message is not set.
if (empty($message)) {
$message = '%type: @message in %function (line %line of %file).';
}
if ($link) {
$variables['link'] = $link;
}
$variables += Error::decodeException($exception);
\Drupal::logger($type)->log($severity, $message, $variables);
}
/**
* Provides custom PHP error handling.
*
* @param $error_level
* The level of the error raised.
* @param $message
* The error message.
* @param $filename
* (optional) The filename that the error was raised in.
* @param $line
* (optional) The line number the error was raised at.
*/
function _drupal_error_handler($error_level, $message, $filename = NULL, $line = NULL) {
require_once __DIR__ . '/errors.inc';
_drupal_error_handler_real($error_level, $message, $filename, $line);
}
/**
* Provides custom PHP exception handling.
*
* Uncaught exceptions are those not enclosed in a try/catch block. They are
* always fatal: the execution of the script will stop as soon as the exception
* handler exits.
*
* @param \Exception|\Throwable $exception
* The exception object that was thrown.
*/
function _drupal_exception_handler($exception) {
require_once __DIR__ . '/errors.inc';
try {
// Log the message to the watchdog and return an error page to the user.
_drupal_log_error(Error::decodeException($exception), TRUE);
}
// Catch \Throwable, which covers both Error and Exception throwables.
catch (\Throwable $error) {
_drupal_exception_handler_additional($exception, $error);
}
}
/**
* Displays any additional errors caught while handling an exception.
*
* @param \Exception|\Throwable $exception
* The first exception object that was thrown.
* @param \Exception|\Throwable $exception2
* The second exception object that was thrown.
*/
function _drupal_exception_handler_additional($exception, $exception2) {
// Another uncaught exception was thrown while handling the first one.
// If we are displaying errors, then do so with no possibility of a further
// uncaught exception being thrown.
if (error_displayable()) {
print '<h1>Additional uncaught exception thrown while handling exception.</h1>';
print '<h2>Original</h2><p>' . Error::renderExceptionSafe($exception) . '</p>';
print '<h2>Additional</h2><p>' . Error::renderExceptionSafe($exception2) . '</p><hr />';
}
}
/**
* Returns the test prefix if this is an internal request from SimpleTest.
*
* @param string $new_prefix
* Internal use only. A new prefix to be stored.
*
* @return string|false
* Either the simpletest prefix (the string "simpletest" followed by any
* number of digits) or FALSE if the user agent does not contain a valid
* HMAC and timestamp.
*/
function drupal_valid_test_ua($new_prefix = NULL) {
static $test_prefix;
if (isset($new_prefix)) {
$test_prefix = $new_prefix;
}
if (isset($test_prefix)) {
return $test_prefix;
}
// Unless the below User-Agent and HMAC validation succeeds, we are not in
// a test environment.
$test_prefix = FALSE;
// A valid Simpletest request will contain a hashed and salted authentication
// code. Check if this code is present in a cookie or custom user agent
// string.
$http_user_agent = $_SERVER['HTTP_USER_AGENT'] ?? NULL;
$user_agent = $_COOKIE['SIMPLETEST_USER_AGENT'] ?? $http_user_agent;
if (isset($user_agent) && preg_match("/^simple(\w+\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) {
[, $prefix, $time, $salt, $hmac] = $matches;
$check_string = $prefix . ':' . $time . ':' . $salt;
// Read the hash salt prepared by drupal_generate_test_ua().
// This function is called before settings.php is read and Drupal's error
// handlers are set up. While Drupal's error handling may be properly
// configured on production sites, the server's PHP error_reporting may not.
// Ensure that no information leaks on production sites.
$test_db = new TestDatabase($prefix);
$key_file = DRUPAL_ROOT . '/' . $test_db->getTestSitePath() . '/.htkey';
if (!is_readable($key_file) || is_dir($key_file)) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
exit;
}
$private_key = file_get_contents($key_file);
// The string from drupal_generate_test_ua() is 74 bytes long. If we don't
// have it, tests cannot be allowed.
if (empty($private_key) || strlen($private_key) < 74) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
exit;
}
// The file properties add more entropy not easily accessible to others.
$key = $private_key . filectime(__FILE__) . fileinode(__FILE__);
$time_diff = REQUEST_TIME - $time;
$test_hmac = Crypt::hmacBase64($check_string, $key);
// Since we are making a local request a 600 second time window is allowed,
// and the HMAC must match.
if ($time_diff >= 0 && $time_diff <= 600 && hash_equals($test_hmac, $hmac)) {
$test_prefix = $prefix;
}
else {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden (SIMPLETEST_USER_AGENT invalid)');
exit;
}
}
return $test_prefix;
}
/**
* Generates a user agent string with a HMAC and timestamp for simpletest.
*/
function drupal_generate_test_ua($prefix) {
static $key, $last_prefix;
if (!isset($key) || $last_prefix != $prefix) {
$last_prefix = $prefix;
$test_db = new TestDatabase($prefix);
$key_file = DRUPAL_ROOT . '/' . $test_db->getTestSitePath() . '/.htkey';
// When issuing an outbound HTTP client request from within an inbound test
// request, then the outbound request has to use the same User-Agent header
// as the inbound request. A newly generated private key for the same test
// prefix would invalidate all subsequent inbound requests.
// @see \Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware
if (DRUPAL_TEST_IN_CHILD_SITE && $parent_prefix = drupal_valid_test_ua()) {
if ($parent_prefix != $prefix) {
throw new \RuntimeException("Malformed User-Agent: Expected '$parent_prefix' but got '$prefix'.");
}
// If the file is not readable, a PHP warning is expected in this case.
$private_key = file_get_contents($key_file);
}
else {
// Generate and save a new hash salt for a test run.
// Consumed by drupal_valid_test_ua() before settings.php is loaded.
$private_key = Crypt::randomBytesBase64(55);
file_put_contents($key_file, $private_key);
}
// The file properties add more entropy not easily accessible to others.
$key = $private_key . filectime(__FILE__) . fileinode(__FILE__);
}
// Generate a moderately secure HMAC based on the database credentials.
$salt = uniqid('', TRUE);
$check_string = $prefix . ':' . time() . ':' . $salt;
return 'simple' . $check_string . ':' . Crypt::hmacBase64($check_string, $key);
}
/**
* Enables use of the theme system without requiring database access.
*
* Loads and initializes the theme system for site installs, updates and when
* the site is in maintenance mode. This also applies when the database fails.
*
* @see _drupal_maintenance_theme()
*/
function drupal_maintenance_theme() {
require_once __DIR__ . '/theme.maintenance.inc';
_drupal_maintenance_theme();
}
/**
* Provides central static variable storage.
*
* All functions requiring a static variable to persist or cache data within
* a single page request are encouraged to use this function unless it is
* absolutely certain that the static variable will not need to be reset during
* the page request. By centralizing static variable storage through this
* function, other functions can rely on a consistent API for resetting any
* other function's static variables.
*
* Example:
* @code
* function example_list($field = 'default') {
* $examples = &drupal_static(__FUNCTION__);
* if (!isset($examples)) {
* // If this function is being called for the first time after a reset,
* // query the database and execute any other code needed to retrieve
* // information.
* ...
* }
* if (!isset($examples[$field])) {
* // If this function is being called for the first time for a particular
* // index field, then execute code needed to index the information already
* // available in $examples by the desired field.
* ...
* }
* // Subsequent invocations of this function for a particular index field
* // skip the above two code blocks and quickly return the already indexed
* // information.
* return $examples[$field];
* }
* function examples_admin_overview() {
* // When building the content for the overview page, make sure to get
* // completely fresh information.
* drupal_static_reset('example_list');
* ...
* }
* @endcode
*
* In a few cases, a function can have certainty that there is no legitimate
* use-case for resetting that function's static variable. This is rare,
* because when writing a function, it's hard to forecast all the situations in
* which it will be used. A guideline is that if a function's static variable
* does not depend on any information outside of the function that might change
* during a single page request, then it's ok to use the "static" keyword
* instead of the drupal_static() function.
*
* Example:
* @code
* function mymodule_log_stream_handle($new_handle = NULL) {
* static $handle;
* if (isset($new_handle)) {
* $handle = $new_handle;
* }
* return $handle;
* }
* @endcode
*
* In a few cases, a function needs a resettable static variable, but the
* function is called many times (100+) during a single page request, so
* every microsecond of execution time that can be removed from the function
* counts. These functions can use a more cumbersome, but faster variant of
* calling drupal_static(). It works by storing the reference returned by
* drupal_static() in the calling function's own static variable, thereby
* removing the need to call drupal_static() for each iteration of the function.
* Conceptually, it replaces:
* @code
* $foo = &drupal_static(__FUNCTION__);
* @endcode
* with:
* @code
* // Unfortunately, this does not work.
* static $foo = &drupal_static(__FUNCTION__);
* @endcode
* However, the above line of code does not work, because PHP only allows static
* variables to be initialized by literal values, and does not allow static
* variables to be assigned to references.
* - http://php.net/manual/language.variables.scope.php#language.variables.scope.static
* - http://php.net/manual/language.variables.scope.php#language.variables.scope.references
* The example below shows the syntax needed to work around both limitations.
* For benchmarks and more information, see https://www.drupal.org/node/619666.
*
* Example:
* @code
* function example_default_format_type() {
* // Use the advanced drupal_static() pattern, since this is called very often.
* static $drupal_static_fast;
* if (!isset($drupal_static_fast)) {
* $drupal_static_fast['format_type'] = &drupal_static(__FUNCTION__);
* }
* $format_type = &$drupal_static_fast['format_type'];
* ...
* }
* @endcode
*
* @param $name
* Globally unique name for the variable. For a function with only one static,
* variable, the function name (e.g. via the PHP magic __FUNCTION__ constant)
* is recommended. For a function with multiple static variables add a
* distinguishing suffix to the function name for each one.
* @param $default_value
* Optional default value.
* @param $reset
* TRUE to reset one or all variables(s). This parameter is only used
* internally and should not be passed in; use drupal_static_reset() instead.
* (This function's return value should not be used when TRUE is passed in.)
*
* @return mixed
* Returns a variable by reference.
*
* @see drupal_static_reset()
*/
function &drupal_static($name, $default_value = NULL, $reset = FALSE) {
static $data = [], $default = [];
// First check if dealing with a previously defined static variable.
if (isset($data[$name]) || array_key_exists($name, $data)) {
// Non-NULL $name and both $data[$name] and $default[$name] statics exist.
if ($reset) {
// Reset pre-existing static variable to its default value.
$data[$name] = $default[$name];
}
return $data[$name];
}
// Neither $data[$name] nor $default[$name] static variables exist.
if (isset($name)) {
if ($reset) {
// Reset was called before a default is set and yet a variable must be
// returned.
return $data;
}
// First call with new non-NULL $name. Initialize a new static variable.
$default[$name] = $data[$name] = $default_value;
return $data[$name];
}
// Reset all: ($name == NULL). This needs to be done one at a time so that
// references returned by earlier invocations of drupal_static() also get
// reset.
foreach ($default as $name => $value) {
$data[$name] = $value;
}
// As the function returns a reference, the return should always be a
// variable.
return $data;
}
/**
* Resets one or all centrally stored static variable(s).
*
* @param $name
* Name of the static variable to reset. Omit to reset all variables.
* Resetting all variables should only be used, for example, for running
* unit tests with a clean environment.
*/
function drupal_static_reset($name = NULL) {
switch ($name) {
case 'taxonomy_vocabulary_get_names':
@trigger_error("Calling drupal_static_reset() with 'taxonomy_vocabulary_get_names' as argument is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3039041", E_USER_DEPRECATED);
break;
case 'node_mark':
@trigger_error("Calling drupal_static_reset() with 'node_mark' as argument is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3037203", E_USER_DEPRECATED);
break;
case 'Drupal\book\BookManager::bookSubtreeData':
case 'Drupal\book\BookManager::bookTreeAllData':
case 'Drupal\book\BookManager::doBookTreeBuild':
@trigger_error("Calling drupal_static_reset() with '{$name}' as argument is deprecated in drupal:9.3.0 and is removed in drupal:10.0.0. Use \Drupal::service('book.memory_cache')->deleteAll() instead. See https://www.drupal.org/node/3039439", E_USER_DEPRECATED);
\Drupal::service('book.memory_cache')->deleteAll();
break;
}
drupal_static($name, NULL, TRUE);
}
/**
* Registers a function for execution on shutdown.
*
* Wrapper for register_shutdown_function() that catches thrown exceptions to
* avoid "Exception thrown without a stack frame in Unknown".
*
* @param callable $callback
* The shutdown function to register.
* @param ...
* Additional arguments to pass to the shutdown function.
*
* @return array
* Array of shutdown functions to be executed.
*
* @see register_shutdown_function()
* @ingroup php_wrappers
*/
function &drupal_register_shutdown_function($callback = NULL) {
// We cannot use drupal_static() here because the static cache is reset during
// batch processing, which breaks batch handling.
static $callbacks = [];
if (isset($callback)) {
// Only register the internal shutdown function once.
if (empty($callbacks)) {
register_shutdown_function('_drupal_shutdown_function');
}
$args = func_get_args();
// Remove $callback from the arguments.
unset($args[0]);
// Save callback and arguments
$callbacks[] = ['callback' => $callback, 'arguments' => $args];
}
return $callbacks;
}
/**
* Executes registered shutdown functions.
*/
function _drupal_shutdown_function() {
$callbacks = &drupal_register_shutdown_function();
// Set the CWD to DRUPAL_ROOT as it is not guaranteed to be the same as it
// was in the normal context of execution.
chdir(DRUPAL_ROOT);
try {
reset($callbacks);
// Do not use foreach() here because it is possible that the callback will
// add to the $callbacks array via drupal_register_shutdown_function().
while ($callback = current($callbacks)) {
call_user_func_array($callback['callback'], $callback['arguments']);
next($callbacks);
}
}
// Catch \Throwable, which covers both Error and Exception throwables.
catch (\Throwable $error) {
_drupal_shutdown_function_handle_exception($error);
}
}
/**
* Displays and logs any errors that may happen during shutdown.
*
* @param \Exception|\Throwable $exception
* The exception object that was thrown.
*
* @see _drupal_shutdown_function()
*/
function _drupal_shutdown_function_handle_exception($exception) {
// If using PHP-FPM then fastcgi_finish_request() will have been fired
// preventing further output to the browser.
if (!function_exists('fastcgi_finish_request')) {
// If we are displaying errors, then do so with no possibility of a
// further uncaught exception being thrown.
require_once __DIR__ . '/errors.inc';
if (error_displayable()) {
print '<h1>Uncaught exception thrown in shutdown function.</h1>';
print '<p>' . Error::renderExceptionSafe($exception) . '</p><hr />';
}
}
error_log($exception);
}

View File

@ -0,0 +1,676 @@
<?php
/**
* @file
* Common functions that many Drupal modules will need to reference.
*
* The functions that are critical and need to be available even when serving
* a cached page are instead located in bootstrap.inc.
*/
use Drupal\Component\Utility\Bytes;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SortArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\DrupalKernel;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* @defgroup php_wrappers PHP wrapper functions
* @{
* Functions that are wrappers or custom implementations of PHP functions.
*
* Certain PHP functions should not be used in Drupal. Instead, Drupal's
* replacement functions should be used.
*
* For example, for improved or more secure UTF8-handling, or RFC-compliant
* handling of URLs in Drupal.
*
* For ease of use and memorizing, all these wrapper functions use the same name
* as the original PHP function, but prefixed with "drupal_". Beware, however,
* that not all wrapper functions support the same arguments as the original
* functions.
*
* You should always use these wrapper functions in your code.
*
* Wrong:
* @code
* $my_substring = substr($original_string, 0, 5);
* @endcode
*
* Correct:
* @code
* $my_substring = mb_substr($original_string, 0, 5);
* @endcode
*
* @}
*/
/**
* Return status for saving which involved creating a new item.
*/
const SAVED_NEW = 1;
/**
* Return status for saving which involved an update to an existing item.
*/
const SAVED_UPDATED = 2;
/**
* Return status for saving which deleted an existing item.
*/
const SAVED_DELETED = 3;
/**
* The default aggregation group for CSS files added to the page.
*/
const CSS_AGGREGATE_DEFAULT = 0;
/**
* The default aggregation group for theme CSS files added to the page.
*/
const CSS_AGGREGATE_THEME = 100;
/**
* The default weight for CSS rules that style HTML elements ("base" styles).
*/
const CSS_BASE = -200;
/**
* The default weight for CSS rules that layout a page.
*/
const CSS_LAYOUT = -100;
/**
* The default weight for CSS rules that style design components (and their associated states and themes.)
*/
const CSS_COMPONENT = 0;
/**
* The default weight for CSS rules that style states and are not included with components.
*/
const CSS_STATE = 100;
/**
* The default weight for CSS rules that style themes and are not included with components.
*/
const CSS_THEME = 200;
/**
* The default group for JavaScript settings added to the page.
*/
const JS_SETTING = -200;
/**
* The default group for JavaScript and jQuery libraries added to the page.
*/
const JS_LIBRARY = -100;
/**
* The default group for module JavaScript code added to the page.
*/
const JS_DEFAULT = 0;
/**
* The default group for theme JavaScript code added to the page.
*/
const JS_THEME = 100;
/**
* @defgroup format Formatting
* @{
* Functions to format numbers, strings, dates, etc.
*/
/**
* Generates a string representation for the given byte count.
*
* @param $size
* A size in bytes.
* @param $langcode
* Optional language code to translate to a language other than what is used
* to display the page.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* A translated string representation of the size.
*/
function format_size($size, $langcode = NULL) {
$absolute_size = abs($size);
if ($absolute_size < Bytes::KILOBYTE) {
return \Drupal::translation()->formatPlural($size, '1 byte', '@count bytes', [], ['langcode' => $langcode]);
}
// Create a multiplier to preserve the sign of $size.
$sign = $absolute_size / $size;
foreach (['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] as $unit) {
$absolute_size /= Bytes::KILOBYTE;
$rounded_size = round($absolute_size, 2);
if ($rounded_size < Bytes::KILOBYTE) {
break;
}
}
$args = ['@size' => $rounded_size * $sign];
$options = ['langcode' => $langcode];
switch ($unit) {
case 'KB':
return new TranslatableMarkup('@size KB', $args, $options);
case 'MB':
return new TranslatableMarkup('@size MB', $args, $options);
case 'GB':
return new TranslatableMarkup('@size GB', $args, $options);
case 'TB':
return new TranslatableMarkup('@size TB', $args, $options);
case 'PB':
return new TranslatableMarkup('@size PB', $args, $options);
case 'EB':
return new TranslatableMarkup('@size EB', $args, $options);
case 'ZB':
return new TranslatableMarkup('@size ZB', $args, $options);
case 'YB':
return new TranslatableMarkup('@size YB', $args, $options);
}
}
/**
* @} End of "defgroup format".
*/
/**
* Returns the base URL path (i.e., directory) of the Drupal installation.
*
* Function base_path() adds a "/" to the beginning and end of the returned path
* if the path is not empty. At the very least, this will return "/".
*
* Examples:
* - http://example.com returns "/" because the path is empty.
* - http://example.com/drupal/folder returns "/drupal/folder/".
*/
function base_path() {
return $GLOBALS['base_path'];
}
/**
* Constructs an array of the defaults that are used for JavaScript assets.
*
* @param $data
* (optional) The default data parameter for the JavaScript asset array.
*
* @see hook_js_alter()
*/
function drupal_js_defaults($data = NULL) {
return [
'type' => 'file',
'group' => JS_DEFAULT,
'weight' => 0,
'scope' => 'header',
'cache' => TRUE,
'preprocess' => TRUE,
'attributes' => [],
'version' => NULL,
'data' => $data,
'browsers' => [],
];
}
/**
* Assists in attaching the tableDrag JavaScript behavior to a themed table.
*
* Draggable tables should be used wherever an outline or list of sortable items
* needs to be arranged by an end-user. Draggable tables are very flexible and
* can manipulate the value of form elements placed within individual columns.
*
* To set up a table to use drag and drop in place of weight select-lists or in
* place of a form that contains parent relationships, the form must be themed
* into a table. The table must have an ID attribute set and it
* may be set as follows:
* @code
* $table = array(
* '#type' => 'table',
* '#header' => $header,
* '#rows' => $rows,
* '#attributes' => array(
* 'id' => 'my-module-table',
* ),
* );
* return \Drupal::service('renderer')->render($table);
* @endcode
*
* In the theme function for the form, a special class must be added to each
* form element within the same column, "grouping" them together.
*
* In a situation where a single weight column is being sorted in the table, the
* classes could be added like this (in the theme function):
* @code
* $form['my_elements'][$delta]['weight']['#attributes']['class'] = array('my-elements-weight');
* @endcode
*
* Each row of the table must also have a class of "draggable" in order to
* enable the drag handles:
* @code
* $row = array(...);
* $rows[] = array(
* 'data' => $row,
* 'class' => array('draggable'),
* );
* @endcode
*
* When tree relationships are present, the two additional classes
* 'tabledrag-leaf' and 'tabledrag-root' can be used to refine the behavior:
* - Rows with the 'tabledrag-leaf' class cannot have child rows.
* - Rows with the 'tabledrag-root' class cannot be nested under a parent row.
*
* Calling drupal_attach_tabledrag() would then be written as such:
* @code
* drupal_attach_tabledrag('my-module-table', array(
* 'action' => 'order',
* 'relationship' => 'sibling',
* 'group' => 'my-elements-weight',
* );
* @endcode
*
* In a more complex case where there are several groups in one column (such as
* the block regions on the admin/structure/block page), a separate subgroup
* class must also be added to differentiate the groups.
* @code
* $form['my_elements'][$region][$delta]['weight']['#attributes']['class'] = array('my-elements-weight', 'my-elements-weight-' . $region);
* @endcode
*
* The 'group' option is still 'my-element-weight', and the additional
* 'subgroup' option will be passed in as 'my-elements-weight-' . $region. This
* also means that you'll need to call drupal_attach_tabledrag() once for every
* region added.
*
* @code
* foreach ($regions as $region) {
* drupal_attach_tabledrag('my-module-table', array(
* 'action' => 'order',
* 'relationship' => 'sibling',
* 'group' => 'my-elements-weight',
* 'subgroup' => 'my-elements-weight-' . $region,
* ));
* }
* @endcode
*
* In a situation where tree relationships are present, adding multiple
* subgroups is not necessary, because the table will contain indentations that
* provide enough information about the sibling and parent relationships. See
* MenuForm::BuildOverviewForm for an example creating a table
* containing parent relationships.
*
* @param $element
* A form element to attach the tableDrag behavior to.
* @param array $options
* These options are used to generate JavaScript settings necessary to
* configure the tableDrag behavior appropriately for this particular table.
* An associative array containing the following keys:
* - 'table_id': String containing the target table's id attribute.
* If the table does not have an id, one will need to be set,
* such as <table id="my-module-table">.
* - 'action': String describing the action to be done on the form item.
* Either 'match' 'depth', or 'order':
* - 'match' is typically used for parent relationships.
* - 'order' is typically used to set weights on other form elements with
* the same group.
* - 'depth' updates the target element with the current indentation.
* - 'relationship': String describing where the "action" option
* should be performed. Either 'parent', 'sibling', 'group', or 'self':
* - 'parent' will only look for fields up the tree.
* - 'sibling' will look for fields in the same group in rows above and
* below it.
* - 'self' affects the dragged row itself.
* - 'group' affects the dragged row, plus any children below it (the entire
* dragged group).
* - 'group': A class name applied on all related form elements for this action.
* - 'subgroup': (optional) If the group has several subgroups within it, this
* string should contain the class name identifying fields in the same
* subgroup.
* - 'source': (optional) If the $action is 'match', this string should contain
* the classname identifying what field will be used as the source value
* when matching the value in $subgroup.
* - 'hidden': (optional) The column containing the field elements may be
* entirely hidden from view dynamically when the JavaScript is loaded. Set
* to FALSE if the column should not be hidden.
* - 'limit': (optional) Limit the maximum amount of parenting in this table.
*
* @see MenuForm::BuildOverviewForm()
*/
function drupal_attach_tabledrag(&$element, array $options) {
// Add default values to elements.
$options = $options + [
'subgroup' => NULL,
'source' => NULL,
'hidden' => TRUE,
'limit' => 0,
];
$group = $options['group'];
$tabledrag_id = &drupal_static(__FUNCTION__);
$tabledrag_id = (!isset($tabledrag_id)) ? 0 : $tabledrag_id + 1;
// If a subgroup or source isn't set, assume it is the same as the group.
$target = $options['subgroup'] ?? $group;
$source = $options['source'] ?? $target;
$element['#attached']['drupalSettings']['tableDrag'][$options['table_id']][$group][$tabledrag_id] = [
'target' => $target,
'source' => $source,
'relationship' => $options['relationship'],
'action' => $options['action'],
'hidden' => $options['hidden'],
'limit' => $options['limit'],
];
$element['#attached']['library'][] = 'core/drupal.tabledrag';
}
/**
* Renders an element.
*
* This function renders an element. The top level element is shown with show()
* before rendering, so it will always be rendered even if hide() had been
* previously used on it.
*
* @param $element
* The element to be rendered.
*
* @return
* The rendered element.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\Core\Render\RendererInterface::render() instead.
*
* @see https://www.drupal.org/node/2939099
* @see \Drupal\Core\Render\RendererInterface
* @see show()
* @see hide()
*/
function render(&$element) {
@trigger_error('The render() function is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Render\RendererInterface::render() instead. See https://www.drupal.org/node/2939099', E_USER_DEPRECATED);
if (!$element && $element !== 0) {
return NULL;
}
if (is_array($element)) {
// Early return if this element was pre-rendered (no need to re-render).
if (isset($element['#printed']) && $element['#printed'] == TRUE && isset($element['#markup']) && strlen($element['#markup']) > 0) {
return $element['#markup'];
}
show($element);
return \Drupal::service('renderer')->render($element);
}
else {
// Safe-guard for inappropriate use of render() on flat variables: return
// the variable as-is.
return $element;
}
}
/**
* Hides an element from later rendering.
*
* The first time render() or RenderInterface::render() is called on an element
* tree, as each element in the tree is rendered, it is marked with a #printed
* flag and the rendered children of the element are cached. Subsequent calls to
* render() or RenderInterface::render() will not traverse the child tree of
* this element again: they will just use the cached children. So if you want to
* hide an element, be sure to call hide() on the element before its parent tree
* is rendered for the first time, as it will have no effect on subsequent
* renderings of the parent tree.
*
* @param $element
* The element to be hidden.
*
* @return
* The element.
*
* @see \Drupal\Core\Render\RendererInterface
* @see render()
* @see show()
*/
function hide(&$element) {
$element['#printed'] = TRUE;
return $element;
}
/**
* Shows a hidden element for later rendering.
*
* You can also use render($element), which shows the element while rendering
* it.
*
* The first time render() or RenderInterface::render() is called on an element
* tree, as each element in the tree is rendered, it is marked with a #printed
* flag and the rendered children of the element are cached. Subsequent calls to
* render() or RenderInterface::render() will not traverse the child tree of
* this element again: they will just use the cached children. So if you want to
* show an element, be sure to call show() on the element before its parent tree
* is rendered for the first time, as it will have no effect on subsequent
* renderings of the parent tree.
*
* @param $element
* The element to be shown.
*
* @return
* The element.
*
* @see \Drupal\Core\Render\RendererInterface
* @see render()
* @see hide()
*/
function show(&$element) {
$element['#printed'] = FALSE;
return $element;
}
/**
* Rebuilds the container, flushes all persistent caches, resets all variables, and rebuilds all data structures.
*
* At times, it is necessary to re-initialize the entire system to account for
* changed or new code. This function:
* - Rebuilds the container if $kernel is not passed in.
* - Clears all persistent caches:
* - The bootstrap cache bin containing base system, module system, and theme
* system information.
* - The common 'default' cache bin containing arbitrary caches.
* - The page cache.
* - The URL alias path cache.
* - Resets all static variables that have been defined via drupal_static().
* - Clears asset (JS/CSS) file caches.
* - Updates the system with latest information about extensions (modules and
* themes).
* - Updates the bootstrap flag for modules implementing bootstrap_hooks().
* - Rebuilds the full database schema information (invoking hook_schema()).
* - Rebuilds data structures of all modules (invoking hook_rebuild()). In
* core this means
* - blocks, node types, date formats and actions are synchronized with the
* database
* - The 'active' status of fields is refreshed.
* - Rebuilds the menu router.
*
* It's discouraged to call this during a regular page request.
* If you call this function in tests, every code afterwards should use the new
* container.
*
* This means the entire system is reset so all caches and static variables are
* effectively empty. After that is guaranteed, information about the currently
* active code is updated, and rebuild operations are successively called in
* order to synchronize the active system according to the current information
* defined in code.
*
* All modules need to ensure that all of their caches are flushed when
* hook_cache_flush() is invoked; any previously known information must no
* longer exist. All following hook_rebuild() operations must be based on fresh
* and current system data. All modules must be able to rely on this contract.
*
* @see \Drupal\Core\Cache\CacheHelper::getBins()
* @see hook_cache_flush()
* @see hook_rebuild()
*
* This function also resets the theme, which means it is not initialized
* anymore and all previously added JavaScript and CSS is gone. Normally, this
* function is called as an end-of-POST-request operation that is followed by a
* redirect, so this effect is not visible. Since the full reset is the whole
* point of this function, callers need to take care for backing up all needed
* variables and properly restoring or re-initializing them on their own. For
* convenience, this function automatically re-initializes the maintenance theme
* if it was initialized before.
*
* @todo Try to clear page/JS/CSS caches last, so cached pages can still be
* served during this possibly long-running operation. (Conflict on bootstrap
* cache though.)
* @todo Add a global lock to ensure that caches are not primed in concurrent
* requests.
*
* @param \Drupal\Core\DrupalKernel|array $kernel
* (optional) The Drupal Kernel. It is the caller's responsibility to rebuild
* the container if this is passed in. Sometimes drupal_flush_all_caches is
* used as a batch operation so $kernel will be an array, in this instance it
* will be treated as if it it NULL.
*/
function drupal_flush_all_caches($kernel = NULL) {
// This is executed based on old/previously known information if $kernel is
// not passed in, which is sufficient, since new extensions cannot have any
// primed caches yet.
$module_handler = \Drupal::moduleHandler();
// Flush all persistent caches.
$module_handler->invokeAll('cache_flush');
foreach (Cache::getBins() as $service_id => $cache_backend) {
$cache_backend->deleteAll();
}
// Flush asset file caches.
\Drupal::service('asset.css.collection_optimizer')->deleteAll();
\Drupal::service('asset.js.collection_optimizer')->deleteAll();
_drupal_flush_css_js();
// Reset all static caches.
drupal_static_reset();
// Wipe the Twig PHP Storage cache.
\Drupal::service('twig')->invalidate();
// Rebuild theme data that is stored in state.
\Drupal::service('theme_handler')->refreshInfo();
// In case the active theme gets requested later in the same request we need
// to reset the theme manager.
\Drupal::theme()->resetActiveTheme();
if (!$kernel instanceof DrupalKernel) {
$kernel = \Drupal::service('kernel');
$kernel->invalidateContainer();
$kernel->rebuildContainer();
}
// Rebuild module data that is stored in state.
\Drupal::service('extension.list.module')->reset();
// Rebuild all information based on new module data.
\Drupal::moduleHandler()->invokeAll('rebuild');
// Clear all plugin caches.
\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
// Rebuild the menu router based on all rebuilt data.
// Important: This rebuild must happen last, so the menu router is guaranteed
// to be based on up to date information.
\Drupal::service('router.builder')->rebuild();
// Re-initialize the maintenance theme, if the current request attempted to
// use it. Unlike regular usages of this function, the installer and update
// scripts need to flush all caches during GET requests/page building.
if (function_exists('_drupal_maintenance_theme')) {
\Drupal::theme()->resetActiveTheme();
drupal_maintenance_theme();
}
}
/**
* Changes the dummy query string added to all CSS and JavaScript files.
*
* Changing the dummy query string appended to CSS and JavaScript files forces
* all browsers to reload fresh files.
*/
function _drupal_flush_css_js() {
// The timestamp is converted to base 36 in order to make it more compact.
Drupal::state()->set('system.css_js_query_string', base_convert(REQUEST_TIME, 10, 36));
}
/**
* Outputs debug information.
*
* The debug information is passed on to trigger_error() after being converted
* to a string using print_r() or var_export().
*
* @param $data
* Data to be output.
* @param $label
* Label to prefix the data.
* @param $print_r
* Flag to switch between print_r() and var_export() for data conversion to
* string. Set $print_r to FALSE to use var_export() instead of print_r().
* Passing recursive data structures to var_export() will generate an error.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use dump()
* instead.
*
* @see https://www.drupal.org/node/3192283
*/
function debug($data, $label = NULL, $print_r = TRUE) {
@trigger_error('debug() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use dump() instead. See https://www.drupal.org/node/3192283', E_USER_DEPRECATED);
// Print $data contents to string.
$string = Html::escape($print_r ? print_r($data, TRUE) : var_export($data, TRUE));
// Display values with pre-formatting to increase readability.
$string = '<pre>' . $string . '</pre>';
trigger_error(trim($label ? "$label: $string" : $string));
}
/**
* Assembles the Drupal Updater registry.
*
* An Updater is a class that knows how to update various parts of the Drupal
* file system, for example to update modules that have newer releases, or to
* install a new theme.
*
* @return array
* The Drupal Updater class registry.
*
* @see \Drupal\Core\Updater\Updater
* @see hook_updater_info()
* @see hook_updater_info_alter()
*/
function drupal_get_updaters() {
$updaters = &drupal_static(__FUNCTION__);
if (!isset($updaters)) {
$updaters = \Drupal::moduleHandler()->invokeAll('updater_info');
\Drupal::moduleHandler()->alter('updater_info', $updaters);
uasort($updaters, [SortArray::class, 'sortByWeightElement']);
}
return $updaters;
}
/**
* Assembles the Drupal FileTransfer registry.
*
* @return
* The Drupal FileTransfer class registry.
*
* @see \Drupal\Core\FileTransfer\FileTransfer
* @see hook_filetransfer_info()
* @see hook_filetransfer_info_alter()
*/
function drupal_get_filetransfer_info() {
$info = &drupal_static(__FUNCTION__);
if (!isset($info)) {
$info = \Drupal::moduleHandler()->invokeAll('filetransfer_info');
\Drupal::moduleHandler()->alter('filetransfer_info', $info);
uasort($info, [SortArray::class, 'sortByWeightElement']);
}
return $info;
}

View File

@ -0,0 +1,369 @@
<?php
/**
* @file
* Functions for error handling.
*/
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Render\Markup;
use Drupal\Core\Utility\Error;
use Symfony\Component\HttpFoundation\Response;
/**
* Maps PHP error constants to watchdog severity levels.
*
* The error constants are documented at
* http://php.net/manual/errorfunc.constants.php
*
* @ingroup logging_severity_levels
*/
function drupal_error_levels() {
$types = [
E_ERROR => ['Error', RfcLogLevel::ERROR],
E_WARNING => ['Warning', RfcLogLevel::WARNING],
E_PARSE => ['Parse error', RfcLogLevel::ERROR],
E_NOTICE => ['Notice', RfcLogLevel::NOTICE],
E_CORE_ERROR => ['Core error', RfcLogLevel::ERROR],
E_CORE_WARNING => ['Core warning', RfcLogLevel::WARNING],
E_COMPILE_ERROR => ['Compile error', RfcLogLevel::ERROR],
E_COMPILE_WARNING => ['Compile warning', RfcLogLevel::WARNING],
E_USER_ERROR => ['User error', RfcLogLevel::ERROR],
E_USER_WARNING => ['User warning', RfcLogLevel::WARNING],
E_USER_NOTICE => ['User notice', RfcLogLevel::NOTICE],
E_STRICT => ['Strict warning', RfcLogLevel::DEBUG],
E_RECOVERABLE_ERROR => ['Recoverable fatal error', RfcLogLevel::ERROR],
E_DEPRECATED => ['Deprecated function', RfcLogLevel::DEBUG],
E_USER_DEPRECATED => ['User deprecated function', RfcLogLevel::DEBUG],
];
return $types;
}
/**
* Provides custom PHP error handling.
*
* @param $error_level
* The level of the error raised.
* @param $message
* The error message.
* @param $filename
* The filename that the error was raised in.
* @param $line
* The line number the error was raised at.
*/
function _drupal_error_handler_real($error_level, $message, $filename, $line) {
if ($error_level & error_reporting()) {
$types = drupal_error_levels();
[$severity_msg, $severity_level] = $types[$error_level];
$backtrace = debug_backtrace();
$caller = Error::getLastCaller($backtrace);
// We treat recoverable errors as fatal.
$recoverable = $error_level == E_RECOVERABLE_ERROR;
// As __toString() methods must not throw exceptions (recoverable errors)
// in PHP, we allow them to trigger a fatal error by emitting a user error
// using trigger_error().
$to_string = $error_level == E_USER_ERROR && substr($caller['function'], -strlen('__toString()')) == '__toString()';
_drupal_log_error([
'%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error',
// The standard PHP error handler considers that the error messages
// are HTML. We mimic this behavior here.
'@message' => Markup::create(Xss::filterAdmin($message)),
'%function' => $caller['function'],
'%file' => $caller['file'],
'%line' => $caller['line'],
'severity_level' => $severity_level,
'backtrace' => $backtrace,
'@backtrace_string' => (new \Exception())->getTraceAsString(),
'exception' => NULL,
], $recoverable || $to_string);
}
// If the site is a test site then fail for user deprecations so they can be
// caught by the deprecation error handler.
elseif (DRUPAL_TEST_IN_CHILD_SITE && $error_level === E_USER_DEPRECATED) {
static $seen = [];
if (array_search($message, $seen, TRUE) === FALSE) {
// Only report each deprecation once. Too many headers can break some
// Chrome and web driver testing.
$seen[] = $message;
$backtrace = debug_backtrace();
$caller = Error::getLastCaller($backtrace);
_drupal_error_header(
Markup::create(Xss::filterAdmin($message)),
'User deprecated function',
$caller['function'],
$caller['file'],
$caller['line']
);
}
}
}
/**
* Determines whether an error should be displayed.
*
* When in maintenance mode or when error_level is ERROR_REPORTING_DISPLAY_ALL,
* all errors should be displayed. For ERROR_REPORTING_DISPLAY_SOME, $error
* will be examined to determine if it should be displayed.
*
* @param $error
* Optional error to examine for ERROR_REPORTING_DISPLAY_SOME.
*
* @return
* TRUE if an error should be displayed.
*/
function error_displayable($error = NULL) {
if (defined('MAINTENANCE_MODE')) {
return TRUE;
}
$error_level = _drupal_get_error_level();
if ($error_level == ERROR_REPORTING_DISPLAY_ALL || $error_level == ERROR_REPORTING_DISPLAY_VERBOSE) {
return TRUE;
}
if ($error_level == ERROR_REPORTING_DISPLAY_SOME && isset($error)) {
return $error['%type'] != 'Notice' && $error['%type'] != 'Strict warning';
}
return FALSE;
}
/**
* Logs a PHP error or exception and displays an error page in fatal cases.
*
* @param $error
* An array with the following keys: %type, @message, %function, %file, %line,
* @backtrace_string, severity_level, backtrace, and exception. All the
* parameters are plain-text, with the exception of @message, which needs to
* be an HTML string, backtrace, which is a standard PHP backtrace, and
* exception, which is the exception object (or NULL if the error is not an
* exception).
* @param bool $fatal
* TRUE for:
* - An exception is thrown and not caught by something else.
* - A recoverable fatal error, which is a fatal error.
* Non-recoverable fatal errors cannot be logged by Drupal.
*/
function _drupal_log_error($error, $fatal = FALSE) {
$is_installer = InstallerKernel::installationAttempted();
// Backtrace, exception and 'severity_level' are not valid replacement values
// for t().
$backtrace = $error['backtrace'];
$exception = $error['exception'];
$severity = $error['severity_level'];
unset($error['backtrace'], $error['exception'], $error['severity_level']);
// When running inside the testing framework, we relay the errors
// to the tested site by the way of HTTP headers.
if (DRUPAL_TEST_IN_CHILD_SITE && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) {
_drupal_error_header($error['@message'], $error['%type'], $error['%function'], $error['%file'], $error['%line']);
}
$response = new Response();
// Only call the logger if there is a logger factory available. This can occur
// if there is an error while rebuilding the container or during the
// installer.
if (\Drupal::hasService('logger.factory')) {
try {
// Provide the PHP backtrace and exception to logger implementations. Add
// 'severity_level' to the context to maintain BC and allow logging
// implementations to use it.
\Drupal::logger('php')->log($severity, '%type: @message in %function (line %line of %file) @backtrace_string.', $error + ['backtrace' => $backtrace, 'exception' => $exception, 'severity_level' => $severity]);
}
catch (\Exception $e) {
// We can't log, for example because the database connection is not
// available. At least try to log to PHP error log.
error_log(strtr('Failed to log error: %type: @message in %function (line %line of %file). @backtrace_string', $error));
}
}
// Log fatal errors, so developers can find and debug them.
if ($fatal) {
error_log(sprintf('%s: %s in %s on line %d %s', $error['%type'], $error['@message'], $error['%file'], $error['%line'], $error['@backtrace_string']));
}
if (PHP_SAPI === 'cli') {
if ($fatal) {
// When called from CLI, simply output a plain text message.
// Should not translate the string to avoid errors producing more errors.
$response->setContent(html_entity_decode(strip_tags(new FormattableMarkup('%type: @message in %function (line %line of %file).', $error))) . "\n");
$response->send();
exit(1);
}
}
if (\Drupal::hasRequest() && \Drupal::request()->isXmlHttpRequest()) {
if ($fatal) {
if (error_displayable($error)) {
// When called from JavaScript, simply output the error message.
// Should not translate the string to avoid errors producing more errors.
$response->setContent(new FormattableMarkup('%type: @message in %function (line %line of %file).', $error));
$response->send();
}
exit;
}
}
else {
// Display the message if the current error reporting level allows this type
// of message to be displayed, and unconditionally in update.php.
$message = '';
$class = NULL;
if (error_displayable($error)) {
$class = 'error';
// If error type is 'User notice' then treat it as debug information
// instead of an error message.
if ($error['%type'] == 'User notice') {
$error['%type'] = 'Debug';
$class = 'status';
}
// Attempt to reduce verbosity by removing DRUPAL_ROOT from the file path
// in the message. This does not happen for (false) security.
if (\Drupal::hasService('kernel')) {
$root_length = strlen(\Drupal::root());
if (substr($error['%file'], 0, $root_length) == \Drupal::root()) {
$error['%file'] = substr($error['%file'], $root_length + 1);
}
}
// Check if verbose error reporting is on.
$error_level = _drupal_get_error_level();
if ($error_level != ERROR_REPORTING_DISPLAY_VERBOSE) {
// Without verbose logging, use a simple message.
// We use \Drupal\Component\Render\FormattableMarkup directly here,
// rather than use t() since we are in the middle of error handling, and
// we don't want t() to cause further errors.
$message = new FormattableMarkup('%type: @message in %function (line %line of %file).', $error);
}
else {
// With verbose logging, we will also include a backtrace.
// First trace is the error itself, already contained in the message.
// While the second trace is the error source and also contained in the
// message, the message doesn't contain argument values, so we output it
// once more in the backtrace.
array_shift($backtrace);
// Generate a backtrace containing only scalar argument values.
$error['@backtrace'] = Error::formatBacktrace($backtrace);
$message = new FormattableMarkup('%type: @message in %function (line %line of %file). <pre class="backtrace">@backtrace</pre>', $error);
}
}
if ($fatal) {
// We fallback to a maintenance page at this point, because the page generation
// itself can generate errors.
// Should not translate the string to avoid errors producing more errors.
$message = 'The website encountered an unexpected error. Please try again later.' . '<br />' . $message;
if ($is_installer) {
// install_display_output() prints the output and ends script execution.
$output = [
'#title' => 'Error',
'#markup' => $message,
];
install_display_output($output, $GLOBALS['install_state']);
exit;
}
$response->setContent($message);
$response->setStatusCode(500, '500 Service unavailable (with message)');
$response->send();
// An exception must halt script execution.
exit;
}
if ($message) {
if (\Drupal::hasService('session')) {
// Message display is dependent on sessions being available.
\Drupal::messenger()->addMessage($message, $class, TRUE);
}
else {
print $message;
}
}
}
}
/**
* Returns the current error level.
*
* This function should only be used to get the current error level prior to the
* kernel being booted or before Drupal is installed. In all other situations
* the following code is preferred:
* @code
* \Drupal::config('system.logging')->get('error_level');
* @endcode
*
* @return string
* The current error level.
*/
function _drupal_get_error_level() {
// Raise the error level to maximum for the installer, so users are able to
// file proper bug reports for installer errors. The returned value is
// different to the one below, because the installer actually has a
// 'config.factory' service, which reads the default 'error_level' value from
// System module's default configuration and the default value is not verbose.
// @see error_displayable()
if (InstallerKernel::installationAttempted()) {
return ERROR_REPORTING_DISPLAY_VERBOSE;
}
$error_level = NULL;
// Try to get the error level configuration from database. If this fails,
// for example if the database connection is not there, try to read it from
// settings.php.
try {
$error_level = \Drupal::config('system.logging')->get('error_level');
}
catch (\Exception $e) {
$error_level = $GLOBALS['config']['system.logging']['error_level'] ?? ERROR_REPORTING_HIDE;
}
// If there is no container or if it has no config.factory service, we are
// possibly in an edge-case error situation while trying to serve a regular
// request on a public site, so use the non-verbose default value.
return $error_level ?: ERROR_REPORTING_DISPLAY_ALL;
}
/**
* Adds error information to headers so that tests can access it.
*
* @param $message
* The error message.
* @param $type
* The type of error.
* @param $function
* The function that emitted the error.
* @param $file
* The file that emitted the error.
* @param $line
* The line number in file that emitted the error.
*/
function _drupal_error_header($message, $type, $function, $file, $line) {
// $number does not use drupal_static as it should not be reset
// as it uniquely identifies each PHP error.
static $number = 0;
$assertion = [
$message,
$type,
[
'function' => $function,
'file' => $file,
'line' => $line,
],
];
// For non-fatal errors (e.g. PHP notices) _drupal_log_error can be called
// multiple times per request. In that case the response is typically
// generated outside of the error handler, e.g., in a controller. As a
// result it is not possible to use a Response object here but instead the
// headers need to be emitted directly.
header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion)));
$number++;
}

View File

@ -0,0 +1,221 @@
<?php
/**
* @file
* API for handling file uploads and server file management.
*/
use Drupal\Core\File\Exception\InvalidStreamWrapperException;
use Drupal\Core\File\FileSystemInterface;
/**
* @defgroup file File interface
* @{
* Common file handling functions.
*/
/**
* Indicates that the file is permanent and should not be deleted.
*
* Temporary files older than the system.file.temporary_maximum_age
* configuration value will be, if clean-up not disabled, removed during cron
* runs, but permanent files will not be removed during the file garbage
* collection process.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\file\FileInterface::STATUS_PERMANENT or
* \Drupal\file\FileInterface::setPermanent() instead.
*
* @see https://www.drupal.org/node/3022147
*/
const FILE_STATUS_PERMANENT = 1;
/**
* Creates a web-accessible URL for a stream to an external or local file.
*
* Compatibility: normal paths and stream wrappers.
*
* There are two kinds of local files:
* - "managed files", i.e. those stored by a Drupal-compatible stream wrapper.
* These are files that have either been uploaded by users or were generated
* automatically (for example through CSS aggregation).
* - "shipped files", i.e. those outside of the files directory, which ship as
* part of Drupal core or contributed modules or themes.
*
* @param string $uri
* The URI to a file for which we need an external URL, or the path to a
* shipped file.
*
* @return string
* A string containing a URL that may be used to access the file.
* If the provided string already contains a preceding 'http', 'https', or
* '/', nothing is done and the same string is returned. If a stream wrapper
* could not be found to generate an external URL, then FALSE is returned.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0.
* Use the appropriate method on \Drupal\Core\File\FileUrlGeneratorInterface
* instead.
*
* @see https://www.drupal.org/node/2940031
* @see https://www.drupal.org/node/515192
* @see \Drupal\Core\File\FileUrlGeneratorInterface::generate()
* @see \Drupal\Core\File\FileUrlGeneratorInterface::generateString()
* @see \Drupal\Core\File\FileUrlGeneratorInterface::generateAbsoluteString()
* @see \Drupal\Core\File\FileUrlGeneratorInterface::transformRelative()
*/
function file_create_url($uri) {
@trigger_error('file_create_url() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the appropriate method on \Drupal\Core\File\FileUrlGeneratorInterface instead. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
if (is_null($uri)) {
return NULL;
}
try {
return \Drupal::service('file_url_generator')->generateAbsoluteString($uri);
}
catch (InvalidStreamWrapperException $e) {
return FALSE;
}
}
/**
* Transforms an absolute URL of a local file to a relative URL.
*
* May be useful to prevent problems on multisite set-ups and prevent mixed
* content errors when using HTTPS + HTTP.
*
* @param string $file_url
* A file URL of a local file as generated by
* FileUrlGeneratorInterface::generateString().
*
* @return string
* If the file URL indeed pointed to a local file and was indeed absolute,
* then the transformed, relative URL to the local file. Otherwise: the
* original value of $file_url.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0.
* Use \Drupal\Core\File\FileUrlGenerator::transformRelative() instead.
*
* @see https://www.drupal.org/node/2940031
* @see \Drupal\Core\File\FileUrlGeneratorInterface::transformRelative()
*/
function file_url_transform_relative($file_url) {
@trigger_error('file_url_transform_relative() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\File\FileUrlGenerator::transformRelative() instead. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
return \Drupal::service('file_url_generator')->transformRelative($file_url);
}
/**
* Constructs a URI to Drupal's default files location given a relative path.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0 without
* replacement.
*
* @see https://www.drupal.org/node/3223091
*/
function file_build_uri($path) {
@trigger_error('file_build_uri() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0 without replacement. See https://www.drupal.org/node/3223091', E_USER_DEPRECATED);
$uri = \Drupal::config('system.file')->get('default_scheme') . '://' . $path;
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
return $stream_wrapper_manager->normalizeUri($uri);
}
/**
* Modifies a filename as needed for security purposes.
*
* Munging a file name prevents unknown file extensions from masking exploit
* files. When web servers such as Apache decide how to process a URL request,
* they use the file extension. If the extension is not recognized, Apache
* skips that extension and uses the previous file extension. For example, if
* the file being requested is exploit.php.pps, and Apache does not recognize
* the '.pps' extension, it treats the file as PHP and executes it. To make
* this file name safe for Apache and prevent it from executing as PHP, the
* .php extension is "munged" into .php_, making the safe file name
* exploit.php_.pps.
*
* Specifically, this function adds an underscore to all extensions that are
* between 2 and 5 characters in length, internal to the file name, and either
* included in the list of unsafe extensions, or not included in $extensions.
*
* Function behavior is also controlled by the configuration
* 'system.file:allow_insecure_uploads'. If it evaluates to TRUE, no alterations
* will be made, if it evaluates to FALSE, the filename is 'munged'. *
* @param $filename
* File name to modify.
* @param $extensions
* A space-separated list of extensions that should not be altered. Note that
* extensions that are unsafe will be altered regardless of this parameter.
* @param $alerts
* If TRUE, \Drupal::messenger()->addStatus() will be called to display
* a message if the file name was changed.
*
* @return string
* The potentially modified $filename.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Dispatch a
* \Drupal\Core\File\Event\FileUploadSanitizeNameEvent event instead.
*
* @see https://www.drupal.org/node/3032541
*/
function file_munge_filename($filename, $extensions, $alerts = TRUE) {
@trigger_error('file_munge_filename() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Dispatch a \Drupal\Core\File\Event\FileUploadSanitizeNameEvent event instead. See https://www.drupal.org/node/3032541', E_USER_DEPRECATED);
$original = $filename;
// Allow potentially insecure uploads for very savvy users and admin
if (!\Drupal::config('system.file')->get('allow_insecure_uploads')) {
// Remove any null bytes. See
// http://php.net/manual/security.filesystem.nullbytes.php
$filename = str_replace(chr(0), '', $filename);
$allowed_extensions = array_unique(explode(' ', strtolower(trim($extensions))));
// Remove unsafe extensions from the allowed list of extensions.
$allowed_extensions = array_diff($allowed_extensions, FileSystemInterface::INSECURE_EXTENSIONS);
// Split the filename up by periods. The first part becomes the basename
// the last part the final extension.
$filename_parts = explode('.', $filename);
// Remove file basename.
$new_filename = array_shift($filename_parts);
// Remove final extension.
$final_extension = array_pop($filename_parts);
// Loop through the middle parts of the name and add an underscore to the
// end of each section that could be a file extension but isn't in the list
// of allowed extensions.
foreach ($filename_parts as $filename_part) {
$new_filename .= '.' . $filename_part;
if (!in_array(strtolower($filename_part), $allowed_extensions) && preg_match("/^[a-zA-Z]{2,5}\d?$/", $filename_part)) {
$new_filename .= '_';
}
}
$filename = $new_filename . '.' . $final_extension;
if ($alerts && $original != $filename) {
\Drupal::messenger()->addStatus(t('For security reasons, your upload has been renamed to %filename.', ['%filename' => $filename]));
}
}
return $filename;
}
/**
* Undoes the effect of file_munge_filename().
*
* @param $filename
* String with the filename to be unmunged.
*
* @return
* An unmunged filename string.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use
* str_replace() instead.
*
* @see https://www.drupal.org/node/3032541
*/
function file_unmunge_filename($filename) {
@trigger_error('file_unmunge_filename() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use str_replace() instead. See https://www.drupal.org/node/3032541', E_USER_DEPRECATED);
return str_replace('_.', '.', $filename);
}
/**
* @} End of "defgroup file".
*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
<?php
// phpcs:ignoreFile
namespace GuzzleHttp;
/**
* Generates URL-encoded query string.
*
* This shim exists to make Guzzle 6 PHP 8.1 compatible.
*
* @link https://php.net/manual/en/function.http-build-query.php
*
* @param object|array $data
* May be an array or object containing properties.
* @param string|null $numeric_prefix
* (optional) If numeric indices are used in the base array and this parameter
* is provided, it will be prepended to the numeric index for elements in
* the base array only.
* @param string|null $arg_separator [optional] <p>
* (optional) arg_separator.output is used to separate arguments, unless this
* parameter is specified, and is then used.
* @param int $encoding_type
* (optional) By default, PHP_QUERY_RFC1738.
*
* @return string
* A URL-encoded string.
*/
function http_build_query($data, $numeric_prefix = '', $arg_separator = '&', $encoding_type = \PHP_QUERY_RFC1738) {
return \http_build_query($data, is_null($numeric_prefix) ? '' : $numeric_prefix, $arg_separator, $encoding_type);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
<?php
/**
* @file
* API for the Drupal menu system.
*/
/**
* @addtogroup menu
* @{
*/
/**
* Returns an array containing the names of system-defined (default) menus.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\system\Entity\Menu::loadMultiple() instead.
*
* @see https://www.drupal.org/node/3027453
*/
function menu_list_system_menus() {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/3027453', E_USER_DEPRECATED);
return [
'tools' => 'Tools',
'admin' => 'Administration',
'account' => 'User account menu',
'main' => 'Main navigation',
'footer' => 'Footer menu',
];
}
/**
* @} End of "addtogroup menu".
*/

View File

@ -0,0 +1,166 @@
<?php
/**
* @file
* API for loading and interacting with Drupal modules.
*/
use Drupal\Core\Extension\ExtensionDiscovery;
/**
* Loads a module's installation hooks.
*
* @param $module
* The name of the module (without the .module extension).
*
* @return
* The name of the module's install file, if successful; FALSE otherwise.
*/
function module_load_install($module) {
// Make sure the installation API is available
include_once __DIR__ . '/install.inc';
return module_load_include('install', $module);
}
/**
* Loads a module include file.
*
* Examples:
* @code
* // Load node.admin.inc from the node module.
* module_load_include('inc', 'node', 'node.admin');
* // Load content_types.inc from the node module.
* module_load_include('inc', 'node', 'content_types');
* @endcode
*
* Do not use this function to load an install file, use module_load_install()
* instead. Do not use this function in a global context since it requires
* Drupal to be fully bootstrapped, use require_once DRUPAL_ROOT . '/path/file'
* instead.
*
* @param $type
* The include file's type (file extension).
* @param $module
* The module to which the include file belongs.
* @param $name
* (optional) The base file name (without the $type extension). If omitted,
* $module is used; i.e., resulting in "$module.$type" by default.
*
* @return
* The name of the included file, if successful; FALSE otherwise.
*
* @todo The module_handler service has a loadInclude() method which performs
* this same task but only for enabled modules. Figure out a way to move this
* functionality entirely into the module_handler while keeping the ability to
* load the files of disabled modules.
*/
function module_load_include($type, $module, $name = NULL) {
if (!isset($name)) {
$name = $module;
}
if (\Drupal::hasService('extension.list.module')) {
/** @var \Drupal\Core\Extension\ModuleExtensionList $module_list */
$module_list = \Drupal::service('extension.list.module');
$file = DRUPAL_ROOT . '/' . $module_list->getPath($module) . "/$name.$type";
if (is_file($file)) {
require_once $file;
return $file;
}
}
return FALSE;
}
/**
* Returns an array of modules required by core.
*/
function drupal_required_modules() {
$listing = new ExtensionDiscovery(\Drupal::root());
$files = $listing->scan('module');
$required = [];
// Unless called by the installer, an installation profile is required and
// must always be loaded.
if ($profile = \Drupal::installProfile()) {
$required[] = $profile;
}
foreach ($files as $name => $file) {
$info = \Drupal::service('info_parser')->parse($file->getPathname());
if (!empty($info) && !empty($info['required']) && $info['required']) {
$required[] = $name;
}
}
return $required;
}
/**
* Sets weight of a particular module.
*
* The weight of uninstalled modules cannot be changed.
*
* @param string $module
* The name of the module (without the .module extension).
* @param int $weight
* An integer representing the weight of the module.
*/
function module_set_weight($module, $weight) {
$extension_config = \Drupal::configFactory()->getEditable('core.extension');
if ($extension_config->get("module.$module") !== NULL) {
// Pre-cast the $weight to an integer so that we can save this without using
// schema. This is a performance improvement for module installation.
$extension_config
->set("module.$module", (int) $weight)
->set('module', module_config_sort($extension_config->get('module')))
->save(TRUE);
// Prepare the new module list, sorted by weight, including filenames.
// @see \Drupal\Core\Extension\ModuleInstaller::install()
$module_handler = \Drupal::moduleHandler();
$current_module_filenames = $module_handler->getModuleList();
$current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
$current_modules = module_config_sort(array_merge($current_modules, $extension_config->get('module')));
$module_filenames = [];
foreach ($current_modules as $name => $weight) {
$module_filenames[$name] = $current_module_filenames[$name];
}
// Update the module list in the extension handler.
$module_handler->setModuleList($module_filenames);
return;
}
}
/**
* Sorts the configured list of enabled modules.
*
* The list of enabled modules is expected to be ordered by weight and name.
* The list is always sorted on write to avoid the overhead on read.
*
* @param array $data
* An array of module configuration data.
*
* @return array
* An array of module configuration data sorted by weight and name.
*/
function module_config_sort($data) {
// PHP array sorting functions such as uasort() do not work with both keys and
// values at the same time, so we achieve weight and name sorting by computing
// strings with both information concatenated (weight first, name second) and
// use that as a regular string sort reference list via array_multisort(),
// compound of "[sign-as-integer][padded-integer-weight][name]"; e.g., given
// two modules and weights (spaces added for clarity):
// - Block with weight -5: 0 0000000000000000005 block
// - Node with weight 0: 1 0000000000000000000 node
$sort = [];
foreach ($data as $name => $weight) {
// Prefix negative weights with 0, positive weights with 1.
// +/- signs cannot be used, since + (ASCII 43) is before - (ASCII 45).
$prefix = (int) ($weight >= 0);
// The maximum weight is PHP_INT_MAX, so pad all weights to 19 digits.
$sort[] = $prefix . sprintf('%019d', abs($weight)) . $name;
}
array_multisort($sort, SORT_STRING, $data);
return $data;
}

View File

@ -0,0 +1,223 @@
<?php
/**
* @file
* Schema API handling functions.
*/
use Drupal\Core\Update\UpdateHookRegistry;
/**
* @addtogroup schemaapi
* @{
*/
/**
* Indicates that a module has not been installed yet.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\Core\Update\UpdateHookRegistry::SCHEMA_UNINSTALLED constant
* instead.
*
* @see https://www.drupal.org/node/2444417
*/
const SCHEMA_UNINSTALLED = UpdateHookRegistry::SCHEMA_UNINSTALLED;
/**
* Returns an array of available schema versions for a module.
*
* @param string $module
* A module name.
*
* @return array|bool
* If the module has updates, an array of available updates sorted by
* version. Otherwise, FALSE.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0.
* Use \Drupal\Core\Update\SchemaDataInterface::getAvailableUpdates() instead.
*
* @see https://www.drupal.org/node/2444417
* @see \Drupal\Core\Update\UpdateHookRegistry::getAvailableUpdates()
*/
function drupal_get_schema_versions($module) {
@trigger_error('drupal_get_schema_versions() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::getAvailableUpdates() instead. See https://www.drupal.org/node/2444417', E_USER_DEPRECATED);
return \Drupal::service('update.update_hook_registry')->getAvailableUpdates($module);
}
/**
* Returns the currently installed schema version for a module.
*
* @param string $module
* A module name.
* @param bool $reset
* Set to TRUE after installing or uninstalling an extension.
* @param bool $array
* Set to TRUE if you want to get information about all modules in the
* system.
*
* @return string|int
* The currently installed schema version, or SCHEMA_UNINSTALLED if the
* module is not installed.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0.
* Use \Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion() or
* \Drupal\Core\Update\UpdateHookRegistry::getAllInstalledVersions()
* instead.
*
* @see https://www.drupal.org/node/2444417
* @see \Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion()
*/
function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
@trigger_error('drupal_get_installed_schema_version() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion() or \Drupal\Core\Update\UpdateHookRegistry::getAllInstalledVersions() instead. See https://www.drupal.org/node/2444417', E_USER_DEPRECATED);
/** @var \Drupal\Core\Update\UpdateHookRegistry $service */
$service = \Drupal::service('update.update_hook_registry');
if ($array) {
return $service->getAllInstalledVersions();
}
return $service->getInstalledVersion((string) $module);
}
/**
* Updates the installed version information for a module.
*
* @param string $module
* A module name.
* @param string $version
* The new schema version.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0.
* Use \Drupal\Core\Update\UpdateHookRegistry::setInstalledVersion()
* instead.
*
* @see https://www.drupal.org/node/2444417
* @see \Drupal\Core\Update\UpdateHookRegistry::setInstalledVersion()
*/
function drupal_set_installed_schema_version($module, $version) {
@trigger_error('drupal_set_installed_schema_version() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::setInstalledVersion() instead. See https://www.drupal.org/node/2444417', E_USER_DEPRECATED);
\Drupal::service('update.update_hook_registry')->setInstalledVersion($module, $version);
}
/**
* Creates all tables defined in a module's hook_schema().
*
* @param string $module
* The module for which the tables will be created.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/2970993
* @see \Drupal\Core\Extension\ModuleInstaller::installSchema()
*/
function drupal_install_schema($module) {
@trigger_error('drupal_install_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
$schema = drupal_get_module_schema($module);
_drupal_schema_initialize($schema, $module, FALSE);
foreach ($schema as $name => $table) {
\Drupal::database()->schema()->createTable($name, $table);
}
}
/**
* Removes all tables defined in a module's hook_schema().
*
* @param string $module
* The module for which the tables will be removed.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/2970993
* @see \Drupal\Core\Extension\ModuleInstaller::uninstallSchema()
*/
function drupal_uninstall_schema($module) {
@trigger_error('drupal_uninstall_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
$tables = drupal_get_module_schema($module);
_drupal_schema_initialize($tables, $module, FALSE);
$schema = \Drupal::database()->schema();
foreach ($tables as $table) {
if ($schema->tableExists($table['name'])) {
$schema->dropTable($table['name']);
}
}
}
/**
* Returns a module's schema.
*
* This function can be used to retrieve a schema specification in
* hook_schema(), so it allows you to derive your tables from existing
* specifications.
*
* @param string $module
* The module to which the table belongs.
* @param string $table
* The name of the table. If not given, the module's complete schema
* is returned.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided. Testing classes could use
* \Drupal\TestTools\Extension\SchemaInspector for introspection.
*
* @see https://www.drupal.org/node/2970993
* @see \Drupal\TestTools\Extension\SchemaInspector::getTablesSpecification()
*/
function drupal_get_module_schema($module, $table = NULL) {
@trigger_error('drupal_get_module_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. Testing classes could use \Drupal\TestTools\Extension\SchemaInspector for introspection. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
// Load the .install file to get hook_schema.
module_load_install($module);
$schema = \Drupal::moduleHandler()->invoke($module, 'schema');
if (isset($table)) {
if (isset($schema[$table])) {
return $schema[$table];
}
return [];
}
elseif (!empty($schema)) {
return $schema;
}
return [];
}
/**
* Fills in required default values for table definitions from hook_schema().
*
* @param array $schema
* The schema definition array as it was returned by the module's
* hook_schema().
* @param string $module
* The module for which hook_schema() was invoked.
* @param bool $remove_descriptions
* (optional) Whether to additionally remove 'description' keys of all tables
* and fields to improve performance of serialize() and unserialize().
* Defaults to TRUE.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/2970993
*/
function _drupal_schema_initialize(&$schema, $module, $remove_descriptions = TRUE) {
@trigger_error('_drupal_schema_initialize() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
// Set the name and module key for all tables.
foreach ($schema as $name => &$table) {
if (empty($table['module'])) {
$table['module'] = $module;
}
if (!isset($table['name'])) {
$table['name'] = $name;
}
if ($remove_descriptions) {
unset($table['description']);
foreach ($table['fields'] as &$field) {
unset($field['description']);
}
}
}
}
/**
* @} End of "addtogroup schemaapi".
*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,135 @@
<?php
/**
* @file
* Theming for maintenance pages.
*/
use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Site\Settings;
/**
* Sets up the theming system for maintenance page.
*
* Used for site installs, updates and when the site is in maintenance mode.
* It also applies when the database is unavailable or bootstrap was not
* complete. Seven is always used for the initial install and update
* operations. In other cases, Bartik is used, but this can be overridden by
* setting a "maintenance_theme" key in the $settings variable in settings.php.
*/
function _drupal_maintenance_theme() {
// If the theme is already set, assume the others are set too, and do nothing.
if (\Drupal::theme()->hasActiveTheme()) {
return;
}
require_once __DIR__ . '/theme.inc';
require_once __DIR__ . '/common.inc';
require_once __DIR__ . '/file.inc';
require_once __DIR__ . '/module.inc';
// Install and update pages are treated differently to prevent theming overrides.
if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) {
if (InstallerKernel::installationAttempted()) {
$custom_theme = $GLOBALS['install_state']['theme'];
}
else {
$custom_theme = Settings::get('maintenance_theme', 'seven');
}
}
else {
// Use the maintenance theme if specified, otherwise attempt to use the
// default site theme.
try {
$custom_theme = Settings::get('maintenance_theme', '');
if (!$custom_theme) {
$config = \Drupal::config('system.theme');
$custom_theme = $config->get('default');
}
}
catch (\Exception $e) {
// Whatever went wrong (often a database connection problem), we are
// about to fall back to a sensible theme so there is no need for special
// handling.
}
if (!$custom_theme) {
// We have been unable to identify the configured theme, so fall back to
// a safe default. Bartik is reasonably user friendly and fairly generic.
$custom_theme = 'bartik';
}
}
$themes = \Drupal::service('theme_handler')->listInfo();
// If no themes are installed yet, or if the requested custom theme is not
// installed, retrieve all available themes.
/** @var \Drupal\Core\Theme\ThemeInitialization $theme_init */
$theme_init = \Drupal::service('theme.initialization');
$theme_handler = \Drupal::service('theme_handler');
if (empty($themes) || !isset($themes[$custom_theme])) {
$themes = \Drupal::service('extension.list.theme')->getList();
$theme_handler->addTheme($themes[$custom_theme]);
}
// \Drupal\Core\Extension\ThemeHandlerInterface::listInfo() triggers a
// \Drupal\Core\Extension\ModuleHandler::alter() in maintenance mode, but we
// can't let themes alter the .info.yml data until we know a theme's base
// themes. So don't set active theme until after
// \Drupal\Core\Extension\ThemeHandlerInterface::listInfo() builds its cache.
$theme = $custom_theme;
// Find all our ancestor themes and put them in an array.
// @todo This is just a workaround. Find a better way how to handle themes
// on maintenance pages, see https://www.drupal.org/node/2322619.
// This code is basically a duplicate of
// \Drupal\Core\Theme\ThemeInitialization::getActiveThemeByName.
$base_themes = [];
$ancestor = $theme;
while ($ancestor && isset($themes[$ancestor]->base_theme)) {
$base_themes[] = $themes[$themes[$ancestor]->base_theme];
$ancestor = $themes[$ancestor]->base_theme;
if ($ancestor) {
// Ensure that the base theme is added and installed.
$theme_handler->addTheme($themes[$ancestor]);
}
}
\Drupal::theme()->setActiveTheme($theme_init->getActiveTheme($themes[$custom_theme], $base_themes));
// Prime the theme registry.
Drupal::service('theme.registry');
}
/**
* Prepares variables for authorize.php operation report templates.
*
* This report displays the results of an operation run via authorize.php.
*
* Default template: authorize-report.html.twig.
*
* @param array $variables
* An associative array containing:
* - messages: An array of result messages.
*/
function template_preprocess_authorize_report(&$variables) {
$messages = [];
if (!empty($variables['messages'])) {
foreach ($variables['messages'] as $heading => $logs) {
$items = [];
foreach ($logs as $number => $log_message) {
if ($number === '#abort') {
continue;
}
$class = 'authorize-results__' . ($log_message['success'] ? 'success' : 'failure');
$items[] = [
'#wrapper_attributes' => ['class' => [$class]],
'#markup' => $log_message['message'],
];
}
$messages[] = [
'#theme' => 'item_list',
'#items' => $items,
'#title' => $heading,
];
}
}
$variables['messages'] = $messages;
}

View File

@ -0,0 +1,752 @@
<?php
/**
* @file
* Drupal database update API.
*
* This file contains functions to perform database updates for a Drupal
* installation. It is included and used extensively by update.php.
*/
use Drupal\Component\Graph\Graph;
use Drupal\Core\Extension\Exception\UnknownExtensionException;
use Drupal\Core\Utility\Error;
/**
* Tests the compatibility of a module or theme.
*
* @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/3150727
* @see \Drupal\Core\Extension\ExtensionList::checkIncompatibility()
*/
function update_check_incompatibility($name, $type = 'module') {
@trigger_error('update_check_incompatibility() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3150727', E_USER_DEPRECATED);
static $themes, $modules;
// Store values of expensive functions for future use.
if (empty($themes) || empty($modules)) {
// We need to do a full rebuild here to make sure the database reflects any
// code changes that were made in the filesystem before the update script
// was initiated.
$themes = \Drupal::service('theme_handler')->rebuildThemeData();
$modules = \Drupal::service('extension.list.module')->reset()->getList();
}
if ($type == 'module' && isset($modules[$name])) {
$file = $modules[$name];
}
elseif ($type == 'theme' && isset($themes[$name])) {
$file = $themes[$name];
}
if (!isset($file)
|| $file->info['core_incompatible']
|| version_compare(phpversion(), $file->info['php']) < 0) {
return TRUE;
}
return FALSE;
}
/**
* Returns whether the minimum schema requirement has been satisfied.
*
* @return array
* A requirements info array.
*/
function update_system_schema_requirements() {
$requirements = [];
$system_schema = \Drupal::service('update.update_hook_registry')->getInstalledVersion('system');
$requirements['minimum schema']['title'] = 'Minimum schema version';
if ($system_schema >= \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
$requirements['minimum schema'] += [
'value' => 'The installed schema version meets the minimum.',
'description' => 'Schema version: ' . $system_schema,
];
}
else {
$requirements['minimum schema'] += [
'value' => 'The installed schema version does not meet the minimum.',
'severity' => REQUIREMENT_ERROR,
'description' => 'Your system schema version is ' . $system_schema . '. Updating directly from a schema version prior to 8000 is not supported. You must upgrade your site to Drupal 8 first, see https://www.drupal.org/docs/8/upgrade.',
];
}
return $requirements;
}
/**
* Checks update requirements and reports errors and (optionally) warnings.
*/
function update_check_requirements() {
// Because this is one of the earliest points in the update process,
// detect and fix missing schema versions for modules here to ensure
// it runs on all update code paths.
_update_fix_missing_schema();
// Check requirements of all loaded modules.
$requirements = \Drupal::moduleHandler()->invokeAll('requirements', ['update']);
$requirements += update_system_schema_requirements();
return $requirements;
}
/**
* Helper to detect and fix 'missing' schema information.
*
* Repairs the case where a module has no schema version recorded.
* This has to be done prior to updates being run, otherwise the update
* system would detect and attempt to run all historical updates for a
* module.
*
* @todo: remove in a major version after
* https://www.drupal.org/project/drupal/issues/3130037 has been fixed.
*/
function _update_fix_missing_schema() {
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
$update_registry = \Drupal::service('update.update_hook_registry');
$versions = $update_registry->getAllInstalledVersions();
$module_handler = \Drupal::moduleHandler();
$enabled_modules = $module_handler->getModuleList();
foreach (array_keys($enabled_modules) as $module) {
// All modules should have a recorded schema version, but when they
// don't, detect and fix the problem.
if (!isset($versions[$module])) {
// Ensure the .install file is loaded.
module_load_install($module);
$all_updates = $update_registry->getAvailableUpdates($module);
// If the schema version of a module hasn't been recorded, we cannot
// know the actual schema version a module is at, because
// no updates will ever have been run on the site and it was not set
// correctly when the module was installed, so instead set it to
// the same as the last update. This means that updates will proceed
// again the next time the module is updated and a new update is
// added. Updates added in between the module being installed and the
// schema version being fixed here (if any have been added) will never
// be run, but we have no way to identify which updates these are.
if ($all_updates) {
$last_update = max($all_updates);
}
else {
$last_update = \Drupal::CORE_MINIMUM_SCHEMA_VERSION;
}
// If the module implements hook_update_last_removed() use the
// value of that if it's higher than the schema versions found so
// far.
if ($last_removed = $module_handler->invoke($module, 'update_last_removed')) {
$last_update = max($last_update, $last_removed);
}
$update_registry->setInstalledVersion($module, $last_update);
$args = ['%module' => $module, '%last_update_hook' => $module . '_update_' . $last_update . '()'];
\Drupal::messenger()->addWarning(t('Schema information for module %module was missing from the database. You should manually review the module updates and your database to check if any updates have been skipped up to, and including, %last_update_hook.', $args));
\Drupal::logger('update')->warning('Schema information for module %module was missing from the database. You should manually review the module updates and your database to check if any updates have been skipped up to, and including, %last_update_hook.', $args);
}
}
}
/**
* Forces a module to a given schema version.
*
* This function is rarely necessary.
*
* @param string $module
* Name of the module.
* @param string $schema_version
* The schema version the module should be set to.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/3210925
*/
function update_set_schema($module, $schema_version) {
@trigger_error('update_set_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3210925', E_USER_DEPRECATED);
\Drupal::service('update.update_hook_registry')->setInstalledVersion($module, $schema_version);
\Drupal::service('extension.list.profile')->reset();
\Drupal::service('extension.list.module')->reset();
\Drupal::service('extension.list.theme_engine')->reset();
\Drupal::service('extension.list.theme')->reset();
}
/**
* Implements callback_batch_operation().
*
* Performs one update and stores the results for display on the results page.
*
* If an update function completes successfully, it should return a message
* as a string indicating success, for example:
* @code
* return t('New index added successfully.');
* @endcode
*
* Alternatively, it may return nothing. In that case, no message
* will be displayed at all.
*
* If it fails for whatever reason, it should throw an instance of
* Drupal\Core\Utility\UpdateException with an appropriate error message, for
* example:
* @code
* use Drupal\Core\Utility\UpdateException;
* throw new UpdateException('Description of what went wrong');
* @endcode
*
* If an exception is thrown, the current update and all updates that depend on
* it will be aborted. The schema version will not be updated in this case, and
* all the aborted updates will continue to appear on update.php as updates
* that have not yet been run.
*
* If an update function needs to be re-run as part of a batch process, it
* should accept the $sandbox array by reference as its first parameter
* and set the #finished property to the percentage completed that it is, as a
* fraction of 1.
*
* @param $module
* The module whose update will be run.
* @param $number
* The update number to run.
* @param $dependency_map
* An array whose keys are the names of all update functions that will be
* performed during this batch process, and whose values are arrays of other
* update functions that each one depends on.
* @param $context
* The batch context array.
*
* @see update_resolve_dependencies()
*/
function update_do_one($module, $number, $dependency_map, &$context) {
$function = $module . '_update_' . $number;
// If this update was aborted in a previous step, or has a dependency that
// was aborted in a previous step, go no further.
if (!empty($context['results']['#abort']) && array_intersect($context['results']['#abort'], array_merge($dependency_map, [$function]))) {
return;
}
$ret = [];
if (function_exists($function)) {
try {
$ret['results']['query'] = $function($context['sandbox']);
$ret['results']['success'] = TRUE;
}
// @TODO We may want to do different error handling for different
// exception types, but for now we'll just log the exception and
// return the message for printing.
// @see https://www.drupal.org/node/2564311
catch (Exception $e) {
watchdog_exception('update', $e);
$variables = Error::decodeException($e);
unset($variables['backtrace'], $variables['exception'], $variables['severity_level']);
$ret['#abort'] = ['success' => FALSE, 'query' => t('%type: @message in %function (line %line of %file).', $variables)];
}
}
if (isset($context['sandbox']['#finished'])) {
$context['finished'] = $context['sandbox']['#finished'];
unset($context['sandbox']['#finished']);
}
if (!isset($context['results'][$module])) {
$context['results'][$module] = [];
}
if (!isset($context['results'][$module][$number])) {
$context['results'][$module][$number] = [];
}
$context['results'][$module][$number] = array_merge($context['results'][$module][$number], $ret);
if (!empty($ret['#abort'])) {
// Record this function in the list of updates that were aborted.
$context['results']['#abort'][] = $function;
}
// Record the schema update if it was completed successfully.
if ($context['finished'] == 1 && empty($ret['#abort'])) {
\Drupal::service('update.update_hook_registry')->setInstalledVersion($module, $number);
}
$context['message'] = t('Updating @module', ['@module' => $module]);
}
/**
* Executes a single hook_post_update_NAME().
*
* @param string $function
* The function name, that should be executed.
* @param array $context
* The batch context array.
*/
function update_invoke_post_update($function, &$context) {
$ret = [];
// If this update was aborted in a previous step, or has a dependency that was
// aborted in a previous step, go no further.
if (!empty($context['results']['#abort'])) {
return;
}
[$module, $name] = explode('_post_update_', $function, 2);
module_load_include('php', $module, $module . '.post_update');
if (function_exists($function)) {
try {
$ret['results']['query'] = $function($context['sandbox']);
$ret['results']['success'] = TRUE;
if (!isset($context['sandbox']['#finished']) || (isset($context['sandbox']['#finished']) && $context['sandbox']['#finished'] >= 1)) {
\Drupal::service('update.post_update_registry')->registerInvokedUpdates([$function]);
}
}
// @TODO We may want to do different error handling for different exception
// types, but for now we'll just log the exception and return the message
// for printing.
// @see https://www.drupal.org/node/2564311
catch (Exception $e) {
watchdog_exception('update', $e);
$variables = Error::decodeException($e);
unset($variables['backtrace'], $variables['exception']);
$ret['#abort'] = [
'success' => FALSE,
'query' => t('%type: @message in %function (line %line of %file).', $variables),
];
}
}
if (isset($context['sandbox']['#finished'])) {
$context['finished'] = $context['sandbox']['#finished'];
unset($context['sandbox']['#finished']);
}
if (!isset($context['results'][$module][$name])) {
$context['results'][$module][$name] = [];
}
$context['results'][$module][$name] = array_merge($context['results'][$module][$name], $ret);
if (!empty($ret['#abort'])) {
// Record this function in the list of updates that were aborted.
$context['results']['#abort'][] = $function;
}
$context['message'] = t('Post updating @module', ['@module' => $module]);
}
/**
* Returns a list of all the pending database updates.
*
* @return
* An associative array keyed by module name which contains all information
* about database updates that need to be run, and any updates that are not
* going to proceed due to missing requirements. The system module will
* always be listed first.
*
* The subarray for each module can contain the following keys:
* - start: The starting update that is to be processed. If this does not
* exist then do not process any updates for this module as there are
* other requirements that need to be resolved.
* - warning: Any warnings about why this module can not be updated.
* - pending: An array of all the pending updates for the module including
* the update number and the description from source code comment for
* each update function. This array is keyed by the update number.
*/
function update_get_update_list() {
// Make sure that the system module is first in the list of updates.
$ret = ['system' => []];
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
$update_registry = \Drupal::service('update.update_hook_registry');
$modules = $update_registry->getAllInstalledVersions();
/** @var \Drupal\Core\Extension\ExtensionList $extension_list */
$extension_list = \Drupal::service('extension.list.module');
/** @var array $installed_module_info */
$installed_module_info = $extension_list->getAllInstalledInfo();
foreach ($modules as $module => $schema_version) {
// Skip uninstalled and incompatible modules.
try {
if ($schema_version == $update_registry::SCHEMA_UNINSTALLED || $extension_list->checkIncompatibility($module)) {
continue;
}
}
// It is possible that the system schema has orphaned entries, so the
// incompatibility checking might throw an exception.
catch (UnknownExtensionException $e) {
$args = [
'%name' => $module,
':url' => 'https://www.drupal.org/node/3137656',
];
\Drupal::messenger()->addWarning(t('Module %name has an entry in the system.schema key/value storage, but is missing from your site. <a href=":url">More information about this error</a>.', $args));
\Drupal::logger('system')->notice('Module %name has an entry in the system.schema key/value storage, but is missing from your site. <a href=":url">More information about this error</a>.', $args);
continue;
}
// There might be orphaned entries for modules that are in the filesystem
// but not installed. Also skip those, but warn site admins about it.
if (empty($installed_module_info[$module])) {
$args = [
'%name' => $module,
':url' => 'https://www.drupal.org/node/3137656',
];
\Drupal::messenger()->addWarning(t('Module %name has an entry in the system.schema key/value storage, but is not installed. <a href=":url">More information about this error</a>.', $args));
\Drupal::logger('system')->notice('Module %name has an entry in the system.schema key/value storage, but is not installed. <a href=":url">More information about this error</a>.', $args);
continue;
}
// Display a requirements error if the user somehow has a schema version
// from the previous Drupal major version.
if ($schema_version < \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
$ret[$module]['warning'] = '<em>' . $module . '</em> module cannot be updated. Its schema version is ' . $schema_version . ', which is from an earlier major release of Drupal. See the <a href="https://www.drupal.org/docs/upgrading-drupal">Upgrading Drupal guide</a>.';
continue;
}
// Otherwise, get the list of updates defined by this module.
$updates = $update_registry->getAvailableUpdates($module);
if ($updates) {
foreach ($updates as $update) {
if ($update == \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
$ret[$module]['warning'] = '<em>' . $module . '</em> module cannot be updated. It contains an update numbered as ' . \Drupal::CORE_MINIMUM_SCHEMA_VERSION . ' which is reserved for the earliest installation of a module in Drupal ' . \Drupal::CORE_COMPATIBILITY . ', before any updates. In order to update <em>' . $module . '</em> module, you will need to install a version of the module with valid updates.';
continue 2;
}
if ($update > $schema_version) {
// The description for an update comes from its Doxygen.
$func = new ReflectionFunction($module . '_update_' . $update);
$patterns = [
'/^\s*[\/*]*/',
'/(\n\s*\**)(.*)/',
'/\/$/',
'/^\s*/',
];
$replacements = ['', '$2', '', ''];
$description = preg_replace($patterns, $replacements, $func->getDocComment());
$ret[$module]['pending'][$update] = "$update - $description";
if (!isset($ret[$module]['start'])) {
$ret[$module]['start'] = $update;
}
}
}
if (!isset($ret[$module]['start']) && isset($ret[$module]['pending'])) {
$ret[$module]['start'] = $schema_version;
}
}
}
if (empty($ret['system'])) {
unset($ret['system']);
}
return $ret;
}
/**
* Resolves dependencies in a set of module updates, and orders them correctly.
*
* This function receives a list of requested module updates and determines an
* appropriate order to run them in such that all update dependencies are met.
* Any updates whose dependencies cannot be met are included in the returned
* array but have the key 'allowed' set to FALSE; the calling function should
* take responsibility for ensuring that these updates are ultimately not
* performed.
*
* In addition, the returned array also includes detailed information about the
* dependency chain for each update, as provided by the depth-first search
* algorithm in Drupal\Component\Graph\Graph::searchAndSort().
*
* @param $starting_updates
* An array whose keys contain the names of modules with updates to be run
* and whose values contain the number of the first requested update for that
* module.
*
* @return
* An array whose keys are the names of all update functions within the
* provided modules that would need to be run in order to fulfill the
* request, arranged in the order in which the update functions should be
* run. (This includes the provided starting update for each module and all
* subsequent updates that are available.) The values are themselves arrays
* containing all the keys provided by the
* Drupal\Component\Graph\Graph::searchAndSort() algorithm, which encode
* detailed information about the dependency chain for this update function
* (for example: 'paths', 'reverse_paths', 'weight', and 'component'), as
* well as the following additional keys:
* - 'allowed': A boolean which is TRUE when the update function's
* dependencies are met, and FALSE otherwise. Calling functions should
* inspect this value before running the update.
* - 'missing_dependencies': An array containing the names of any other
* update functions that are required by this one but that are unavailable
* to be run. This array will be empty when 'allowed' is TRUE.
* - 'module': The name of the module that this update function belongs to.
* - 'number': The number of this update function within that module.
*
* @see \Drupal\Component\Graph\Graph::searchAndSort()
*/
function update_resolve_dependencies($starting_updates) {
// Obtain a dependency graph for the requested update functions.
$update_functions = update_get_update_function_list($starting_updates);
$graph = update_build_dependency_graph($update_functions);
// Perform the depth-first search and sort on the results.
$graph_object = new Graph($graph);
$graph = $graph_object->searchAndSort();
uasort($graph, ['Drupal\Component\Utility\SortArray', 'sortByWeightElement']);
foreach ($graph as $function => &$data) {
$module = $data['module'];
$number = $data['number'];
// If the update function is missing and has not yet been performed, mark
// it and everything that ultimately depends on it as disallowed.
if (update_is_missing($module, $number, $update_functions) && !update_already_performed($module, $number)) {
$data['allowed'] = FALSE;
foreach (array_keys($data['paths']) as $dependent) {
$graph[$dependent]['allowed'] = FALSE;
$graph[$dependent]['missing_dependencies'][] = $function;
}
}
elseif (!isset($data['allowed'])) {
$data['allowed'] = TRUE;
$data['missing_dependencies'] = [];
}
// Now that we have finished processing this function, remove it from the
// graph if it was not part of the original list. This ensures that we
// never try to run any updates that were not specifically requested.
if (!isset($update_functions[$module][$number])) {
unset($graph[$function]);
}
}
return $graph;
}
/**
* Returns an organized list of update functions for a set of modules.
*
* @param $starting_updates
* An array whose keys contain the names of modules and whose values contain
* the number of the first requested update for that module.
*
* @return
* An array containing all the update functions that should be run for each
* module, including the provided starting update and all subsequent updates
* that are available. The keys of the array contain the module names, and
* each value is an ordered array of update functions, keyed by the update
* number.
*
* @see update_resolve_dependencies()
*/
function update_get_update_function_list($starting_updates) {
// Go through each module and find all updates that we need (including the
// first update that was requested and any updates that run after it).
$update_functions = [];
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
$update_registry = \Drupal::service('update.update_hook_registry');
foreach ($starting_updates as $module => $version) {
$update_functions[$module] = [];
$updates = $update_registry->getAvailableUpdates($module);
if ($updates) {
$max_version = max($updates);
if ($version <= $max_version) {
foreach ($updates as $update) {
if ($update >= $version) {
$update_functions[$module][$update] = $module . '_update_' . $update;
}
}
}
}
}
return $update_functions;
}
/**
* Constructs a graph which encodes the dependencies between module updates.
*
* This function returns an associative array which contains a "directed graph"
* representation of the dependencies between a provided list of update
* functions, as well as any outside update functions that they directly depend
* on but that were not in the provided list. The vertices of the graph
* represent the update functions themselves, and each edge represents a
* requirement that the first update function needs to run before the second.
* For example, consider this graph:
*
* system_update_8001 ---> system_update_8002 ---> system_update_8003
*
* Visually, this indicates that system_update_8001() must run before
* system_update_8002(), which in turn must run before system_update_8003().
*
* The function takes into account standard dependencies within each module, as
* shown above (i.e., the fact that each module's updates must run in numerical
* order), but also finds any cross-module dependencies that are defined by
* modules which implement hook_update_dependencies(), and builds them into the
* graph as well.
*
* @param $update_functions
* An organized array of update functions, in the format returned by
* update_get_update_function_list().
*
* @return
* A multidimensional array representing the dependency graph, suitable for
* passing in to Drupal\Component\Graph\Graph::searchAndSort(), but with extra
* information about each update function also included. Each array key
* contains the name of an update function, including all update functions
* from the provided list as well as any outside update functions which they
* directly depend on. Each value is an associative array containing the
* following keys:
* - 'edges': A representation of any other update functions that immediately
* depend on this one. See Drupal\Component\Graph\Graph::searchAndSort() for
* more details on the format.
* - 'module': The name of the module that this update function belongs to.
* - 'number': The number of this update function within that module.
*
* @see \Drupal\Component\Graph\Graph::searchAndSort()
* @see update_resolve_dependencies()
*/
function update_build_dependency_graph($update_functions) {
// Initialize an array that will define a directed graph representing the
// dependencies between update functions.
$graph = [];
// Go through each update function and build an initial list of dependencies.
foreach ($update_functions as $module => $functions) {
$previous_function = NULL;
foreach ($functions as $number => $function) {
// Add an edge to the directed graph representing the fact that each
// update function in a given module must run after the update that
// numerically precedes it.
if ($previous_function) {
$graph[$previous_function]['edges'][$function] = TRUE;
}
$previous_function = $function;
// Define the module and update number associated with this function.
$graph[$function]['module'] = $module;
$graph[$function]['number'] = $number;
}
}
// Now add any explicit update dependencies declared by modules.
$update_dependencies = update_retrieve_dependencies();
foreach ($graph as $function => $data) {
if (!empty($update_dependencies[$data['module']][$data['number']])) {
foreach ($update_dependencies[$data['module']][$data['number']] as $module => $number) {
$dependency = $module . '_update_' . $number;
$graph[$dependency]['edges'][$function] = TRUE;
$graph[$dependency]['module'] = $module;
$graph[$dependency]['number'] = $number;
}
}
}
return $graph;
}
/**
* Determines if a module update is missing or unavailable.
*
* @param $module
* The name of the module.
* @param $number
* The number of the update within that module.
* @param $update_functions
* An organized array of update functions, in the format returned by
* update_get_update_function_list(). This should represent all module
* updates that are requested to run at the time this function is called.
*
* @return
* TRUE if the provided module update is not installed or is not in the
* provided list of updates to run; FALSE otherwise.
*/
function update_is_missing($module, $number, $update_functions) {
return !isset($update_functions[$module][$number]) || !function_exists($update_functions[$module][$number]);
}
/**
* Determines if a module update has already been performed.
*
* @param $module
* The name of the module.
* @param $number
* The number of the update within that module.
*
* @return
* TRUE if the database schema indicates that the update has already been
* performed; FALSE otherwise.
*/
function update_already_performed($module, $number) {
return $number <= \Drupal::service('update.update_hook_registry')->getInstalledVersion($module);
}
/**
* Invokes hook_update_dependencies() in all installed modules.
*
* This function is similar to \Drupal::moduleHandler()->invokeAll(), with the
* main difference that it does not require that a module be enabled to invoke
* its hook, only that it be installed. This allows the update system to
* properly perform updates even on modules that are currently disabled.
*
* @return
* An array of return values obtained by merging the results of the
* hook_update_dependencies() implementations in all installed modules.
*
* @see \Drupal\Core\Extension\ModuleHandlerInterface::invokeAll()
* @see hook_update_dependencies()
*/
function update_retrieve_dependencies() {
$return = [];
/** @var \Drupal\Core\Extension\ModuleExtensionList */
$extension_list = \Drupal::service('extension.list.module');
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
$update_registry = \Drupal::service('update.update_hook_registry');
// Get a list of installed modules, arranged so that we invoke their hooks in
// the same order that \Drupal::moduleHandler()->invokeAll() does.
foreach ($update_registry->getAllInstalledVersions() as $module => $schema) {
// Skip modules that are entirely missing from the filesystem here, since
// module_load_install() will call trigger_error() if invoked on a module
// that doesn't exist. There's no way to catch() that, so avoid it entirely.
// This can happen when there are orphaned entries in the system.schema k/v
// store for modules that have been removed from a site without first being
// cleanly uninstalled. We don't care here if the module has been installed
// or not, since we'll filter those out in update_get_update_list().
if ($schema == $update_registry::SCHEMA_UNINSTALLED || !$extension_list->exists($module)) {
// Nothing to upgrade.
continue;
}
$function = $module . '_update_dependencies';
// Ensure install file is loaded.
module_load_install($module);
if (function_exists($function)) {
$updated_dependencies = $function();
// Each implementation of hook_update_dependencies() returns a
// multidimensional, associative array containing some keys that
// represent module names (which are strings) and other keys that
// represent update function numbers (which are integers). We cannot use
// array_merge_recursive() to properly merge these results, since it
// treats strings and integers differently. Therefore, we have to
// explicitly loop through the expected array structure here and perform
// the merge manually.
if (isset($updated_dependencies) && is_array($updated_dependencies)) {
foreach ($updated_dependencies as $module_name => $module_data) {
foreach ($module_data as $update_version => $update_data) {
foreach ($update_data as $module_dependency => $update_dependency) {
// If there are redundant dependencies declared for the same
// update function (so that it is declared to depend on more than
// one update from a particular module), record the dependency on
// the highest numbered update here, since that automatically
// implies the previous ones. For example, if one module's
// implementation of hook_update_dependencies() required this
// ordering:
//
// system_update_8002 ---> user_update_8001
//
// but another module's implementation of the hook required this
// one:
//
// system_update_8003 ---> user_update_8001
//
// we record the second one, since system_update_8002() is always
// guaranteed to run before system_update_8003() anyway (within
// an individual module, updates are always run in numerical
// order).
if (!isset($return[$module_name][$update_version][$module_dependency]) || $update_dependency > $return[$module_name][$update_version][$module_dependency]) {
$return[$module_name][$update_version][$module_dependency] = $update_dependency;
}
}
}
}
}
}
}
return $return;
}

View File

@ -0,0 +1,50 @@
<?php
/**
* @file
* Miscellaneous functions.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
/**
* Rebuilds all caches even when Drupal itself does not work.
*
* @param $class_loader
* The class loader. Normally Composer's ClassLoader, as included by the
* front controller, but may also be decorated.
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request.
*
* @see rebuild.php
*/
function drupal_rebuild($class_loader, Request $request) {
// Remove Drupal's error and exception handlers; they rely on a working
// service container and other subsystems and will only cause a fatal error
// that hides the actual error.
restore_error_handler();
restore_exception_handler();
// Invalidate the container.
// Bootstrap up to where caches exist and clear them.
$kernel = new DrupalKernel('prod', $class_loader);
$kernel->setSitePath(DrupalKernel::findSitePath($request));
$kernel->invalidateContainer();
$kernel->boot();
$kernel->preHandle($request);
// Ensure our request includes the session if appropriate.
if (PHP_SAPI !== 'cli') {
$request->setSession($kernel->getContainer()->get('session'));
}
drupal_flush_all_caches($kernel);
// Disable recording of cached pages.
\Drupal::service('page_cache_kill_switch')->trigger();
// Restore Drupal's error and exception handlers.
// @see \Drupal\Core\DrupalKernel::boot()
set_error_handler('_drupal_error_handler');
set_exception_handler('_drupal_exception_handler');
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @file
* Initiates a browser-based installation of Drupal.
*/
use Drupal\Component\Utility\OpCodeCache;
// Change the directory to the Drupal root.
chdir('..');
// Store the Drupal root path.
$root_path = realpath('');
/**
* Global flag to indicate the site is in installation mode.
*
* The constant is defined using define() instead of const so that PHP
* versions prior to 5.3 can display proper PHP requirements instead of causing
* a fatal error.
*/
define('MAINTENANCE_MODE', 'install');
// Exit early if an incompatible PHP version is in use, so that the user sees a
// helpful error message rather than a white screen from any fatal errors due to
// the incompatible version. The minimum version is also hardcoded (instead of
// \Drupal::MINIMUM_PHP), to avoid any fatal errors that might result from
// loading the autoloader or core/lib/Drupal.php. Note: Remember to update the
// hardcoded minimum PHP version below (both in the version_compare() call and
// in the printed message to the user) whenever \Drupal::MINIMUM_PHP is
// updated.
if (version_compare(PHP_VERSION, '7.3.0') < 0) {
print 'Your PHP installation is too old. Drupal requires at least PHP 7.3.0. See the <a href="https://www.drupal.org/docs/9/how-drupal-9-is-made-and-what-is-included/environment-requirements-of-drupal-9#s-php-version-requirement">Environment requirements of Drupal 9</a> page for more information.';
exit;
}
// Initialize the autoloader.
$class_loader = require_once $root_path . '/autoload.php';
// If OPCache is in use, ensure opcache.save_comments is enabled.
if (OpCodeCache::isEnabled() && !ini_get('opcache.save_comments')) {
print 'Systems with OPcache installed must have <a href="http://php.net/manual/opcache.configuration.php#ini.opcache.save-comments">opcache.save_comments</a> enabled.';
exit();
}
// Start the installer.
require_once $root_path . '/core/includes/install.core.inc';
install_drupal($class_loader);

View File

@ -0,0 +1,746 @@
<?php
use Drupal\Core\DependencyInjection\ContainerNotInitializedException;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Static Service Container wrapper.
*
* Generally, code in Drupal should accept its dependencies via either
* constructor injection or setter method injection. However, there are cases,
* particularly in legacy procedural code, where that is infeasible. This
* class acts as a unified global accessor to arbitrary services within the
* system in order to ease the transition from procedural code to injected OO
* code.
*
* The container is built by the kernel and passed in to this class which stores
* it statically. The container always contains the services from
* \Drupal\Core\CoreServiceProvider, the service providers of enabled modules and any other
* service providers defined in $GLOBALS['conf']['container_service_providers'].
*
* This class exists only to support legacy code that cannot be dependency
* injected. If your code needs it, consider refactoring it to be object
* oriented, if possible. When this is not possible, for instance in the case of
* hook implementations, and your code is more than a few non-reusable lines, it
* is recommended to instantiate an object implementing the actual logic.
*
* @code
* // Legacy procedural code.
* function hook_do_stuff() {
* $lock = lock()->acquire('stuff_lock');
* // ...
* }
*
* // Correct procedural code.
* function hook_do_stuff() {
* $lock = \Drupal::lock()->acquire('stuff_lock');
* // ...
* }
*
* // The preferred way: dependency injected code.
* function hook_do_stuff() {
* // Move the actual implementation to a class and instantiate it.
* $instance = new StuffDoingClass(\Drupal::lock());
* $instance->doStuff();
*
* // Or, even better, rely on the service container to avoid hard coding a
* // specific interface implementation, so that the actual logic can be
* // swapped. This might not always make sense, but in general it is a good
* // practice.
* \Drupal::service('stuff.doing')->doStuff();
* }
*
* interface StuffDoingInterface {
* public function doStuff();
* }
*
* class StuffDoingClass implements StuffDoingInterface {
* protected $lockBackend;
*
* public function __construct(LockBackendInterface $lock_backend) {
* $this->lockBackend = $lock_backend;
* }
*
* public function doStuff() {
* $lock = $this->lockBackend->acquire('stuff_lock');
* // ...
* }
* }
* @endcode
*
* @see \Drupal\Core\DrupalKernel
*/
class Drupal {
/**
* The current system version.
*/
const VERSION = '9.3.8';
/**
* Core API compatibility.
*/
const CORE_COMPATIBILITY = '8.x';
/**
* Core minimum schema version.
*/
const CORE_MINIMUM_SCHEMA_VERSION = 8000;
/**
* Minimum supported version of PHP.
*
* Below this version:
* - New sites cannot be installed, except from within tests.
* - Updates from previous Drupal versions can be run, but users are warned
* that Drupal no longer supports that PHP version.
* - An error is shown in the status report that the PHP version is too old.
*/
const MINIMUM_SUPPORTED_PHP = '7.3.0';
/**
* Minimum allowed version of PHP for Drupal to be bootstrapped.
*
* Below this version:
* - The installer cannot be run.
* - Updates cannot be run.
* - Modules and themes cannot be enabled.
* - If a site managed to bypass all of the above, then an error is shown in
* the status report and various fatal errors occur on various pages.
*
* Note: To prevent the installer from having fatal errors on older versions
* of PHP, the value of this constant is hardcoded twice in core/install.php:
* - Once as a parameter of version_compare()
* - Once in the error message printed to the user immediately after.
* Remember to update both whenever this constant is updated.
*/
const MINIMUM_PHP = '7.3.0';
/**
* Minimum recommended value of PHP memory_limit.
*
* 64M was chosen as a minimum requirement in order to allow for additional
* contributed modules to be installed prior to hitting the limit. However,
* 40M is the target for the Standard installation profile.
*/
const MINIMUM_PHP_MEMORY_LIMIT = '64M';
/**
* Minimum recommended version of PHP.
*
* Sites installing Drupal on PHP versions lower than this will see a warning
* message, but Drupal can still be installed. Used for (e.g.) PHP versions
* that have reached their EOL or will in the near future.
*/
const RECOMMENDED_PHP = '8.0';
/**
* The currently active container object, or NULL if not initialized yet.
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
*/
protected static $container;
/**
* Sets a new global container.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* A new container instance to replace the current.
*/
public static function setContainer(ContainerInterface $container) {
static::$container = $container;
}
/**
* Unsets the global container.
*/
public static function unsetContainer() {
static::$container = NULL;
}
/**
* Returns the currently active global container.
*
* @return \Symfony\Component\DependencyInjection\ContainerInterface
*
* @throws \Drupal\Core\DependencyInjection\ContainerNotInitializedException
*/
public static function getContainer() {
if (static::$container === NULL) {
throw new ContainerNotInitializedException('\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.');
}
return static::$container;
}
/**
* Returns TRUE if the container has been initialized, FALSE otherwise.
*
* @return bool
*/
public static function hasContainer() {
return static::$container !== NULL;
}
/**
* Retrieves a service from the container.
*
* Use this method if the desired service is not one of those with a dedicated
* accessor method below. If it is listed below, those methods are preferred
* as they can return useful type hints.
*
* @param string $id
* The ID of the service to retrieve.
*
* @return mixed
* The specified service.
*/
public static function service($id) {
return static::getContainer()->get($id);
}
/**
* Indicates if a service is defined in the container.
*
* @param string $id
* The ID of the service to check.
*
* @return bool
* TRUE if the specified service exists, FALSE otherwise.
*/
public static function hasService($id) {
// Check hasContainer() first in order to always return a Boolean.
return static::hasContainer() && static::getContainer()->has($id);
}
/**
* Gets the app root.
*
* @return string
*/
public static function root() {
return static::getContainer()->getParameter('app.root');
}
/**
* Gets the active install profile.
*
* @return string|null
* The name of the active install profile.
*/
public static function installProfile() {
return static::getContainer()->getParameter('install_profile');
}
/**
* Indicates if there is a currently active request object.
*
* @return bool
* TRUE if there is a currently active request object, FALSE otherwise.
*/
public static function hasRequest() {
// Check hasContainer() first in order to always return a Boolean.
return static::hasContainer() && static::getContainer()->has('request_stack') && static::getContainer()->get('request_stack')->getCurrentRequest() !== NULL;
}
/**
* Retrieves the currently active request object.
*
* Note: The use of this wrapper in particular is especially discouraged. Most
* code should not need to access the request directly. Doing so means it
* will only function when handling an HTTP request, and will require special
* modification or wrapping when run from a command line tool, from certain
* queue processors, or from automated tests.
*
* If code must access the request, it is considerably better to register
* an object with the Service Container and give it a setRequest() method
* that is configured to run when the service is created. That way, the
* correct request object can always be provided by the container and the
* service can still be unit tested.
*
* If this method must be used, never save the request object that is
* returned. Doing so may lead to inconsistencies as the request object is
* volatile and may change at various times, such as during a subrequest.
*
* @return \Symfony\Component\HttpFoundation\Request
* The currently active request object.
*/
public static function request() {
return static::getContainer()->get('request_stack')->getCurrentRequest();
}
/**
* Retrieves the request stack.
*
* @return \Symfony\Component\HttpFoundation\RequestStack
* The request stack
*/
public static function requestStack() {
return static::getContainer()->get('request_stack');
}
/**
* Retrieves the currently active route match object.
*
* @return \Drupal\Core\Routing\RouteMatchInterface
* The currently active route match object.
*/
public static function routeMatch() {
return static::getContainer()->get('current_route_match');
}
/**
* Gets the current active user.
*
* This method will return the \Drupal\Core\Session\AccountProxy object of the
* current user. You can use the \Drupal\user\Entity\User::load() method to
* load the full user entity object. For example:
* @code
* $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
* @endcode
*
* @return \Drupal\Core\Session\AccountProxyInterface
*/
public static function currentUser() {
return static::getContainer()->get('current_user');
}
/**
* Retrieves the entity type manager.
*
* @return \Drupal\Core\Entity\EntityTypeManagerInterface
* The entity type manager.
*/
public static function entityTypeManager() {
return static::getContainer()->get('entity_type.manager');
}
/**
* Returns the current primary database.
*
* @return \Drupal\Core\Database\Connection
* The current active database's master connection.
*/
public static function database() {
return static::getContainer()->get('database');
}
/**
* Returns the requested cache bin.
*
* @param string $bin
* (optional) The cache bin for which the cache object should be returned,
* defaults to 'default'.
*
* @return \Drupal\Core\Cache\CacheBackendInterface
* The cache object associated with the specified bin.
*
* @ingroup cache
*/
public static function cache($bin = 'default') {
return static::getContainer()->get('cache.' . $bin);
}
/**
* Retrieves the class resolver.
*
* This is to be used in procedural code such as module files to instantiate
* an object of a class that implements
* \Drupal\Core\DependencyInjection\ContainerInjectionInterface.
*
* One common usecase is to provide a class which contains the actual code
* of a hook implementation, without having to create a service.
*
* @param string $class
* (optional) A class name to instantiate.
*
* @return \Drupal\Core\DependencyInjection\ClassResolverInterface|object
* The class resolver or if $class is provided, a class instance with a
* given class definition.
*
* @throws \InvalidArgumentException
* If $class does not exist.
*/
public static function classResolver($class = NULL) {
if ($class) {
return static::getContainer()->get('class_resolver')->getInstanceFromDefinition($class);
}
return static::getContainer()->get('class_resolver');
}
/**
* Returns an expirable key value store collection.
*
* @param string $collection
* The name of the collection holding key and value pairs.
*
* @return \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
* An expirable key value store collection.
*/
public static function keyValueExpirable($collection) {
return static::getContainer()->get('keyvalue.expirable')->get($collection);
}
/**
* Returns the locking layer instance.
*
* @return \Drupal\Core\Lock\LockBackendInterface
*
* @ingroup lock
*/
public static function lock() {
return static::getContainer()->get('lock');
}
/**
* Retrieves a configuration object.
*
* This is the main entry point to the configuration API. Calling
* @code \Drupal::config('book.admin') @endcode will return a configuration
* object the Book module can use to read its administrative settings.
*
* @param string $name
* The name of the configuration object to retrieve, which typically
* corresponds to a configuration file. For
* @code \Drupal::config('book.admin') @endcode, the configuration
* object returned will contain the content of the book.admin
* configuration file.
*
* @return \Drupal\Core\Config\ImmutableConfig
* An immutable configuration object.
*/
public static function config($name) {
return static::getContainer()->get('config.factory')->get($name);
}
/**
* Retrieves the configuration factory.
*
* This is mostly used to change the override settings on the configuration
* factory. For example, changing the language, or turning all overrides on
* or off.
*
* @return \Drupal\Core\Config\ConfigFactoryInterface
* The configuration factory service.
*/
public static function configFactory() {
return static::getContainer()->get('config.factory');
}
/**
* Returns a queue for the given queue name.
*
* The following values can be set in your settings.php file's $settings
* array to define which services are used for queues:
* - queue_reliable_service_$name: The container service to use for the
* reliable queue $name.
* - queue_service_$name: The container service to use for the
* queue $name.
* - queue_default: The container service to use by default for queues
* without overrides. This defaults to 'queue.database'.
*
* @param string $name
* The name of the queue to work with.
* @param bool $reliable
* (optional) TRUE if the ordering of items and guaranteeing every item
* executes at least once is important, FALSE if scalability is the main
* concern. Defaults to FALSE.
*
* @return \Drupal\Core\Queue\QueueInterface
* The queue object for a given name.
*/
public static function queue($name, $reliable = FALSE) {
return static::getContainer()->get('queue')->get($name, $reliable);
}
/**
* Returns a key/value storage collection.
*
* @param string $collection
* Name of the key/value collection to return.
*
* @return \Drupal\Core\KeyValueStore\KeyValueStoreInterface
*/
public static function keyValue($collection) {
return static::getContainer()->get('keyvalue')->get($collection);
}
/**
* Returns the state storage service.
*
* Use this to store machine-generated data, local to a specific environment
* that does not need deploying and does not need human editing; for example,
* the last time cron was run. Data which needs to be edited by humans and
* needs to be the same across development, production, etc. environments
* (for example, the system maintenance message) should use \Drupal::config() instead.
*
* @return \Drupal\Core\State\StateInterface
*/
public static function state() {
return static::getContainer()->get('state');
}
/**
* Returns the default http client.
*
* @return \GuzzleHttp\Client
* A guzzle http client instance.
*/
public static function httpClient() {
return static::getContainer()->get('http_client');
}
/**
* Returns the entity query object for this entity type.
*
* @param string $entity_type
* The entity type (for example, node) for which the query object should be
* returned.
* @param string $conjunction
* (optional) Either 'AND' if all conditions in the query need to apply, or
* 'OR' if any of them is sufficient. Defaults to 'AND'.
*
* @return \Drupal\Core\Entity\Query\QueryInterface
* The query object that can query the given entity type.
*/
public static function entityQuery($entity_type, $conjunction = 'AND') {
return static::entityTypeManager()->getStorage($entity_type)->getQuery($conjunction);
}
/**
* Returns the entity query aggregate object for this entity type.
*
* @param string $entity_type
* The entity type (for example, node) for which the query object should be
* returned.
* @param string $conjunction
* (optional) Either 'AND' if all conditions in the query need to apply, or
* 'OR' if any of them is sufficient. Defaults to 'AND'.
*
* @return \Drupal\Core\Entity\Query\QueryAggregateInterface
* The query object that can query the given entity type.
*/
public static function entityQueryAggregate($entity_type, $conjunction = 'AND') {
return static::entityTypeManager()->getStorage($entity_type)->getAggregateQuery($conjunction);
}
/**
* Returns the flood instance.
*
* @return \Drupal\Core\Flood\FloodInterface
*/
public static function flood() {
return static::getContainer()->get('flood');
}
/**
* Returns the module handler.
*
* @return \Drupal\Core\Extension\ModuleHandlerInterface
*/
public static function moduleHandler() {
return static::getContainer()->get('module_handler');
}
/**
* Returns the typed data manager service.
*
* Use the typed data manager service for creating typed data objects.
*
* @return \Drupal\Core\TypedData\TypedDataManagerInterface
* The typed data manager.
*
* @see \Drupal\Core\TypedData\TypedDataManager::create()
*/
public static function typedDataManager() {
return static::getContainer()->get('typed_data_manager');
}
/**
* Returns the token service.
*
* @return \Drupal\Core\Utility\Token
* The token service.
*/
public static function token() {
return static::getContainer()->get('token');
}
/**
* Returns the url generator service.
*
* @return \Drupal\Core\Routing\UrlGeneratorInterface
* The url generator service.
*/
public static function urlGenerator() {
return static::getContainer()->get('url_generator');
}
/**
* Returns the link generator service.
*
* @return \Drupal\Core\Utility\LinkGeneratorInterface
*/
public static function linkGenerator() {
return static::getContainer()->get('link_generator');
}
/**
* Returns the string translation service.
*
* @return \Drupal\Core\StringTranslation\TranslationManager
* The string translation manager.
*/
public static function translation() {
return static::getContainer()->get('string_translation');
}
/**
* Returns the language manager service.
*
* @return \Drupal\Core\Language\LanguageManagerInterface
* The language manager.
*/
public static function languageManager() {
return static::getContainer()->get('language_manager');
}
/**
* Returns the CSRF token manager service.
*
* The generated token is based on the session ID of the current user. Normally,
* anonymous users do not have a session, so the generated token will be
* different on every page request. To generate a token for users without a
* session, manually start a session prior to calling this function.
*
* @return \Drupal\Core\Access\CsrfTokenGenerator
* The CSRF token manager.
*
* @see \Drupal\Core\Session\SessionManager::start()
*/
public static function csrfToken() {
return static::getContainer()->get('csrf_token');
}
/**
* Returns the transliteration service.
*
* @return \Drupal\Core\Transliteration\PhpTransliteration
* The transliteration manager.
*/
public static function transliteration() {
return static::getContainer()->get('transliteration');
}
/**
* Returns the form builder service.
*
* @return \Drupal\Core\Form\FormBuilderInterface
* The form builder.
*/
public static function formBuilder() {
return static::getContainer()->get('form_builder');
}
/**
* Gets the theme service.
*
* @return \Drupal\Core\Theme\ThemeManagerInterface
*/
public static function theme() {
return static::getContainer()->get('theme.manager');
}
/**
* Gets the syncing state.
*
* @return bool
* Returns TRUE is syncing flag set.
*/
public static function isConfigSyncing() {
return static::getContainer()->get('config.installer')->isSyncing();
}
/**
* Returns a channel logger object.
*
* @param string $channel
* The name of the channel. Can be any string, but the general practice is
* to use the name of the subsystem calling this.
*
* @return \Psr\Log\LoggerInterface
* The logger for this channel.
*/
public static function logger($channel) {
return static::getContainer()->get('logger.factory')->get($channel);
}
/**
* Returns the menu tree.
*
* @return \Drupal\Core\Menu\MenuLinkTreeInterface
* The menu tree.
*/
public static function menuTree() {
return static::getContainer()->get('menu.link_tree');
}
/**
* Returns the path validator.
*
* @return \Drupal\Core\Path\PathValidatorInterface
*/
public static function pathValidator() {
return static::getContainer()->get('path.validator');
}
/**
* Returns the access manager service.
*
* @return \Drupal\Core\Access\AccessManagerInterface
* The access manager service.
*/
public static function accessManager() {
return static::getContainer()->get('access_manager');
}
/**
* Returns the redirect destination helper.
*
* @return \Drupal\Core\Routing\RedirectDestinationInterface
* The redirect destination helper.
*/
public static function destination() {
return static::getContainer()->get('redirect.destination');
}
/**
* Returns the entity definition update manager.
*
* @return \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface
* The entity definition update manager.
*/
public static function entityDefinitionUpdateManager() {
return static::getContainer()->get('entity.definition_update_manager');
}
/**
* Returns the time service.
*
* @return \Drupal\Component\Datetime\TimeInterface
* The time service.
*/
public static function time() {
return static::getContainer()->get('datetime.time');
}
/**
* Returns the messenger.
*
* @return \Drupal\Core\Messenger\MessengerInterface
* The messenger.
*/
public static function messenger() {
return static::getContainer()->get('messenger');
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Drupal\Component\Annotation;
/**
* Provides a base class for classed annotations.
*/
abstract class AnnotationBase implements AnnotationInterface {
/**
* The annotated class ID.
*
* @var string
*/
public $id;
/**
* The class used for this annotated class.
*
* @var string
*/
protected $class;
/**
* The provider of the annotated class.
*
* @var string
*/
protected $provider;
/**
* {@inheritdoc}
*/
public function getProvider() {
return $this->provider;
}
/**
* {@inheritdoc}
*/
public function setProvider($provider) {
$this->provider = $provider;
}
/**
* {@inheritdoc}
*/
public function getId() {
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getClass() {
return $this->class;
}
/**
* {@inheritdoc}
*/
public function setClass($class) {
$this->class = $class;
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace Drupal\Component\Annotation;
/**
* Defines a common interface for classed annotations.
*/
interface AnnotationInterface {
/**
* Gets the value of an annotation.
*/
public function get();
/**
* Gets the name of the provider of the annotated class.
*
* @return string
*/
public function getProvider();
/**
* Sets the name of the provider of the annotated class.
*
* @param string $provider
* The provider of the annotated class.
*/
public function setProvider($provider);
/**
* Gets the unique ID for this annotated class.
*
* @return string
*/
public function getId();
/**
* Gets the class of the annotated class.
*
* @return string
*/
public function getClass();
/**
* Sets the class of the annotated class.
*
* @param string $class
* The class of the annotated class.
*/
public function setClass($class);
}

View File

@ -0,0 +1,48 @@
<?php
// phpcs:ignoreFile
/**
* @file
*
* This class is a near-copy of
* Doctrine\Common\Reflection\Compatibility\Php7\ReflectionClass, which is part
* of the Doctrine project: <http://www.doctrine-project.org>. It was copied
* from version 1.2.2.
*
* Original copyright:
*
* Copyright (c) 2006-2015 Doctrine Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
namespace Drupal\Component\Annotation\Doctrine\Compatibility\Php7;
use ReflectionException;
trait ReflectionClass
{
/**
* {@inheritDoc}
*/
public function getConstants()
{
throw new ReflectionException('Method not implemented');
}
/**
* {@inheritDoc}
*/
public function newInstance($args)
{
throw new ReflectionException('Method not implemented');
}
}

View File

@ -0,0 +1,50 @@
<?php
// phpcs:ignoreFile
/**
* @file
*
* This class is a near-copy of
* Doctrine\Common\Reflection\Compatibility\Php8\ReflectionClass, which is part
* of the Doctrine project: <http://www.doctrine-project.org>. It was copied
* from version 1.2.2.
*
* Original copyright:
*
* Copyright (c) 2006-2015 Doctrine Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
namespace Drupal\Component\Annotation\Doctrine\Compatibility\Php8;
use ReflectionException;
trait ReflectionClass
{
/**
* {@inheritDoc}
*/
#[\ReturnTypeWillChange]
public function getConstants(?int $filter = null)
{
throw new ReflectionException('Method not implemented');
}
/**
* {@inheritDoc}
*/
#[\ReturnTypeWillChange]
public function newInstance(mixed ...$args)
{
throw new ReflectionException('Method not implemented');
}
}

View File

@ -0,0 +1,42 @@
<?php
// phpcs:ignoreFile
/**
* @file
*
* This class is a near-copy of
* Doctrine\Common\Reflection\Compatibility\ReflectionClass, which is part of
* the Doctrine project: <http://www.doctrine-project.org>. It was copied from
* version 1.2.2.
*
* Original copyright:
*
* Copyright (c) 2006-2015 Doctrine Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
namespace Drupal\Component\Annotation\Doctrine\Compatibility;
use const PHP_VERSION_ID;
use function class_alias;
if (PHP_VERSION_ID >= 80000) {
class_alias('Drupal\Component\Annotation\Doctrine\Compatibility\Php8\ReflectionClass', 'Drupal\Component\Annotation\Doctrine\Compatibility\ReflectionClass');
} else {
class_alias('Drupal\Component\Annotation\Doctrine\Compatibility\Php7\ReflectionClass', 'Drupal\Component\Annotation\Doctrine\Compatibility\ReflectionClass');
}
if (false) {
class ReflectionClass
{
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
<?php
// phpcs:ignoreFile
/**
* @file
*
* This class is a near-copy of
* Doctrine\Common\Annotations\SimpleAnnotationReader, which is part of the
* Doctrine project: <http://www.doctrine-project.org>. It was copied from
* version 1.2.7.
*
* Original copyright:
*
* Copyright (c) 2006-2013 Doctrine Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
namespace Drupal\Component\Annotation\Doctrine;
use Doctrine\Common\Annotations\Reader;
/**
* Simple Annotation Reader.
*
* Drupal adds its own version of DocParser and allows for ignoring common
* annotations.
*
* @internal
*/
final class SimpleAnnotationReader implements Reader
{
protected $ignoredAnnotations = [
'addtogroup' => TRUE,
'code' => TRUE,
'defgroup' => TRUE,
'deprecated' => TRUE,
'endcode' => TRUE,
'endlink' => TRUE,
'file' => TRUE,
'ingroup' => TRUE,
'group' => TRUE,
'link' => TRUE,
'mainpage' => TRUE,
'param' => TRUE,
'ref' => TRUE,
'return' => TRUE,
'section' => TRUE,
'see' => TRUE,
'subsection' => TRUE,
'throws' => TRUE,
'todo' => TRUE,
'var' => TRUE,
'{' => TRUE,
'}' => TRUE,
];
/**
* @var DocParser
*/
private $parser;
/**
* Constructor.
*
* Initializes a new SimpleAnnotationReader.
*/
public function __construct()
{
$this->parser = new DocParser();
$this->parser->setIgnoreNotImportedAnnotations(true);
$this->parser->setIgnoredAnnotationNames($this->ignoredAnnotations);
}
/**
* Adds a namespace in which we will look for annotations.
*
* @param string $namespace
*
* @return void
*/
public function addNamespace($namespace)
{
$this->parser->addNamespace($namespace);
}
/**
* {@inheritDoc}
*/
public function getClassAnnotations(\ReflectionClass $class)
{
return $this->parser->parse($class->getDocComment(), 'class '.$class->getName());
}
/**
* {@inheritDoc}
*/
public function getMethodAnnotations(\ReflectionMethod $method)
{
return $this->parser->parse($method->getDocComment(), 'method '.$method->getDeclaringClass()->name.'::'.$method->getName().'()');
}
/**
* {@inheritDoc}
*/
public function getPropertyAnnotations(\ReflectionProperty $property)
{
return $this->parser->parse($property->getDocComment(), 'property '.$property->getDeclaringClass()->name.'::$'.$property->getName());
}
/**
* {@inheritDoc}
*/
public function getClassAnnotation(\ReflectionClass $class, $annotationName)
{
foreach ($this->getClassAnnotations($class) as $annot) {
if ($annot instanceof $annotationName) {
return $annot;
}
}
return null;
}
/**
* {@inheritDoc}
*/
public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
{
foreach ($this->getMethodAnnotations($method) as $annot) {
if ($annot instanceof $annotationName) {
return $annot;
}
}
return null;
}
/**
* {@inheritDoc}
*/
public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName)
{
foreach ($this->getPropertyAnnotations($property) as $annot) {
if ($annot instanceof $annotationName) {
return $annot;
}
}
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More