diff --git a/core/INSTALL.txt b/core/INSTALL.txt index 8c5ee87..c839761 100644 --- a/core/INSTALL.txt +++ b/core/INSTALL.txt @@ -90,6 +90,19 @@ INSTALLATION 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 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 diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index 7d23eea..a74afa6 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -23,9 +23,10 @@ Drupal 8 (Release Manager) - Alex Pott 'alexpott' https://www.drupal.org/u/alexpott (Framework Manager) - -Provisional membership: - Scott Reeves 'Cottser' https://www.drupal.org/u/cottser + (Framework Manager - Frontend) + +Provisional membership: None at this time. Drupal 7 - Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx @@ -323,6 +324,10 @@ DateTime module - Jonathan Hedstrom 'jhedstrom' https://www.drupal.org/u/jhedstrom - Matthew Donadio 'mpdonadio' https://www.drupal.org/u/mpdonadio +DateTime range module +- Jonathan Hedstrom 'jhedstrom' https://www.drupal.org/u/jhedstrom +- Matthew Donadio 'mpdonadio' https://www.drupal.org/u/mpdonadio + Dynamic Page Cache module - Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx - Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers diff --git a/core/composer.json b/core/composer.json index de2feb8..53ab8fa 100644 --- a/core/composer.json +++ b/core/composer.json @@ -88,6 +88,7 @@ "drupal/core-utility": "self.version", "drupal/core-uuid": "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", diff --git a/core/core.api.php b/core/core.api.php index 6a34823..7b90ae2 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -2047,7 +2047,7 @@ function hook_mail_alter(&$message) { * An array of parameters supplied by the caller of * MailManagerInterface->mail(). * - * @see \Drupal\Core\Mail\MailManagerInterface->mail() + * @see \Drupal\Core\Mail\MailManagerInterface::mail() */ function hook_mail($key, &$message, $params) { $account = $params['account']; diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index ec12097..292e918 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -599,7 +599,7 @@ function _drupal_exception_handler_additional($exception, $exception2) { * @param string $new_prefix * Internal use only. A new prefix to be stored. * - * @return string|FALSE + * @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. @@ -640,11 +640,15 @@ function drupal_valid_test_ua($new_prefix = NULL) { $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 5 second time window is allowed, + // 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 <= 5 && $hmac === $test_hmac) { + if ($time_diff >= 0 && $time_diff <= 600 && $hmac === $test_hmac) { $test_prefix = $prefix; } + else { + header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden (SIMPLETEST_USER_AGENT invalid)'); + exit; + } } return $test_prefix; } diff --git a/core/includes/update.inc b/core/includes/update.inc index 2c020db..a9b5de9 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -596,7 +596,7 @@ function update_already_performed($module, $number) { * An array of return values obtained by merging the results of the * hook_update_dependencies() implementations in all installed modules. * - * @see \Drupal::moduleHandler()->invokeAll() + * @see \Drupal\Core\Extension\ModuleHandlerInterface::invokeAll() * @see hook_update_dependencies() */ function update_retrieve_dependencies() { @@ -707,7 +707,7 @@ function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) { // Initialize master language list. if (!isset($languages)) { // Initialize local language list cache. - $languages = array(); + $languages = array(); // Fill in master language list based on current configuration. $default = \Drupal::languageManager()->getDefaultLanguage(); diff --git a/core/lib/Drupal/Component/Assertion/Handle.php b/core/lib/Drupal/Component/Assertion/Handle.php index dd9911e..5069b6b 100644 --- a/core/lib/Drupal/Component/Assertion/Handle.php +++ b/core/lib/Drupal/Component/Assertion/Handle.php @@ -1,41 +1,6 @@ file = $file; - $this->line = $line; - } - - } -} - -} - -namespace Drupal\Component\Assertion { +namespace Drupal\Component\Assertion; /** * Handler for runtime assertion failures. @@ -56,6 +21,9 @@ public static function register() { assert_options(ASSERT_WARNING, FALSE); if (version_compare(PHP_VERSION, '7.0.0-dev') < 0) { + if (!class_exists('AssertionError', FALSE)) { + require __DIR__ . '/global_namespace_php5.php'; + } // PHP 5 - create a handler to throw the exception directly. assert_options(ASSERT_CALLBACK, function($file = '', $line = 0, $code = '', $message = '') { if (empty($message)) { @@ -71,5 +39,3 @@ public static function register() { } } - -} diff --git a/core/lib/Drupal/Component/Assertion/Inspector.php b/core/lib/Drupal/Component/Assertion/Inspector.php index 6b96a7a..9b04e33 100644 --- a/core/lib/Drupal/Component/Assertion/Inspector.php +++ b/core/lib/Drupal/Component/Assertion/Inspector.php @@ -108,7 +108,7 @@ public static function assertAllStringable($traversable) { * Use this instead of is_string() alone unless the argument being an object * in any way will cause a problem. * - * @param mixed string + * @param mixed $string * Variable to be examined * * @return bool diff --git a/core/lib/Drupal/Component/Assertion/global_namespace_php5.php b/core/lib/Drupal/Component/Assertion/global_namespace_php5.php new file mode 100644 index 0000000..1b5caf4 --- /dev/null +++ b/core/lib/Drupal/Component/Assertion/global_namespace_php5.php @@ -0,0 +1,28 @@ +file = $file; + $this->line = $line; + } + +} diff --git a/core/lib/Drupal/Component/Gettext/PoItem.php b/core/lib/Drupal/Component/Gettext/PoItem.php index c557964..6cedff1 100644 --- a/core/lib/Drupal/Component/Gettext/PoItem.php +++ b/core/lib/Drupal/Component/Gettext/PoItem.php @@ -169,7 +169,7 @@ function setComment($comment) { /** * Create the PoItem from a structured array. * - * @param array values + * @param array $values */ public function setFromArray(array $values = array()) { if (isset($values['context'])) { diff --git a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php b/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php index 71f4700..735341d 100644 --- a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php +++ b/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php @@ -80,7 +80,7 @@ public function deleteAll(); * @param string $name * The virtual file name. Can be a relative path. * - * @return string|FALSE + * @return string|false * The full file path for the provided name. Return FALSE if the * implementation needs to prevent access to the file. */ diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php index 044a214..2ef6223 100644 --- a/core/lib/Drupal/Component/Utility/SortArray.php +++ b/core/lib/Drupal/Component/Utility/SortArray.php @@ -81,9 +81,9 @@ public static function sortByTitleElement($a, $b) { * @return int * The comparison result for uasort(). */ - public static function sortByTitleProperty($a, $b) { - return static::sortByKeyString($a, $b, '#title'); - } + public static function sortByTitleProperty($a, $b) { + return static::sortByKeyString($a, $b, '#title'); + } /** * Sorts a string array item by an arbitrary key. diff --git a/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php b/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php index 468d998..850194c 100644 --- a/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php +++ b/core/lib/Drupal/Core/Access/AccessResultReasonInterface.php @@ -17,7 +17,7 @@ /** * Gets the reason for this access result. * - * @return string|NULL + * @return string|null * The reason of this access result or NULL if no reason is provided. */ public function getReason(); @@ -25,7 +25,7 @@ public function getReason(); /** * Sets the reason for this access result. * - * @param $reason string|NULL + * @param $reason string|null * The reason of this access result or NULL if no reason is provided. * * @return \Drupal\Core\Access\AccessResultInterface diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php index 9beddd1..eb47cb2 100644 --- a/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php +++ b/core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php @@ -40,13 +40,13 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface { /** * Constructs a CssCollectionOptimizer. * - * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface + * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface $grouper * The grouper for CSS assets. - * @param \Drupal\Core\Asset\AssetOptimizerInterface + * @param \Drupal\Core\Asset\AssetOptimizerInterface $optimizer * The optimizer for a single CSS asset. - * @param \Drupal\Core\Asset\AssetDumperInterface + * @param \Drupal\Core\Asset\AssetDumperInterface $dumper * The dumper for optimized CSS assets. - * @param \Drupal\Core\State\StateInterface + * @param \Drupal\Core\State\StateInterface $state * The state key/value store. */ public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state) { diff --git a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php b/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php index 869abe3..63721e6 100644 --- a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php +++ b/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php @@ -63,7 +63,7 @@ class CssCollectionRenderer implements AssetCollectionRendererInterface { /** * Constructs a CssCollectionRenderer. * - * @param \Drupal\Core\State\StateInterface + * @param \Drupal\Core\State\StateInterface $state * The state key/value store. */ public function __construct(StateInterface $state) { diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php index aef10bf..566722d 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php @@ -41,13 +41,13 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface { /** * Constructs a JsCollectionOptimizer. * - * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface + * @param \Drupal\Core\Asset\AssetCollectionGrouperInterface $grouper * The grouper for JS assets. - * @param \Drupal\Core\Asset\AssetOptimizerInterface + * @param \Drupal\Core\Asset\AssetOptimizerInterface $optimizer * The optimizer for a single JS asset. - * @param \Drupal\Core\Asset\AssetDumperInterface + * @param \Drupal\Core\Asset\AssetDumperInterface $dumper * The dumper for optimized JS assets. - * @param \Drupal\Core\State\StateInterface + * @param \Drupal\Core\State\StateInterface $state * The state key/value store. */ public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state) { diff --git a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php index c5f0a2b..2e47d0f 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php @@ -20,7 +20,7 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface { /** * Constructs a JsCollectionRenderer. * - * @param \Drupal\Core\State\StateInterface + * @param \Drupal\Core\State\StateInterface $state * The state key/value store. */ public function __construct(StateInterface $state) { diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryInterface.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryInterface.php index c8d18f0..0f4e704 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryInterface.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryInterface.php @@ -39,7 +39,7 @@ public function getLibrariesByExtension($extension); * @param string $name * The name of a registered library to retrieve. * - * @return array|FALSE + * @return array|false * The definition of the requested library, if $name was passed and it * exists, otherwise FALSE. */ diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationCollectorInterface.php b/core/lib/Drupal/Core/Authentication/AuthenticationCollectorInterface.php index 3d869e5..37f245c 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationCollectorInterface.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationCollectorInterface.php @@ -41,7 +41,7 @@ public function isGlobal($provider_id); * @param string $provider_id * The provider ID. * - * @return \Drupal\Core\Authentication\AuthenticationProviderInterface|NULL + * @return \Drupal\Core\Authentication\AuthenticationProviderInterface|null * The authentication provider which matches the ID. */ public function getProvider($provider_id); diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php index 10b0edc..1049c92 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php @@ -94,7 +94,7 @@ public function challengeException(Request $request, \Exception $previous) { * @param \Symfony\Component\HttpFoundation\Request $request * The incoming request. * - * @return string|NULL + * @return string|null * The id of the first authentication provider which applies to the request. * If no application detects appropriate credentials, then NULL is returned. */ @@ -112,7 +112,7 @@ protected function getProvider(Request $request) { * @param \Symfony\Component\HttpFoundation\Request $request * The incoming request. * - * @return string|NULL + * @return string|null * The ID of the first authentication provider which applies to the request. * If no application detects appropriate credentials, then NULL is returned. */ diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationProviderChallengeInterface.php b/core/lib/Drupal/Core/Authentication/AuthenticationProviderChallengeInterface.php index 4721050..db86cc1 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationProviderChallengeInterface.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationProviderChallengeInterface.php @@ -21,7 +21,7 @@ * @param \Exception $previous * The previous exception. * - * @return \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|NULL + * @return \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|null * An exception to be used in order to generate an authentication challenge. */ public function challengeException(Request $request, \Exception $previous); diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php b/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php index 7ef18df..02f0497 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php @@ -27,7 +27,7 @@ public function applies(Request $request); * @param \Symfony\Component\HttpFoundation\Request|null $request * The request object. * - * @return \Drupal\Core\Session\AccountInterface|NULL + * @return \Drupal\Core\Session\AccountInterface|null * AccountInterface - in case of a successful authentication. * NULL - in case where authentication failed. */ diff --git a/core/lib/Drupal/Core/Composer/Composer.php b/core/lib/Drupal/Core/Composer/Composer.php index 51a4917..263be4c 100644 --- a/core/lib/Drupal/Core/Composer/Composer.php +++ b/core/lib/Drupal/Core/Composer/Composer.php @@ -196,7 +196,7 @@ public static function vendorTestCodeCleanup(PackageEvent $event) { * @param string $package_name * The package name from composer. This is always already lower case. * - * @return NULL|string + * @return string|null * The string key, or NULL if none was found. */ protected static function findPackageKey($package_name) { diff --git a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php index ca526cd..483c96d 100644 --- a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php +++ b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php @@ -24,7 +24,7 @@ class ConfigCollectionInfo extends Event { * * @param string $collection * Collection name to add. - * @param \Drupal\Core\Config\ConfigFactoryOverrideInterface + * @param \Drupal\Core\Config\ConfigFactoryOverrideInterface $override_service * (optional) The configuration factory override service responsible for the * collection. * @@ -63,7 +63,7 @@ public function getCollectionNames($include_default = TRUE) { * @param string $collection * The configuration collection. * - * @return \Drupal\Core\Config\ConfigFactoryOverrideInterface|NULL + * @return \Drupal\Core\Config\ConfigFactoryOverrideInterface|null * The override service responsible for the collection if one exists. NULL * if not. */ diff --git a/core/lib/Drupal/Core/Config/ConfigCrudEvent.php b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php index af25d36..3172e8e 100644 --- a/core/lib/Drupal/Core/Config/ConfigCrudEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php @@ -19,7 +19,7 @@ class ConfigCrudEvent extends Event { /** * Constructs a configuration event object. * - * @param \Drupal\Core\Config\Config + * @param \Drupal\Core\Config\Config $config * Configuration object. */ public function __construct(Config $config) { diff --git a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php index ba71812..3d7077b 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php @@ -40,7 +40,7 @@ public function installDefaultConfig($type, $name); * - it's a configuration entity. * - its dependencies can be met. * - * @param \Drupal\Core\Config\StorageInterface + * @param \Drupal\Core\Config\StorageInterface $storage * (optional) The configuration storage to search for optional * configuration. If not provided, all enabled extension's optional * configuration directories will be searched. diff --git a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php index a8a42c5..be5be93 100644 --- a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php @@ -37,7 +37,7 @@ class ConfigModuleOverridesEvent extends Event { * * @param array $names * A list of configuration names. - * @param \Drupal\Core\Language\LanguageInterface + * @param \Drupal\Core\Language\LanguageInterface $language * (optional) The language for this configuration. */ public function __construct(array $names, LanguageInterface $language = NULL) { diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityTypeInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityTypeInterface.php index 2cb1434..589a63d 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityTypeInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityTypeInterface.php @@ -65,7 +65,7 @@ public function getConfigPrefix(); /** * Gets the config entity properties to export if declared on the annotation. * - * @return array|NULL + * @return array|null * The properties to export or NULL if they can not be determine from the * config entity type annotation. */ diff --git a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php index 4396a39..0327e90 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php @@ -66,8 +66,8 @@ public function get(EntityTypeInterface $entity_type, $conjunction) { /** * {@inheritdoc} */ - public function getAggregate(EntityTypeInterface $entity_type, $conjunction) { - throw new QueryException('Aggregation over configuration entities is not supported'); + public function getAggregate(EntityTypeInterface $entity_type, $conjunction) { + throw new QueryException('Aggregation over configuration entities is not supported'); } /** @@ -189,7 +189,7 @@ protected function getKeys(Config $config, $key, $get_method, ConfigEntityTypeIn * @param int $start * Which position of $parts we are processing. Defaults to 0. * - * @return array|NULL + * @return array|null * The array of configuration values the match the provided key. NULL if * the configuration object does not have a value that corresponds to the * key. diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php index 8662d68..74d2866 100644 --- a/core/lib/Drupal/Core/Cron.php +++ b/core/lib/Drupal/Core/Cron.php @@ -83,7 +83,7 @@ class Cron implements CronInterface { * The account switching service. * @param \Psr\Log\LoggerInterface $logger * A logger instance. - * @param \Drupal\Core\Queue\QueueWorkerManagerInterface + * @param \Drupal\Core\Queue\QueueWorkerManagerInterface $queue_manager * The queue plugin manager. */ public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountSwitcherInterface $account_switcher, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager) { diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php index 95ff527..7e78b14 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php @@ -65,7 +65,7 @@ protected function connect() { $this->pass('Drupal can CONNECT to the database ok.'); } catch (\Exception $e) { - // Attempt to create the database if it is not found. + // Attempt to create the database if it is not found. if ($e->getCode() == Connection::DATABASE_NOT_FOUND) { // Remove the database string from connection info. $connection_info = Database::getConnectionInfo(); diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php index c0775c9..72f35da 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php @@ -23,7 +23,7 @@ class Schema extends DatabaseSchema { * This is collected by DatabaseConnection_pgsql->queryTableInformation(), * by introspecting the database. * - * @see DatabaseConnection_pgsql->queryTableInformation() + * @see \Drupal\Core\Database\Driver\pgsql\Schema::queryTableInformation() * @var array */ protected $tableInformation = array(); diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php index 5bc9e48..971d031 100644 --- a/core/lib/Drupal/Core/Database/StatementInterface.php +++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -90,7 +90,7 @@ public function rowCount(); * If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the * constructor. */ - public function setFetchMode($mode, $a1 = NULL, $a2 = array()); + public function setFetchMode($mode, $a1 = NULL, $a2 = array()); /** * Fetches the next row from a result set. @@ -109,7 +109,7 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = array()); * @return * A result, formatted according to $mode. */ - public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); + public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); /** * Returns a single field from the next record of a result set. @@ -128,7 +128,7 @@ public function fetchField($index = 0); * The object will be of the class specified by StatementInterface::setFetchMode() * or stdClass if not specified. */ - public function fetchObject(); + public function fetchObject(); /** * Fetches the next row and returns it as an associative array. @@ -155,7 +155,7 @@ public function fetchAssoc(); * @return * An array of results. */ - function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); + function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); /** * Returns an entire single column of a result set as an indexed array. diff --git a/core/lib/Drupal/Core/DependencyInjection/Container.php b/core/lib/Drupal/Core/DependencyInjection/Container.php index 157f576..4a49122 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Container.php +++ b/core/lib/Drupal/Core/DependencyInjection/Container.php @@ -14,7 +14,7 @@ class Container extends DrupalContainer { * {@inheritdoc} */ public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { - parent::set($id, $service, $scope); + parent::set($id, $service, $scope); // Ensure that the _serviceId property is set on synthetic services as well. if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) { diff --git a/core/lib/Drupal/Core/DrupalKernelInterface.php b/core/lib/Drupal/Core/DrupalKernelInterface.php index 4f7e9c4..862fbec 100644 --- a/core/lib/Drupal/Core/DrupalKernelInterface.php +++ b/core/lib/Drupal/Core/DrupalKernelInterface.php @@ -58,7 +58,7 @@ public function getContainer(); * * This also allows inspecting a built container for debugging purposes. * - * @return array|NULL + * @return array|null * The cached container definition or NULL if not found in cache. */ public function getCachedContainerDefinition(); diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityController.php b/core/lib/Drupal/Core/Entity/Controller/EntityController.php index ebee7cc..4ca97e4 100644 --- a/core/lib/Drupal/Core/Entity/Controller/EntityController.php +++ b/core/lib/Drupal/Core/Entity/Controller/EntityController.php @@ -273,7 +273,7 @@ public function deleteTitle(RouteMatchInterface $route_match, EntityInterface $_ * (optional) The entity, set in * \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer. * - * @return \Drupal\Core\Entity\EntityInterface|NULL + * @return \Drupal\Core\Entity\EntityInterface|null * The entity, if it is passed in directly or if the first parameter of the * active route is an entity; otherwise, NULL. */ diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index 23fd0b5..51adf91 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -297,7 +297,7 @@ protected static function matchEntityByTitle(SelectionInterface $handler, $input $multiples[] = $name . ' (' . $id . ')'; } $params['@id'] = $id; - $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples)))); + $form_state->setError($element, t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples)) + $params)); } else { // Take the one and only matching entity. diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php index ab8d64c..c574781 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php @@ -33,10 +33,10 @@ public function validate($value, Constraint $constraint) { $referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities(); // Check permission if we are not already referencing the entity. foreach ($referenced_entities as $ref) { - if (isset($referenced_entities[$ref->id()])) { - $check_permission = FALSE; - break; - } + if (isset($referenced_entities[$ref->id()])) { + $check_permission = FALSE; + break; + } } } // We check that the current user had access to view any newly added diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php index 2d5df2d..78f831a 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php @@ -225,7 +225,7 @@ protected function finish() { if ($this->range) { $this->sqlQuery->range($this->range['start'], $this->range['length']); } - foreach ($this->sqlGroupBy as $field) { + foreach ($this->sqlGroupBy as $field) { $this->sqlQuery->groupBy($field); } foreach ($this->sqlFields as $field) { diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index e115bd2..2ea450d 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -526,7 +526,7 @@ protected function loadFromSharedTables(array &$values, array &$translations) { $all_fields = $revisioned_fields; if ($data_fields) { $all_fields = array_merge($revisioned_fields, $data_fields); - $query->leftJoin($this->dataTable, 'data', "(revision.$this->idKey = data.$this->idKey)"); + $query->leftJoin($this->dataTable, 'data', "(revision.$this->idKey = data.$this->idKey and revision.$this->langcodeKey = data.$this->langcodeKey)"); $column_names = []; // Some fields can have more then one columns in the data table so // column names are needed. @@ -1543,6 +1543,7 @@ protected function readFieldItemsToPurge(FieldDefinitionInterface $field_definit $item_query = $this->database->select($table_name, 't', array('fetch' => \PDO::FETCH_ASSOC)) ->fields('t') ->condition('entity_id', $row['entity_id']) + ->condition('deleted', 1) ->orderBy('delta'); foreach ($item_query->execute() as $item_row) { @@ -1581,10 +1582,12 @@ protected function purgeFieldItems(ContentEntityInterface $entity, FieldDefiniti $revision_id = $this->entityType->isRevisionable() ? $entity->getRevisionId() : $entity->id(); $this->database->delete($table_name) ->condition('revision_id', $revision_id) + ->condition('deleted', 1) ->execute(); if ($this->entityType->isRevisionable()) { $this->database->delete($revision_name) ->condition('revision_id', $revision_id) + ->condition('deleted', 1) ->execute(); } } @@ -1684,6 +1687,12 @@ public function countFieldData($storage_definition, $as_bool = FALSE) { * Whether the field has been already deleted. */ protected function storageDefinitionIsDeleted(FieldStorageDefinitionInterface $storage_definition) { + // Configurable fields are marked for deletion. + if ($storage_definition instanceOf FieldStorageConfigInterface) { + return $storage_definition->isDeleted(); + } + // For non configurable fields check whether they are still in the last + // installed schema repository. return !array_key_exists($storage_definition->getName(), $this->entityManager->getLastInstalledFieldStorageDefinitions($this->entityTypeId)); } diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index fe2e008..60ae741 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -893,9 +893,9 @@ function hook_ENTITY_TYPE_storage_load(array $entities) { * @see hook_ENTITY_TYPE_presave() */ function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { - if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) { - $route_match = \Drupal::routeMatch(); - \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode')); + if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) { + $route_match = \Drupal::routeMatch(); + \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode')); } } @@ -1845,7 +1845,8 @@ function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\Ent * * @param string $operation * The operation to be performed. See - * \Drupal\Core\Access\AccessibleInterface::access() for possible values. + * \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess() + * for possible values. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The field definition. * @param \Drupal\Core\Session\AccountInterface $account @@ -1856,6 +1857,8 @@ function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\Ent * * @return \Drupal\Core\Access\AccessResultInterface * The access result. + * + * @see \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess() */ function hook_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, \Drupal\Core\Field\FieldItemListInterface $items = NULL) { if ($field_definition->getName() == 'field_of_interest' && $operation == 'edit') { diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index 4f44409..62f5486 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -30,14 +30,14 @@ class AuthenticationSubscriber implements EventSubscriberInterface { /** * Authentication provider filter. * - * @var \Drupal\Core\Authentication\AuthenticationProviderFilterInterface|NULL + * @var \Drupal\Core\Authentication\AuthenticationProviderFilterInterface|null */ protected $filter; /** * Authentication challenge provider. * - * @var \Drupal\Core\Authentication\AuthenticationProviderChallengeInterface|NULL + * @var \Drupal\Core\Authentication\AuthenticationProviderChallengeInterface|null */ protected $challengeProvider; diff --git a/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php index 8337d43..3c37195 100644 --- a/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php @@ -30,7 +30,7 @@ class EntityRouteAlterSubscriber implements EventSubscriberInterface { /** * Constructs an EntityRouteAlterSubscriber instance. * - * @param \Drupal\Core\Entity\EntityResolverManager + * @param \Drupal\Core\Entity\EntityResolverManager $entity_resolver_manager * The entity resolver manager. */ public function __construct(EntityResolverManager $entity_resolver_manager) { diff --git a/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php b/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php index 4b6d710..427d7f4 100644 --- a/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php +++ b/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php @@ -30,7 +30,7 @@ * valid UTF-8. */ public function fieldFilterXss($string) { - return FieldFilteredMarkup::create($string); + return FieldFilteredMarkup::create($string); } /** diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php index ebdb276..97dd493 100644 --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -257,7 +257,7 @@ public function view($display_options = array()) { /** * {@inheritdoc} */ - public function generateSampleItems($count = 1) { + public function generateSampleItems($count = 1) { $field_definition = $this->getFieldDefinition(); $field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType()); for ($delta = 0; $delta < $count; $delta++) { diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php index 2266c9c..f901cb7 100644 --- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -245,7 +245,7 @@ public function defaultValuesFormSubmit(array $element, array &$form, FormStateI * in order to be a valid runtime value for the field type; e.g., a date field * could process the defined value of 'NOW' to a valid date. * - * @param array + * @param array $default_value * The unprocessed default value defined for the field, as a numerically * indexed array of items, each item being an array of property/value pairs. * @param \Drupal\Core\Entity\FieldableEntityInterface $entity diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 09c6a12..84bb4c0 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -34,7 +34,7 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Extension\ModuleHandlerInterface + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. * @param \Drupal\Core\TypedData\TypedDataManagerInterface $typed_data_manager * The typed data manager. diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index e8832f3..398d260 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -617,7 +617,7 @@ public static function settingsAjaxSubmit($form, FormStateInterface $form_state) $form_state->setRebuild(); } - /** + /** * {@inheritdoc} */ public static function getPreconfiguredOptions() { diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php index add9cd7..ca00bcc 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php @@ -190,7 +190,7 @@ protected function sanitizeLabel(&$label) { /** * Returns the empty option label to add to the list of options, if any. * - * @return string|NULL + * @return string|null * Either a label of the empty option, or NULL. */ protected function getEmptyLabel() { } diff --git a/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php b/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php index 72df780..85d0261 100644 --- a/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php +++ b/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php @@ -31,7 +31,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { */ protected $sortedGuessers = NULL; - /** + /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface diff --git a/core/lib/Drupal/Core/Form/EnforcedResponse.php b/core/lib/Drupal/Core/Form/EnforcedResponse.php index c28033f..2b1466d 100644 --- a/core/lib/Drupal/Core/Form/EnforcedResponse.php +++ b/core/lib/Drupal/Core/Form/EnforcedResponse.php @@ -37,7 +37,7 @@ class EnforcedResponse extends Response { * @param \Exception $e * The exception where the enforced response is to be extracted from. * - * @return \Drupal\Core\Form\EnforcedResponse|NULL + * @return \Drupal\Core\Form\EnforcedResponse|null * The enforced response or NULL if the exception chain does not contain a * \Drupal\Core\Form\EnforcedResponseException exception. */ diff --git a/core/lib/Drupal/Core/Form/FormState.php b/core/lib/Drupal/Core/Form/FormState.php index ca7355d..33ca1fa 100644 --- a/core/lib/Drupal/Core/Form/FormState.php +++ b/core/lib/Drupal/Core/Form/FormState.php @@ -648,7 +648,7 @@ public function disableRedirect($no_redirect = TRUE) { * {@inheritdoc} */ public function isRedirectDisabled() { - return $this->no_redirect; + return $this->no_redirect; } /** diff --git a/core/lib/Drupal/Core/Form/FormStateInterface.php b/core/lib/Drupal/Core/Form/FormStateInterface.php index 26485a0..b1e3f3b 100644 --- a/core/lib/Drupal/Core/Form/FormStateInterface.php +++ b/core/lib/Drupal/Core/Form/FormStateInterface.php @@ -780,7 +780,7 @@ public function setRequestMethod($method); /** * Returns the HTTP form method. * - * @param string + * @param string $method_type * The HTTP form method. * * @return bool diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php index af1b2c9..2a1e61e 100644 --- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php @@ -123,7 +123,7 @@ protected function prepareArguments(array $arguments) { // Use the default value if the argument is not passed in. if (!array_key_exists($id, $arguments)) { - $arguments[$id] = $argument['default']; + $arguments[$id] = $argument['default']; } } } diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php index c6a3840..f5d1c7f 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php @@ -37,7 +37,7 @@ class SiteSettingsForm extends FormBase { public function __construct($site_path, RendererInterface $renderer) { $this->sitePath = $site_path; $this->renderer = $renderer; -} + } /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php b/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php index b8fe273..3825033 100644 --- a/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php +++ b/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php @@ -26,7 +26,7 @@ class CurrentLanguageContext implements ContextProviderInterface { /** * Constructs a new CurrentLanguageContext. * - * @param \Drupal\Core\Language\LanguageManagerInterface + * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. */ public function __construct(LanguageManagerInterface $language_manager) { diff --git a/core/lib/Drupal/Core/Mail/MailFormatHelper.php b/core/lib/Drupal/Core/Mail/MailFormatHelper.php index 080b326..3dffe83 100644 --- a/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -202,8 +202,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { // Ensure blank new-line. $chunk = ''; } - - // Fall-through. + // Intentional fall-through to the processing for '/li' and '/dd'. case '/li': case '/dd': array_pop($indent); @@ -212,6 +211,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { case '/h3': case '/h4': array_pop($indent); + // Intentional fall-through to the processing for '/h5' and '/h6'. case '/h5': case '/h6': // Ensure blank new-line. diff --git a/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php index 1435ff9..fbde1b8 100644 --- a/core/lib/Drupal/Core/Mail/MailInterface.php +++ b/core/lib/Drupal/Core/Mail/MailInterface.php @@ -30,7 +30,7 @@ * * @see \Drupal\Core\Mail\MailManagerInterface */ - public function format(array $message); + public function format(array $message); /** * Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail(). @@ -60,6 +60,6 @@ public function format(array $message); * @return bool * TRUE if the mail was successfully accepted for delivery, otherwise FALSE. */ - public function mail(array $message); + public function mail(array $message); } diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php index 29803ad..e264036 100644 --- a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php +++ b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php @@ -126,11 +126,11 @@ protected function getDiscovery() { public function processDefinition(&$definition, $plugin_id) { parent::processDefinition($definition, $plugin_id); - // If there is no route name, this is a broken definition. + // If there is no route name, this is a broken definition. if (empty($definition['route_name'])) { throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "route_name".', $plugin_id)); } - // If there is no group name, this is a broken definition. + // If there is no group name, this is a broken definition. if (empty($definition['group'])) { throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "group".', $plugin_id)); } diff --git a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php index 43c4468..7159083 100644 --- a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php +++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php @@ -37,7 +37,7 @@ class DefaultMenuLinkTreeManipulators { * * @var \Drupal\Core\Entity\Query\QueryFactory */ - protected $queryFactory; + protected $queryFactory; /** * Constructs a \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators object. diff --git a/core/lib/Drupal/Core/Menu/LocalActionDefault.php b/core/lib/Drupal/Core/Menu/LocalActionDefault.php index faa20a8..bfa088e 100644 --- a/core/lib/Drupal/Core/Menu/LocalActionDefault.php +++ b/core/lib/Drupal/Core/Menu/LocalActionDefault.php @@ -24,7 +24,7 @@ class LocalActionDefault extends PluginBase implements LocalActionInterface, Con * * @var \Drupal\Core\Routing\RouteProviderInterface */ - protected $routeProvider; + protected $routeProvider; /** * Constructs a LocalActionDefault object. diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index ec1df5c..26b2ed5 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -158,7 +158,7 @@ protected function getDiscovery() { */ public function processDefinition(&$definition, $plugin_id) { parent::processDefinition($definition, $plugin_id); - // If there is no route name, this is a broken definition. + // If there is no route name, this is a broken definition. if (empty($definition['route_name'])) { throw new PluginException(sprintf('Plugin (%s) definition must include "route_name"', $plugin_id)); } diff --git a/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php b/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php index ddcd39d..8410e5a 100644 --- a/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php +++ b/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php @@ -29,7 +29,7 @@ public function getActiveTrailIds($menu_name); * (optional) The menu within which to find the active link. If omitted, all * menus will be searched. * - * @return \Drupal\Core\Menu\MenuLinkInterface|NULL + * @return \Drupal\Core\Menu\MenuLinkInterface|null * The menu link for the given route name, parameters and menu, or NULL if * there is no matching menu link or the current user cannot access the * current page (i.e. we have a 403 response). diff --git a/core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php b/core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php index 1327c78..e7e12c4 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkTreeElement.php @@ -68,7 +68,7 @@ class MenuLinkTreeElement { * If the value is NULL the access was not determined yet, if an access result * object, it was determined already. * - * @var \Drupal\Core\Access\AccessResultInterface|NULL + * @var \Drupal\Core\Access\AccessResultInterface|null */ public $access; diff --git a/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php b/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php index 4ee308b..0a580d6 100644 --- a/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php @@ -41,7 +41,7 @@ public function rebuild(array $definitions); * @param string $id * The menu link plugin ID. * - * @return array|FALSE + * @return array|false * The plugin definition, or FALSE if no definition was found for the ID. */ public function load($id); diff --git a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php index a833a79..1a5c41d 100644 --- a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php +++ b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php @@ -21,7 +21,7 @@ public function reload(); * @param string $id * A menu link plugin ID. * - * @return array|NULL + * @return array|null * An override with following supported keys: * - parent * - weight diff --git a/core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php b/core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php index 9bd24a8..02b20cb 100644 --- a/core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php +++ b/core/lib/Drupal/Core/PageCache/RequestPolicyInterface.php @@ -39,7 +39,7 @@ * @param \Symfony\Component\HttpFoundation\Request $request * The incoming request object. * - * @return string|NULL + * @return string|null * One of static::ALLOW, static::DENY or NULL. Calling code may attempt to * deliver a cached page if static::ALLOW is returned. Returns NULL if the * policy is not specified for the given request. diff --git a/core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php b/core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php index a82427b..0d3f965 100644 --- a/core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php +++ b/core/lib/Drupal/Core/PageCache/ResponsePolicyInterface.php @@ -27,7 +27,7 @@ * @param \Symfony\Component\HttpFoundation\Request $request * The request object. * - * @return string|NULL + * @return string|null * Either static::DENY or NULL. Calling code may attempt to store a page in * the cache unless static::DENY is returned. Returns NULL if the policy * policy is not specified for the given response. diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php index 0368d43..3a31917 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -283,7 +283,7 @@ protected function pathAliasWhitelistRebuild($path = NULL) { if (!empty($path)) { if ($this->whitelist->get(strtok($path, '/'))) { return; - } + } } $this->whitelist->clear(); } diff --git a/core/lib/Drupal/Core/Plugin/Context/Context.php b/core/lib/Drupal/Core/Plugin/Context/Context.php index 87fab3a..35eaacd 100644 --- a/core/lib/Drupal/Core/Plugin/Context/Context.php +++ b/core/lib/Drupal/Core/Plugin/Context/Context.php @@ -42,7 +42,7 @@ class Context extends ComponentContext implements ContextInterface { * * @param \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context_definition * The context definition. - * @param mixed $context_value|NULL + * @param mixed $context_value|null * The context value object. */ public function __construct(ContextDefinitionInterface $context_definition, $context_value = NULL) { diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php index 37f7bbc..71cfaa1 100644 --- a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php +++ b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php @@ -85,7 +85,7 @@ public static function create($data_type = 'any') { * * @param string $data_type * The required data type. - * @param mixed string|null $label + * @param string|null $label * The label of this context definition for the UI. * @param bool $required * Whether the context definition is required. @@ -245,7 +245,7 @@ public function getDataDefinition() { ->setDescription($this->getDescription()) ->setRequired($this->isRequired()); $constraints = $definition->getConstraints() + $this->getConstraints(); - $definition->setConstraints($constraints); + $definition->setConstraints($constraints); return $definition; } diff --git a/core/lib/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php b/core/lib/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php index 852a47e..37ff0f7 100644 --- a/core/lib/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php +++ b/core/lib/Drupal/Core/Render/PageDisplayVariantSelectionEvent.php @@ -54,7 +54,7 @@ class PageDisplayVariantSelectionEvent extends Event implements RefinableCacheab /** * Constructs the page display variant plugin selection event. * - * @param string + * @param string $plugin_id * The ID of the page display variant plugin to use by default. * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The current route match, for context. diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php index 61cafc3..322761e 100644 --- a/core/lib/Drupal/Core/Render/theme.api.php +++ b/core/lib/Drupal/Core/Render/theme.api.php @@ -555,7 +555,7 @@ function hook_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormSta * The name of the theme hook. */ function hook_preprocess(&$variables, $hook) { - static $hooks; + static $hooks; // Add contextual links to the variables, if the user has permission. diff --git a/core/lib/Drupal/Core/Routing/StackedRouteMatchInterface.php b/core/lib/Drupal/Core/Routing/StackedRouteMatchInterface.php index 8cc4fb5..45b777c 100644 --- a/core/lib/Drupal/Core/Routing/StackedRouteMatchInterface.php +++ b/core/lib/Drupal/Core/Routing/StackedRouteMatchInterface.php @@ -28,7 +28,7 @@ public function getMasterRouteMatch(); /** * Returns the parent route match of the current. * - * @return \Drupal\Core\Routing\RouteMatchInterface|NULL + * @return \Drupal\Core\Routing\RouteMatchInterface|null * The parent route match or NULL, if it the master route match. */ public function getParentRouteMatch(); @@ -36,10 +36,10 @@ public function getParentRouteMatch(); /** * Returns a route match from a given request, if possible. * - * @param \Symfony\Component\HttpFoundation\Request + * @param \Symfony\Component\HttpFoundation\Request $request * The request. * - * @return \Drupal\Core\Routing\RouteMatchInterface|NULL + * @return \Drupal\Core\Routing\RouteMatchInterface|null * THe matching route match, or NULL if there is no matching one. */ public function getRouteMatchFromRequest(Request $request); diff --git a/core/lib/Drupal/Core/Session/AccountProxy.php b/core/lib/Drupal/Core/Session/AccountProxy.php index a50a289..7aa95ae 100644 --- a/core/lib/Drupal/Core/Session/AccountProxy.php +++ b/core/lib/Drupal/Core/Session/AccountProxy.php @@ -179,7 +179,7 @@ public function setInitialAccountId($account_id) { * @param int $account_id * The id of an account to load. * - * @return \Drupal\Core\Session\AccountInterface|NULL + * @return \Drupal\Core\Session\AccountInterface|null * An account or NULL if none is found. */ protected function loadUserEntity($account_id) { diff --git a/core/lib/Drupal/Core/Session/PermissionsHashGenerator.php b/core/lib/Drupal/Core/Session/PermissionsHashGenerator.php index 767d2b4..e172537 100644 --- a/core/lib/Drupal/Core/Session/PermissionsHashGenerator.php +++ b/core/lib/Drupal/Core/Session/PermissionsHashGenerator.php @@ -40,7 +40,7 @@ class PermissionsHashGenerator implements PermissionsHashGeneratorInterface { * The private key service. * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend interface to use for the persistent cache. - * @param \Drupal\Core\Cache\CacheBackendInterface + * @param \Drupal\Core\Cache\CacheBackendInterface $static * The cache backend interface to use for the static cache. */ public function __construct(PrivateKey $private_key, CacheBackendInterface $cache, CacheBackendInterface $static) { diff --git a/core/lib/Drupal/Core/Session/SessionConfiguration.php b/core/lib/Drupal/Core/Session/SessionConfiguration.php index 351e57d..49dc63e 100644 --- a/core/lib/Drupal/Core/Session/SessionConfiguration.php +++ b/core/lib/Drupal/Core/Session/SessionConfiguration.php @@ -141,7 +141,7 @@ protected function getCookieDomain(Request $request) { /** * Wraps drupal_valid_test_ua(). * - * @return string|FALSE + * @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. diff --git a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php index 52f05e4..f278353 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php @@ -66,7 +66,7 @@ public function getExternalUrl() { public static function baseUrl() { $settings_base_url = Settings::get('file_public_base_url', ''); if ($settings_base_url) { - return (string) $settings_base_url; + return (string) $settings_base_url; } else { return $GLOBALS['base_url'] . '/' . static::basePath(); diff --git a/core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php b/core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php index 367581b..e0fee16 100644 --- a/core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php +++ b/core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php @@ -17,7 +17,7 @@ * @param string $context * The string context. * - * @return string|FALSE + * @return string|false * Translated string if there is a translation, FALSE if not. */ public function getStringTranslation($langcode, $string, $context); diff --git a/core/lib/Drupal/Core/Theme/ThemeNegotiator.php b/core/lib/Drupal/Core/Theme/ThemeNegotiator.php index 1d6b589..3064eb0 100644 --- a/core/lib/Drupal/Core/Theme/ThemeNegotiator.php +++ b/core/lib/Drupal/Core/Theme/ThemeNegotiator.php @@ -24,7 +24,7 @@ class ThemeNegotiator implements ThemeNegotiatorInterface { * * Set to NULL if the array needs to be re-calculated. * - * @var array|NULL + * @var array|null */ protected $sortedNegotiators; diff --git a/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php b/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php index 4ae187b..64d779c 100644 --- a/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php +++ b/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php @@ -44,7 +44,7 @@ * If an unsupported data type gets passed to the class; e.g., 'string' to a * definition class handling 'entity:* data types. */ - public static function createFromDataType($data_type); + public static function createFromDataType($data_type); /** * Returns the data type of the data. diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php b/core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php index 16a910c..20a4a76 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php @@ -192,7 +192,7 @@ public function getValidationConstraintManager(); * The validation constraint manager is used to instantiate validation * constraint plugins. * - * @param \Drupal\Core\Validation\ConstraintManager + * @param \Drupal\Core\Validation\ConstraintManager $constraintManager * The constraint manager to set. */ public function setValidationConstraintManager(ConstraintManager $constraintManager); diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 6a58319..e7624d8 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -845,7 +845,7 @@ protected function unroutedUrlAssembler() { /** * Sets the URL generator. * - * @param \Drupal\Core\Routing\UrlGeneratorInterface + * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator * (optional) The URL generator, specify NULL to reset it. * * @return $this @@ -859,7 +859,7 @@ public function setUrlGenerator(UrlGeneratorInterface $url_generator = NULL) { /** * Sets the unrouted URL assembler. * - * @param \Drupal\Core\Utility\UnroutedUrlAssemblerInterface + * @param \Drupal\Core\Utility\UnroutedUrlAssemblerInterface $url_assembler * The unrouted URL assembler. * * @return $this diff --git a/core/lib/Drupal/Core/Utility/ProjectInfo.php b/core/lib/Drupal/Core/Utility/ProjectInfo.php index 1eed1fe..24043d3 100644 --- a/core/lib/Drupal/Core/Utility/ProjectInfo.php +++ b/core/lib/Drupal/Core/Utility/ProjectInfo.php @@ -172,7 +172,7 @@ function getProjectName(Extension $file) { * @return * Array of .info.yml file data we need for the update manager. * - * @see \Drupal\Core\Utility\ProjectInfo->processInfoList() + * @see \Drupal\Core\Utility\ProjectInfo::processInfoList() */ function filterProjectInfo($info, $additional_whitelist = array()) { $whitelist = array( diff --git a/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php index 919571c..8dbf42e 100644 --- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -53,7 +53,7 @@ function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $l $this->tags = $tags; $this->persistable = $modules_loaded && \Drupal::hasRequest() && \Drupal::request()->isMethod('GET'); - // @todo: Implement lazyload. + // @todo: Implement lazyload. $this->cacheLoaded = TRUE; if ($this->persistable && $cached = $this->cache->get($this->cid)) { diff --git a/core/modules/action/src/ActionListBuilder.php b/core/modules/action/src/ActionListBuilder.php index 0902403..0a54cd6 100644 --- a/core/modules/action/src/ActionListBuilder.php +++ b/core/modules/action/src/ActionListBuilder.php @@ -108,10 +108,10 @@ public function getDefaultOperations(EntityInterface $entity) { * {@inheritdoc} */ public function render() { - $build['action_header']['#markup'] = '
' . t('The Datetime Range module provides a Date field that stores start dates and times, as well as end dates and times. See the Field module help and the Field UI module help pages for general information on fields and how to create and manage them. For more information, see the online documentation for the Datetime Range module.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', ':datetime_do' => 'https://www.drupal.org/documentation/modules/datetime_range')) . '
'; + $output .= '' . $this->t('This login can be used only once.') . '
'); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => $this->t('Log in'), ); + $form['#action'] = Url::fromRoute('user.reset.login', [ + 'uid' => $user->id(), + 'timestamp' => $timestamp, + 'hash' => $hash, + ])->toString(); return $form; } @@ -96,22 +65,8 @@ public function buildForm(array $form, FormStateInterface $form_state, AccountIn * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - /** @var $user \Drupal\user\UserInterface */ - $user = $form_state->getValue('user'); - user_login_finalize($user); - $this->logger->notice('User %name used one-time login link at time %timestamp.', array('%name' => $user->getUsername(), '%timestamp' => $form_state->getValue('timestamp'))); - drupal_set_message($this->t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.')); - // Let the user's password be changed without the current password check. - $token = Crypt::randomBytesBase64(55); - $_SESSION['pass_reset_' . $user->id()] = $token; - $form_state->setRedirect( - 'entity.user.edit_form', - array('user' => $user->id()), - array( - 'query' => array('pass-reset-token' => $token), - 'absolute' => TRUE, - ) - ); + // This form works by submitting the hash and timestamp to the user.reset + // route with a 'login' action. } } diff --git a/core/modules/user/src/Form/UserPermissionsForm.php b/core/modules/user/src/Form/UserPermissionsForm.php index 7a06219..75bbaf2 100644 --- a/core/modules/user/src/Form/UserPermissionsForm.php +++ b/core/modules/user/src/Form/UserPermissionsForm.php @@ -42,7 +42,7 @@ class UserPermissionsForm extends FormBase { * The permission handler. * @param \Drupal\user\RoleStorageInterface $role_storage * The role storage. - * @param \Drupal\Core\Extension\ModuleHandlerInterface + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ public function __construct(PermissionHandlerInterface $permission_handler, RoleStorageInterface $role_storage, ModuleHandlerInterface $module_handler) { diff --git a/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php b/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php index 2f95a75..0efae5d 100644 --- a/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php +++ b/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php @@ -25,11 +25,11 @@ class UserUpdate7002 extends ProcessPluginBase implements ContainerFactoryPlugin */ protected static $timezones; - /** - * Contains the system.theme configuration object. - * - * @var \Drupal\Core\Config\Config - */ + /** + * Contains the system.theme configuration object. + * + * @var \Drupal\Core\Config\Config + */ protected $dateConfig; /** diff --git a/core/modules/user/src/Plugin/views/field/Permissions.php b/core/modules/user/src/Plugin/views/field/Permissions.php index 42c78d2..bd5c11d 100644 --- a/core/modules/user/src/Plugin/views/field/Permissions.php +++ b/core/modules/user/src/Plugin/views/field/Permissions.php @@ -112,16 +112,4 @@ function render_item($count, $item) { return $item['permission']; } - /* - protected function documentSelfTokens(&$tokens) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = $this->t('The name of the role.'); - $tokens['[' . $this->options['id'] . '-rid' . ']'] = $this->t('The role ID of the role.'); - } - - protected function addSelfTokens(&$tokens, $item) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = $item['role']; - $tokens['[' . $this->options['id'] . '-rid' . ']'] = $item['rid']; - } - */ - } diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php index 5f63cb3..e241e87 100644 --- a/core/modules/user/src/Plugin/views/filter/Name.php +++ b/core/modules/user/src/Plugin/views/filter/Name.php @@ -96,9 +96,9 @@ protected function valueSubmit($form, FormStateInterface $form_state) { // prevent array filter from removing our anonymous user. } -/** - * {@inheritdoc} - */ + /** + * {@inheritdoc} + */ public function getValueOptions() { return $this->valueOptions; } diff --git a/core/modules/user/src/Tests/UserBlocksTest.php b/core/modules/user/src/Tests/UserBlocksTest.php index 40e63d8..f66007e 100644 --- a/core/modules/user/src/Tests/UserBlocksTest.php +++ b/core/modules/user/src/Tests/UserBlocksTest.php @@ -34,9 +34,9 @@ protected function setUp() { $this->drupalLogout($this->adminUser); } - /** - * Tests that user login block is hidden from user/login. - */ + /** + * Tests that user login block is hidden from user/login. + */ function testUserLoginBlockVisibility() { // Array keyed list where key being the URL address and value being expected // visibility as boolean type. @@ -51,7 +51,7 @@ function testUserLoginBlockVisibility() { $elements = $this->xpath('//div[contains(@class,"block-user-login-block") and @role="form"]'); if ($expected_visibility) { $this->assertTrue(!empty($elements), 'User login block in path "' . $path . '" should be visible'); - } + } else { $this->assertTrue(empty($elements), 'User login block in path "' . $path . '" should not be visible'); } diff --git a/core/modules/user/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php index 0fa89e5..c012e9f 100644 --- a/core/modules/user/src/Tests/UserPasswordResetTest.php +++ b/core/modules/user/src/Tests/UserPasswordResetTest.php @@ -2,6 +2,8 @@ namespace Drupal\user\Tests; +use Drupal\Component\Render\FormattableMarkup; +use Drupal\Core\Url; use Drupal\system\Tests\Cache\PageCacheTagsTestBase; use Drupal\user\Entity\User; @@ -68,6 +70,11 @@ protected function setUp() { * Tests password reset functionality. */ function testUserPasswordReset() { + // Verify that accessing the password reset form without having the session + // variables set results in an access denied message. + $this->drupalGet(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()])); + $this->assertResponse(403); + // Try to reset the password for an invalid account. $this->drupalGet('user/password'); @@ -81,13 +88,16 @@ function testUserPasswordReset() { $edit['name'] = $this->account->getUsername(); $this->drupalPostForm(NULL, $edit, t('Submit')); - // Verify that the user was sent an email. + // Verify that the user was sent an email. $this->assertMail('to', $this->account->getEmail(), 'Password email sent to user.'); $subject = t('Replacement login information for @username at @site', array('@username' => $this->account->getUsername(), '@site' => $this->config('system.site')->get('name'))); $this->assertMail('subject', $subject, 'Password reset email subject is correct.'); $resetURL = $this->getResetURL(); $this->drupalGet($resetURL); + // Ensure that the current url does not contain the hash and timestamp. + $this->assertUrl(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()])); + $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache')); // Ensure the password reset URL is not cached. @@ -125,6 +135,7 @@ function testUserPasswordReset() { // Log out, and try to log in again using the same one-time link. $this->drupalLogout(); $this->drupalGet($resetURL); + $this->drupalPostForm(NULL, NULL, t('Log in')); $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.'); // Request a new password again, this time using the email address. @@ -149,6 +160,7 @@ function testUserPasswordReset() { $bogus_timestamp = REQUEST_TIME - $timeout - 60; $_uid = $this->account->id(); $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account, $bogus_timestamp)); + $this->drupalPostForm(NULL, NULL, t('Log in')); $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.'); // Create a user, block the account, and verify that a login link is denied. @@ -175,7 +187,31 @@ function testUserPasswordReset() { $this->account->setEmail("1" . $this->account->getEmail()); $this->account->save(); $this->drupalGet($old_email_reset_link); + $this->drupalPostForm(NULL, NULL, t('Log in')); $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.'); + + // Verify a password reset link will automatically log a user when /login is + // appended. + $this->drupalGet('user/password'); + $edit = array('name' => $this->account->getUsername()); + $this->drupalPostForm(NULL, $edit, t('Submit')); + $reset_url = $this->getResetURL(); + $this->drupalGet($reset_url . '/login'); + $this->assertLink(t('Log out')); + $this->assertTitle(t('@name | @site', array('@name' => $this->account->getUsername(), '@site' => $this->config('system.site')->get('name'))), 'Logged in using password reset link.'); + + // Ensure blocked and deleted accounts can't access the user.reset.login + // route. + $this->drupalLogout(); + $timestamp = REQUEST_TIME - 1; + $blocked_account = $this->drupalCreateUser()->block(); + $blocked_account->save(); + $this->drupalGet("user/reset/" . $blocked_account->id() . "/$timestamp/" . user_pass_rehash($blocked_account, $timestamp) . '/login'); + $this->assertResponse(403); + + $blocked_account->delete(); + $this->drupalGet("user/reset/" . $blocked_account->id() . "/$timestamp/" . user_pass_rehash($blocked_account, $timestamp) . '/login'); + $this->assertResponse(403); } /** @@ -195,6 +231,25 @@ public function getResetURL() { * Test user password reset while logged in. */ public function testUserPasswordResetLoggedIn() { + $another_account = $this->drupalCreateUser(); + $this->drupalLogin($another_account); + $this->drupalGet('user/password'); + $this->drupalPostForm(NULL, NULL, t('Submit')); + + // Click the reset URL while logged and change our password. + $resetURL = $this->getResetURL(); + // Log in as a different user. + $this->drupalLogin($this->account); + $this->drupalGet($resetURL); + $this->assertRaw(new FormattableMarkup( + 'Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please log out and try using the link again.', + ['%other_user' => $this->account->getUsername(), '%resetting_user' => $another_account->getUsername(), ':logout' => Url::fromRoute('user.logout')->toString()] + )); + + $another_account->delete(); + $this->drupalGet($resetURL); + $this->assertText('The one-time login link you clicked is invalid.'); + // Log in. $this->drupalLogin($this->account); @@ -212,6 +267,14 @@ public function testUserPasswordResetLoggedIn() { $edit = array('pass[pass1]' => $password, 'pass[pass2]' => $password); $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertText(t('The changes have been saved.'), 'Password changed.'); + + // Logged in users should not be able to access the user.reset.login or the + // user.reset.form routes. + $timestamp = REQUEST_TIME - 1; + $this->drupalGet("user/reset/" . $this->account->id() . "/$timestamp/" . user_pass_rehash($this->account, $timestamp) . '/login'); + $this->assertResponse(403); + $this->drupalGet("user/reset/" . $this->account->id()); + $this->assertResponse(403); } /** @@ -265,9 +328,10 @@ function testResetImpersonation() { $reset_url = user_pass_reset_url($user1); $attack_reset_url = str_replace("user/reset/{$user1->id()}", "user/reset/{$user2->id()}", $reset_url); $this->drupalGet($attack_reset_url); + $this->drupalPostForm(NULL, NULL, t('Log in')); $this->assertNoText($user2->getUsername(), 'The invalid password reset page does not show the user name.'); $this->assertUrl('user/password', array(), 'The user is redirected to the password reset request page.'); $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'); - } + } } diff --git a/core/modules/user/src/UserServiceProvider.php b/core/modules/user/src/UserServiceProvider.php index 79715df..49537e5 100644 --- a/core/modules/user/src/UserServiceProvider.php +++ b/core/modules/user/src/UserServiceProvider.php @@ -1,5 +1,8 @@ delete('config')->condition('name', 'user.mail')->execute(); $connection->insert('config') -->fields(array('collection', 'name', 'data')) -->values(array( + ->fields(array('collection', 'name', 'data')) + ->values(array( 'collection' => '', 'name' => 'user.mail', 'data' => "a:10:{s:14:\"cancel_confirm\";a:2:{s:4:\"body\";s:369:\"[user:name],\n\nA request to cancel your account has been made at [site:name].\n\nYou may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:\n\n[user:cancel-url]\n\nNOTE: The cancellation of your account is not reversible.\n\nThis link expires in one day and nothing will happen if it is not used.\n\n-- [site:name] team\";s:7:\"subject\";s:59:\"Account cancellation request for [user:name] at [site:name]\";}s:14:\"password_reset\";a:2:{s:4:\"body\";s:397:\"[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\n\n-- [site:name] team\";s:7:\"subject\";s:60:\"Replacement login information for [user:name] at [site:name]\";}s:22:\"register_admin_created\";a:2:{s:4:\"body\";s:463:\"[user:name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:58:\"An administrator created an account for you at [site:name]\";}s:29:\"register_no_approval_required\";a:2:{s:4:\"body\";s:437:\"[user:name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:46:\"Account details for [user:name] at [site:name]\";}s:25:\"register_pending_approval\";a:2:{s:4:\"body\";s:281:\"[user:name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n\n-- [site:name] team\";s:7:\"subject\";s:71:\"Account details for [user:name] at [site:name] (pending admin approval)\";}s:31:\"register_pending_approval_admin\";a:2:{s:4:\"body\";s:56:\"[user:name] has applied for an account.\n\n[user:edit-url]\";s:7:\"subject\";s:71:\"Account details for [user:name] at [site:name] (pending admin approval)\";}s:16:\"status_activated\";a:2:{s:4:\"body\";s:446:\"[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:57:\"Account details for [user:name] at [site:name] (approved)\";}s:14:\"status_blocked\";a:2:{s:4:\"body\";s:89:\"[user:name],\n\nYour account on [site:account-name] has been blocked.\n\n-- [site:name] team\";s:7:\"subject\";s:56:\"Account details for [user:name] at [site:name] (blocked)\";}s:15:\"status_canceled\";a:2:{s:4:\"body\";s:82:\"[user:name],\n\nYour account on [site:name] has been canceled.\n\n-- [site:name] team\";s:7:\"subject\";s:57:\"Account details for [user:name] at [site:name] (canceled)\";}s:8:\"langcode\";s:2:\"en\";}" diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php index 593d8c4..b0b91da 100644 --- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php +++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php @@ -105,25 +105,25 @@ public function testBuildPermissionsYaml() { $url = vfsStream::url('modules'); mkdir($url . '/module_a'); - file_put_contents($url . '/module_a/module_a.permissions.yml', -"access_module_a: single_description" - ); + file_put_contents($url . '/module_a/module_a.permissions.yml', "access_module_a: single_description"); mkdir($url . '/module_b'); - file_put_contents($url . '/module_b/module_b.permissions.yml', -"'access module b': + file_put_contents($url . '/module_b/module_b.permissions.yml', <<