diff --git a/.eslintrc b/.eslintrc index 9c0e3e6..0ebfd5a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,97 @@ { - "extends": "./core/.eslintrc" + "extends": "eslint:recommended", + "env": { + "browser": true + }, + "globals": { + "Drupal": true, + "drupalSettings": true, + "drupalTranslations": true, + "domready": true, + "jQuery": true, + "_": true, + "matchMedia": true, + "Backbone": true, + "Modernizr": true, + "CKEDITOR": true + }, + "rules": { + // Errors. + "array-bracket-spacing": [2, "never"], + "block-scoped-var": 2, + "brace-style": [2, "stroustrup", {"allowSingleLine": true}], + "comma-dangle": [2, "never"], + "comma-spacing": 2, + "comma-style": [2, "last"], + "computed-property-spacing": [2, "never"], + "curly": [2, "all"], + "eol-last": 2, + "eqeqeq": [2, "smart"], + "guard-for-in": 2, + "indent": [2, 2, {"SwitchCase": 1}], + "key-spacing": [2, {"beforeColon": false, "afterColon": true}], + "linebreak-style": [2, "unix"], + "lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false}], + "new-parens": 2, + "no-array-constructor": 2, + "no-caller": 2, + "no-catch-shadow": 2, + "no-empty-label": 2, + "no-eval": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-parens": [2, "functions"], + "no-implied-eval": 2, + "no-iterator": 2, + "no-label-var": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-loop-func": 2, + "no-multi-spaces": 2, + "no-multi-str": 2, + "no-native-reassign": 2, + "no-nested-ternary": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-process-exit": 2, + "no-proto": 2, + "no-return-assign": 2, + "no-script-url": 2, + "no-sequences": 2, + "no-shadow-restricted-names": 2, + "no-spaced-func": 2, + "no-trailing-spaces": 2, + "no-undef-init": 2, + "no-undefined": 2, + "no-unused-expressions": 2, + "no-unused-vars": [2, {"vars": "all", "args": "none"}], + "no-with": 2, + "object-curly-spacing": [2, "never"], + "one-var": [2, "never"], + "quote-props": [2, "consistent-as-needed"], + "quotes": [2, "single", "avoid-escape"], + "semi": [2, "always"], + "semi-spacing": [2, {"before": false, "after": true}], + "space-after-keywords": [2, "always"], + "space-before-blocks": [2, "always"], + "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], + "space-in-parens": [2, "never"], + "space-infix-ops": 2, + "space-return-throw-case": 2, + "space-unary-ops": [2, { "words": true, "nonwords": false }], + "spaced-comment": [2, "always"], + "strict": 2, + "yoda": [2, "never"], + // Warnings. + "max-nested-callbacks": [1, 3], + "valid-jsdoc": [1, { + "prefer": { + "returns": "return", + "property": "prop" + }, + "requireReturn": false + }] + } } diff --git a/.htaccess b/.htaccess index 974999a..01c63af 100644 --- a/.htaccess +++ b/.htaccess @@ -3,7 +3,7 @@ # # Protect files and directories from prying eyes. - + Require all denied diff --git a/composer.lock b/composer.lock index e092980..a406a5d 100644 --- a/composer.lock +++ b/composer.lock @@ -2570,16 +2570,16 @@ }, { "name": "jcalderonzumba/gastonjs", - "version": "v1.0.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/jcalderonzumba/gastonjs.git", - "reference": "21bebb8ca03eb0f93ec2f3fad61192fb079e2622" + "reference": "5e231b4df98275c404e1371fc5fadd34f6a121ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jcalderonzumba/gastonjs/zipball/21bebb8ca03eb0f93ec2f3fad61192fb079e2622", - "reference": "21bebb8ca03eb0f93ec2f3fad61192fb079e2622", + "url": "https://api.github.com/repos/jcalderonzumba/gastonjs/zipball/5e231b4df98275c404e1371fc5fadd34f6a121ad", + "reference": "5e231b4df98275c404e1371fc5fadd34f6a121ad", "shasum": "" }, "require": { @@ -2623,7 +2623,7 @@ "headless", "phantomjs" ], - "time": "2016-01-18 09:21:03" + "time": "2015-10-07 11:40:41" }, { "name": "jcalderonzumba/mink-phantomjs-driver", @@ -3739,7 +3739,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "jcalderonzumba/gastonjs": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/core/.eslintrc b/core/.eslintrc deleted file mode 100644 index 7e88b38..0000000 --- a/core/.eslintrc +++ /dev/null @@ -1,95 +0,0 @@ -{ - "extends": "eslint:recommended", - "env": { - "browser": true - }, - "globals": { - "Drupal": true, - "drupalSettings": true, - "drupalTranslations": true, - "domready": true, - "jQuery": true, - "_": true, - "matchMedia": true, - "Backbone": true, - "Modernizr": true, - "CKEDITOR": true - }, - "rules": { - // Errors. - "array-bracket-spacing": [2, "never"], - "block-scoped-var": 2, - "brace-style": [2, "stroustrup", {"allowSingleLine": true}], - "comma-dangle": [2, "never"], - "comma-spacing": 2, - "comma-style": [2, "last"], - "computed-property-spacing": [2, "never"], - "curly": [2, "all"], - "eol-last": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "key-spacing": [2, {"beforeColon": false, "afterColon": true}], - "keyword-spacing": [2, {"before": true, "after": true}], - "linebreak-style": [2, "unix"], - "lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false}], - "new-parens": 2, - "no-array-constructor": 2, - "no-caller": 2, - "no-catch-shadow": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-parens": [2, "functions"], - "no-implied-eval": 2, - "no-iterator": 2, - "no-label-var": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-loop-func": 2, - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-native-reassign": 2, - "no-nested-ternary": 2, - "no-new-func": 2, - "no-new-object": 2, - "no-new-wrappers": 2, - "no-octal-escape": 2, - "no-process-exit": 2, - "no-proto": 2, - "no-return-assign": 2, - "no-script-url": 2, - "no-sequences": 2, - "no-shadow-restricted-names": 2, - "no-spaced-func": 2, - "no-trailing-spaces": 2, - "no-undef-init": 2, - "no-undefined": 2, - "no-unused-expressions": 2, - "no-unused-vars": [2, {"vars": "all", "args": "none"}], - "no-with": 2, - "object-curly-spacing": [2, "never"], - "one-var": [2, "never"], - "quote-props": [2, "consistent-as-needed"], - "quotes": [2, "single", "avoid-escape"], - "semi": [2, "always"], - "semi-spacing": [2, {"before": false, "after": true}], - "space-before-blocks": [2, "always"], - "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], - "space-in-parens": [2, "never"], - "space-infix-ops": 2, - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": [2, "always"], - "strict": 2, - "yoda": [2, "never"], - // Warnings. - "max-nested-callbacks": [1, 3], - "valid-jsdoc": [1, { - "prefer": { - "returns": "return", - "property": "prop" - }, - "requireReturn": false - }] - } -} diff --git a/core/INSTALL.txt b/core/INSTALL.txt index ed1304a..6a0bb9a 100644 --- a/core/INSTALL.txt +++ b/core/INSTALL.txt @@ -88,7 +88,7 @@ INSTALLATION 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 drupal-x.y.z/.gitattributes /path/to/your/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 /path/to/your/installation 2. Create the Drupal database. diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index 021f5a4..1fa3118 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -24,8 +24,7 @@ Drupal 8 - Alex Pott 'alexpott' https://www.drupal.org/u/alexpott (Framework Manager) -Provisional membership: -- Scott Reeves 'Cottser' https://www.drupal.org/u/cottser +Provisional membership: None at this time. Drupal 7 - David Rothstein 'David_Rothstein' https://www.drupal.org/u/david_rothstein @@ -88,6 +87,7 @@ Cron system CSS - John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin +- Lewis Nyman 'LewisNyman' https://www.drupal.org/u/lewisnyman Database system - Larry Garfield 'Crell' https://www.drupal.org/u/crell @@ -391,10 +391,6 @@ Number module Options module - Yves Chedemois 'yched' https://www.drupal.org/u/yched -Page Cache module -- Lorenz Schori 'znerol' https://www.drupal.org/u/znerol -- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx - Path module - ? @@ -490,10 +486,7 @@ Classy theme - Morten Birch Heide-Jørgensen 'mortendk' https://www.drupal.org/u/mortendk Seven theme -- ? - -Stable theme -- Scott Reeves 'Cottser' https://www.drupal.org/u/cottser +- Lewis Nyman 'LewisNyman' https://www.drupal.org/u/lewisnyman Stark theme - John Albin Wilkins 'JohnAlbin' https://www.drupal.org/u/johnalbin diff --git a/core/composer.json b/core/composer.json index 024a387..1eabf49 100644 --- a/core/composer.json +++ b/core/composer.json @@ -34,7 +34,7 @@ "require-dev": { "behat/mink": "~1.6", "behat/mink-goutte-driver": "~1.2", - "jcalderonzumba/gastonjs": "~1.0.2", + "jcalderonzumba/gastonjs": "^1.1@dev", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsStream": "~1.2", "phpunit/phpunit": "~4.8", diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index 4ab0fd7..3edb8057 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -87,22 +87,12 @@ color_hex: # 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: langcode: type: string label: 'Language code' - _core: - type: _core_config_info # Mail text with subject and body parts. mail: @@ -291,8 +281,6 @@ config_entity: label: 'Third party settings' sequence: type: '[%parent.%parent.%type].third_party.[%key]' - _core: - type: _core_config_info block_settings: type: mapping diff --git a/core/core.api.php b/core/core.api.php index ee32e87..086a1a9 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -344,7 +344,7 @@ * Configuration entity classes expose dependencies by overriding the * \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies() * method. - * - On routes for paths starting with '/admin' or otherwise designated as + * - On routes for paths staring with '/admin' or otherwise designated as * administration paths (such as node editing when it is set as an admin * operation), if they have configuration entity placeholders, configuration * entities are normally loaded in their original language, without @@ -1045,8 +1045,8 @@ * - The class name needs to end in the word Test. * - The namespace must be a subspace/subdirectory of \Drupal\yourmodule\Tests, * where yourmodule is your module's machine name. - * - The test class file must be named and placed under the - * yourmodule/tests/src/Unit directory, according to the PSR-4 standard. + * - The test class file must be named and placed under the yourmodule/tests/src + * directory, according to the PSR-4 standard. * - Your test class needs a phpDoc comment block with a description and * a @group annotation, which gives information about the test. * - Methods in your test class whose names start with 'test' are the actual @@ -1071,7 +1071,7 @@ * $modules member variable -- keep in mind that by default, WebTestBase uses * a "testing" install profile, with a minimal set of modules enabled. * - For functional tests that do not test web output, define a class that - * extends \Drupal\KernelTests\KernelTestBase. This class is much faster + * extends \Drupal\simpletest\KernelTestBase. This class is much faster * than WebTestBase, because instead of making a full install of Drupal, it * uses an in-memory pseudo-installation (similar to what the installer and * update scripts use). To use this test class, you will need to create the diff --git a/core/includes/batch.inc b/core/includes/batch.inc index a4b5378..6d0c835 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -203,7 +203,7 @@ function _batch_progress_page() { * exceeded. It will continue with the next operation of the same batch set in * the next request. * - * @return array + * @return * An array containing a completion value (in percent) and a status message. */ function _batch_process() { @@ -337,15 +337,15 @@ function _batch_process() { /** * Formats the percent completion for a batch set. * - * @param int $total + * @param $total * The total number of operations. - * @param int|float $current + * @param $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 + * @return * 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 @@ -372,9 +372,8 @@ function &_batch_current_set() { * 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. + * @return + * TRUE if a subsequent set was found in the batch. */ function _batch_next_set() { $batch = &batch_get(); diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 86e12c7..ce872d4 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -258,10 +258,11 @@ function drupal_get_path($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. + * supported by the + * @link https://www.drupal.org/node/322729 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. diff --git a/core/includes/form.inc b/core/includes/form.inc index c1c82c1..a3d17a7 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -325,10 +325,6 @@ function template_preprocess_vertical_tabs(&$variables) { */ function template_preprocess_input(&$variables) { $element = $variables['element']; - // Remove name attribute if empty, for W3C compliance. - if (isset($variables['attributes']['name']) && empty((string) $variables['attributes']['name'])) { - unset($variables['attributes']['name']); - } $variables['children'] = $element['#children']; } @@ -886,13 +882,15 @@ function &batch_get() { * * Depending on whether the batch is progressive or not, the * Drupal\Core\Queue\Batch or Drupal\Core\Queue\BatchMemory handler classes will - * be used. The name and class of the queue are added by reference to the - * batch set. + * be used. * * @param $batch * The batch array. * @param $set_id * The id of the set to process. + * + * @return + * The name and class of the queue are added by reference to the batch set. */ function _batch_populate_queue(&$batch, $set_id) { $batch_set = &$batch['sets'][$set_id]; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 25cc7c4..5da67fb 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -328,10 +328,10 @@ function theme_get_setting($setting_name, $theme = NULL) { // Generate the path to the logo image. if ($cache[$theme]->get('logo.use_default')) { - $cache[$theme]->set('logo.url', file_url_transform_relative(file_create_url($theme_object->getPath() . '/logo.svg'))); + $cache[$theme]->set('logo.url', file_create_url($theme_object->getPath() . '/logo.svg')); } elseif ($logo_path = $cache[$theme]->get('logo.path')) { - $cache[$theme]->set('logo.url', file_url_transform_relative(file_create_url($logo_path))); + $cache[$theme]->set('logo.url', file_create_url($logo_path)); } // Generate the path to the favicon. @@ -339,14 +339,14 @@ function theme_get_setting($setting_name, $theme = NULL) { $favicon_path = $cache[$theme]->get('favicon.path'); if ($cache[$theme]->get('favicon.use_default')) { if (file_exists($favicon = $theme_object->getPath() . '/favicon.ico')) { - $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url($favicon))); + $cache[$theme]->set('favicon.url', file_create_url($favicon)); } else { - $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url('core/misc/favicon.ico'))); + $cache[$theme]->set('favicon.url', file_create_url('core/misc/favicon.ico')); } } elseif ($favicon_path) { - $cache[$theme]->set('favicon.url', file_url_transform_relative(file_create_url($favicon_path))); + $cache[$theme]->set('favicon.url', file_create_url($favicon_path)); } else { $cache[$theme]->set('features.favicon', FALSE); @@ -727,8 +727,7 @@ function template_preprocess_links(&$variables) { * to an empty string, but can be set to NULL for the attribute to be * omitted. Usually, neither omission nor an empty string satisfies * accessibility requirements, so it is strongly encouraged for code - * building variables for image.html.twig templates to pass a meaningful - * value for this variable. + * calling _theme('image') to pass a meaningful value for this variable. * - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 * - http://www.w3.org/TR/xhtml1/dtds.html * - http://dev.w3.org/html5/spec/Overview.html#alt @@ -741,7 +740,7 @@ function template_preprocess_links(&$variables) { */ function template_preprocess_image(&$variables) { if (!empty($variables['uri'])) { - $variables['attributes']['src'] = file_url_transform_relative(file_create_url($variables['uri'])); + $variables['attributes']['src'] = file_create_url($variables['uri']); } // Generate a srcset attribute conforming to the spec at // http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset @@ -749,7 +748,7 @@ function template_preprocess_image(&$variables) { $srcset = array(); foreach ($variables['srcset'] as $src) { // URI is mandatory. - $source = file_url_transform_relative(file_create_url($src['uri'])); + $source = file_create_url($src['uri']); if (isset($src['width']) && !empty($src['width'])) { $source .= ' ' . $src['width']; } @@ -1520,7 +1519,7 @@ function template_preprocess_field(&$variables, $hook) { } // Merge attributes when a single-value field has a hidden label. - if ($element['#label_display'] == 'hidden' && !$variables['multiple'] && !empty($element['#items'][0]->_attributes)) { + if ($element['#label_display'] == 'hidden' && !$variables['multiple']) { $variables['attributes'] = NestedArray::mergeDeep($variables['attributes'], (array) $element['#items'][0]->_attributes); } @@ -1722,12 +1721,11 @@ function drupal_common_theme() { 'image' => array( // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft // allows the alt attribute to be omitted in some cases. Therefore, - // default the alt attribute to an empty string, but allow code providing - // variables to image.html.twig templates to pass explicit NULL for it to - // be omitted. Usually, neither omission nor an empty string satisfies - // accessibility requirements, so it is strongly encouraged for code - // building variables for image.html.twig templates to pass a meaningful - // value for the alt variable. + // default the alt attribute to an empty string, but allow code calling + // _theme('image') to pass explicit NULL for it to be omitted. Usually, + // neither omission nor an empty string satisfies accessibility + // requirements, so it is strongly encouraged for code calling + // _theme('image') to pass a meaningful value for the alt variable. // - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 // - http://www.w3.org/TR/xhtml1/dtds.html // - http://dev.w3.org/html5/spec/Overview.html#alt @@ -1767,7 +1765,7 @@ function drupal_common_theme() { 'render element' => 'page', ), 'maintenance_task_list' => array( - 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), + 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), ), 'authorize_report' => array( 'variables' => ['messages' => [], 'attributes' => []], diff --git a/core/install.php b/core/install.php index 50deb38..b70cec5 100644 --- a/core/install.php +++ b/core/install.php @@ -7,8 +7,6 @@ // 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. @@ -34,6 +32,6 @@ } // Start the installer. -$class_loader = require_once $root_path . '/autoload.php'; -require_once $root_path . '/core/includes/install.core.inc'; +$class_loader = require_once 'autoload.php'; +require_once __DIR__ . '/includes/install.core.inc'; install_drupal($class_loader); diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 545ec21..4020f7c 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -63,8 +63,8 @@ * class StuffDoingClass implements StuffDoingInterface { * protected $lockBackend; * - * public function __construct(LockBackendInterface $lock_backend) { - * $this->lockBackend = $lock_backend; + * public function __construct(LockBackendInterface $lockBackend) { + * $this->lockBackend = $lockBackend; * } * * public function doStuff() { @@ -81,7 +81,7 @@ class Drupal { /** * The current system version. */ - const VERSION = '8.0.4-dev'; + const VERSION = '8.0.0-dev'; /** * Core API compatibility. diff --git a/core/lib/Drupal/Core/Ajax/InsertCommand.php b/core/lib/Drupal/Core/Ajax/InsertCommand.php index e4b5dc0..8c477f5 100644 --- a/core/lib/Drupal/Core/Ajax/InsertCommand.php +++ b/core/lib/Drupal/Core/Ajax/InsertCommand.php @@ -43,7 +43,7 @@ class InsertCommand implements CommandInterface, CommandWithAttachedAssetsInterf protected $content; /** - * A settings array to be passed to any attached JavaScript behavior. + * A settings array to be passed to any any attached JavaScript behavior. * * @var array */ diff --git a/core/lib/Drupal/Core/Ajax/ReplaceCommand.php b/core/lib/Drupal/Core/Ajax/ReplaceCommand.php index 5d14f44..615f4eb 100644 --- a/core/lib/Drupal/Core/Ajax/ReplaceCommand.php +++ b/core/lib/Drupal/Core/Ajax/ReplaceCommand.php @@ -11,8 +11,8 @@ * AJAX command for calling the jQuery replace() method. * * The 'insert/replaceWith' command instructs the client to use jQuery's - * replaceWith() method to replace each element matched by the given selector - * with the given HTML. + * replaceWith() method to replace each element matched matched by the given + * selector with the given HTML. * * This command is implemented by Drupal.AjaxCommands.prototype.insert() * defined in misc/ajax.js. diff --git a/core/lib/Drupal/Core/Annotation/QueueWorker.php b/core/lib/Drupal/Core/Annotation/QueueWorker.php index 89150c5..85a2296 100644 --- a/core/lib/Drupal/Core/Annotation/QueueWorker.php +++ b/core/lib/Drupal/Core/Annotation/QueueWorker.php @@ -10,21 +10,18 @@ use Drupal\Component\Annotation\Plugin; /** - * Declare a worker class for processing a queue item. + * Declare queue workers that need to be run periodically. * - * Worker plugins are used by some queues for processing the individual items - * in the queue. In that case, the ID of the worker plugin needs to match the - * machine name of a queue, so that you can retrieve the queue back end by - * calling \Drupal\Core\Queue\QueueFactory::get($plugin_id). + * While there can be only one hook_cron() process running at the same time, + * there can be any number of processes defined here running. Because of + * this, long running tasks are much better suited for this API. Items queued + * in hook_cron() might be processed in the same cron run if there are not many + * items in the queue, otherwise it might take several requests, which can be + * run in parallel. * - * \Drupal\Core\Cron::processQueues() processes queues that use workers; they - * can also be processed outside of the cron process. - * - * Some queues do not use worker plugins: you can create queues, add items to - * them, claim them, etc. without using a QueueWorker plugin. However, you will - * need to take care of processing the items in the queue in that case. You can - * look at \Drupal\Core\Cron::processQueues() for an example of how to process - * a queue that uses workers, and adapt it to your queue. + * You can create queues, add items to them, claim them, etc. without using a + * QueueWorker plugin if you want, however, you need to take care of processing + * the items in the queue in that case. See \Drupal\Core\Cron for an example. * * Plugin Namespace: Plugin\QueueWorker * diff --git a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php b/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php index 0f70dbf..49e4675 100644 --- a/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php +++ b/core/lib/Drupal/Core/Asset/CssCollectionRenderer.php @@ -135,7 +135,7 @@ public function render(array $css_assets) { // assets: output a LINK tag for a file CSS asset. if (count($css_assets) <= 31) { $element = $link_element_defaults; - $element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data'])) . $query_string_separator . $query_string; + $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string; $element['#attributes']['media'] = $css_asset['media']; $element['#browsers'] = $css_asset['browsers']; $elements[] = $element; @@ -148,7 +148,7 @@ public function render(array $css_assets) { // LINK tag. if (!$css_asset['preprocess']) { $element = $link_element_defaults; - $element['#attributes']['href'] = file_url_transform_relative(file_create_url($css_asset['data'])) . $query_string_separator . $query_string; + $element['#attributes']['href'] = file_create_url($css_asset['data']) . $query_string_separator . $query_string; $element['#attributes']['media'] = $css_asset['media']; $element['#browsers'] = $css_asset['browsers']; $elements[] = $element; @@ -168,7 +168,7 @@ public function render(array $css_assets) { // control browser-caching. IE7 does not support a media type on // the @import statement, so we instead specify the media for // the group on the STYLE tag. - $import[] = '@import url("' . Html::escape(file_url_transform_relative(file_create_url($next_css_asset['data'])) . '?' . $query_string) . '");'; + $import[] = '@import url("' . Html::escape(file_create_url($next_css_asset['data']) . '?' . $query_string) . '");'; // Move the outer for loop skip the next item, since we // processed it here. $i = $j; diff --git a/core/lib/Drupal/Core/Asset/CssOptimizer.php b/core/lib/Drupal/Core/Asset/CssOptimizer.php index 704ee57..dc34a23 100644 --- a/core/lib/Drupal/Core/Asset/CssOptimizer.php +++ b/core/lib/Drupal/Core/Asset/CssOptimizer.php @@ -265,7 +265,7 @@ public function rewriteFileURI($matches) { $last = $path; $path = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path); } - return 'url(' . file_url_transform_relative(file_create_url($path)) . ')'; + return 'url(' . file_create_url($path) . ')'; } } diff --git a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php index b0d22f1..70832e9 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionRenderer.php @@ -79,7 +79,7 @@ public function render(array $js_assets) { case 'file': $query_string = $js_asset['version'] == -1 ? $default_query_string : 'v=' . $js_asset['version']; $query_string_separator = (strpos($js_asset['data'], '?') !== FALSE) ? '&' : '?'; - $element['#attributes']['src'] = file_url_transform_relative(file_create_url($js_asset['data'])); + $element['#attributes']['src'] = file_create_url($js_asset['data']); // Only add the cache-busting query string if this isn't an aggregate // file. if (!isset($js_asset['preprocessed'])) { diff --git a/core/lib/Drupal/Core/Cache/CacheFactory.php b/core/lib/Drupal/Core/Cache/CacheFactory.php index a5acf7c..a8a5c41 100644 --- a/core/lib/Drupal/Core/Cache/CacheFactory.php +++ b/core/lib/Drupal/Core/Cache/CacheFactory.php @@ -14,7 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; -class CacheFactory implements CacheFactoryInterface, ContainerAwareInterface { +class CacheFactory implements CacheFactoryInterface, ContainerAwareInterface { use ContainerAwareTrait; diff --git a/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php index 136238c..2dc6caa 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php +++ b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideBase.php @@ -18,7 +18,7 @@ * Reacts to the ConfigEvents::COLLECTION_INFO event. * * @param \Drupal\Core\Config\ConfigCollectionInfo $collection_info - * The configuration collection info event. + * The configuration collection names event. */ abstract public function addCollections(ConfigCollectionInfo $collection_info); diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index a77bb1c..ae12c91 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Config; -use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\Entity\ConfigDependencyManager; use Drupal\Core\Config\Entity\ConfigEntityDependency; @@ -280,12 +279,6 @@ protected function createConfiguration($collection, array $config_to_create) { } if ($config_to_create[$name] !== FALSE) { $new_config->setData($config_to_create[$name]); - // Add a hash to configuration created through the installer so it is - // possible to know if the configuration was created by installing an - // extension and to track which version of the default config was used. - if (!$this->isSyncing() && $collection == StorageInterface::DEFAULT_COLLECTION) { - $new_config->set('_core.default_config_hash', Crypt::hashBase64(serialize($config_to_create[$name]))); - } } if ($collection == StorageInterface::DEFAULT_COLLECTION && $entity_type = $this->configManager->getEntityTypeIdByName($name)) { // If we are syncing do not create configuration entities. Pluggable diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 4d0c0e3..bb396e6 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -40,6 +40,16 @@ protected $originalId; /** + * The name of the property that is used to store plugin configuration. + * + * This is needed when the entity uses a LazyPluginCollection, to dictate + * where the plugin configuration should be stored. + * + * @var string + */ + protected $pluginConfigKey; + + /** * The enabled/disabled status of the configuration entity. * * @var bool @@ -94,17 +104,6 @@ protected $third_party_settings = array(); /** - * Information maintained by Drupal core about configuration. - * - * Keys: - * - default_config_hash: A hash calculated by the config.installer service - * and added during installation. - * - * @var array - */ - protected $_core = []; - - /** * Trust supplied data and not use configuration schema on save. * * @var bool @@ -297,9 +296,6 @@ public function toArray() { if (empty($this->third_party_settings)) { unset($properties['third_party_settings']); } - if (empty($this->_core)) { - unset($properties['_core']); - } return $properties; } @@ -355,32 +351,6 @@ public function preSave(EntityStorageInterface $storage) { /** * {@inheritdoc} */ - public function __sleep() { - $keys_to_unset = []; - if ($this instanceof EntityWithPluginCollectionInterface) { - $vars = get_object_vars($this); - foreach ($this->getPluginCollections() as $plugin_config_key => $plugin_collection) { - // Save any changes to the plugin configuration to the entity. - $this->set($plugin_config_key, $plugin_collection->getConfiguration()); - // If the plugin collections are stored as properties on the entity, - // mark them to be unset. - $keys_to_unset += array_filter($vars, function ($value) use ($plugin_collection) { - return $plugin_collection === $value; - }); - } - } - - $vars = parent::__sleep(); - - if (!empty($keys_to_unset)) { - $vars = array_diff($vars, array_keys($keys_to_unset)); - } - return $vars; - } - - /** - * {@inheritdoc} - */ public function calculateDependencies() { // All dependencies should be recalculated on every save apart from enforced // dependencies. This ensures stale dependencies are never saved. diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php index 47a8f30..8e27aef 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php @@ -54,7 +54,6 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { } // Entity bundle field definitions may depend on bundle settings. $entity_manager->clearCachedFieldDefinitions(); - $entity_manager->clearCachedBundles(); } } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php index 42c9ab5..766fa6f 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php @@ -169,6 +169,9 @@ public function calculateDependencies(); * Dependency types are, for example, entity, module and theme. * * @return bool + * TRUE if the entity has changed, FALSE if not. + * + * @return bool * TRUE if the entity has been changed as a result, FALSE if not. * * @see \Drupal\Core\Config\Entity\ConfigDependencyManager diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index 785b314..527a336 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -157,7 +157,6 @@ public function getPropertiesToExport() { 'status' => 'status', 'dependencies' => 'dependencies', 'third_party_settings' => 'third_party_settings', - '_core' => '_core', ]; foreach ($this->config_export as $property => $name) { if (is_numeric($property)) { diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php index 03b0464..c630fec 100644 --- a/core/lib/Drupal/Core/Config/FileStorage.php +++ b/core/lib/Drupal/Core/Config/FileStorage.php @@ -95,13 +95,12 @@ public function read($name) { if (!$this->exists($name)) { return FALSE; } - $filepath = $this->getFilePath($name); - $data = file_get_contents($filepath); + $data = file_get_contents($this->getFilePath($name)); try { $data = $this->decode($data); } catch (InvalidDataTypeException $e) { - throw new UnsupportedDataTypeConfigException('Invalid data type in config ' . $name . ', found in file' . $filepath . ' : ' . $e->getMessage()); + throw new UnsupportedDataTypeConfigException("Invalid data type in config $name: {$e->getMessage()}"); } return $data; } diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index b2c94ed..ca0eb50 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -86,7 +86,6 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa // Add default values for data type and replace variables. $definition += array('type' => 'undefined'); - $replace = []; $type = $definition['type']; if (strpos($type, ']')) { // Replace variable names in definition. @@ -103,7 +102,7 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa unset($definition['type']); } // Add default values from type definition. - $definition += $this->_getDefinitionWithReplacements($type, $replace); + $definition += $this->getDefinition($type); $data_definition = $this->createDataDefinition($definition['type']); @@ -117,17 +116,10 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa } /** - * Determines the typed config type for a plugin ID. - * - * @param string $base_plugin_id - * The plugin ID. - * @param array $definitions - * An array of typed config definitions. - * - * @return string - * The typed config type for the given plugin ID. + * {@inheritdoc} */ - protected function _determineType($base_plugin_id, array $definitions) { + public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { + $definitions = $this->getDefinitions(); if (isset($definitions[$base_plugin_id])) { $type = $base_plugin_id; } @@ -139,27 +131,6 @@ protected function _determineType($base_plugin_id, array $definitions) { // If we don't have definition, return the 'undefined' element. $type = 'undefined'; } - return $type; - } - - /** - * Gets a schema definition with replacements for dynamic names. - * - * @param string $base_plugin_id - * A plugin ID. - * @param array $replacements - * An array of replacements for dynamic type names. - * @param bool $exception_on_invalid - * (optional) This parameter is passed along to self::getDefinition(). - * However, self::getDefinition() does not respect this parameter, so it is - * effectively useless in this context. - * - * @return array - * A schema definition array. - */ - protected function _getDefinitionWithReplacements($base_plugin_id, array $replacements, $exception_on_invalid = TRUE) { - $definitions = $this->getDefinitions(); - $type = $this->_determineType($base_plugin_id, $definitions); $definition = $definitions[$type]; // Check whether this type is an extension of another one and compile it. if (isset($definition['type'])) { @@ -167,15 +138,6 @@ protected function _getDefinitionWithReplacements($base_plugin_id, array $replac // Preserve integer keys on merge, so sequence item types can override // parent settings as opposed to adding unused second, third, etc. items. $definition = NestedArray::mergeDeepArray(array($merge, $definition), TRUE); - - // Replace dynamic portions of the definition type. - if (!empty($replacements) && strpos($definition['type'], ']')) { - $sub_type = $this->_determineType($this->replaceName($definition['type'], $replacements), $definitions); - // Merge the newly determined subtype definition with the original - // definition. - $definition = NestedArray::mergeDeepArray([$definitions[$sub_type], $definition], TRUE); - } - // Unset type so we try the merge only once per type. unset($definition['type']); $this->definitions[$type] = $definition; @@ -191,13 +153,6 @@ protected function _getDefinitionWithReplacements($base_plugin_id, array $replac /** * {@inheritdoc} */ - public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { - return $this->_getDefinitionWithReplacements($base_plugin_id, [], $exception_on_invalid); - } - - /** - * {@inheritdoc} - */ public function clearCachedDefinitions() { $this->schemaStorage->reset(); parent::clearCachedDefinitions(); diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php index d5845c1..81aeabc 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php @@ -138,38 +138,7 @@ public function query($query, array $args = array(), $options = array()) { } } - // We need to wrap queries with a savepoint if: - // - Currently in a transaction. - // - A 'mimic_implicit_commit' does not exist already. - // - The query is not a savepoint query. - $wrap_with_savepoint = $this->inTransaction() && - !isset($this->transactionLayers['mimic_implicit_commit']) && - !(is_string($query) && ( - stripos($query, 'ROLLBACK TO SAVEPOINT ') === 0 || - stripos($query, 'RELEASE SAVEPOINT ') === 0 || - stripos($query, 'SAVEPOINT ') === 0 - ) - ); - if ($wrap_with_savepoint) { - // Create a savepoint so we can rollback a failed query. This is so we can - // mimic MySQL and SQLite transactions which don't fail if a single query - // fails. This is important for tables that are created on demand. For - // example, \Drupal\Core\Cache\DatabaseBackend. - $this->addSavepoint(); - try { - $return = parent::query($query, $args, $options); - $this->releaseSavepoint(); - } - catch (\Exception $e) { - $this->rollbackSavepoint(); - throw $e; - } - } - else { - $return = parent::query($query, $args, $options); - } - - return $return; + return parent::query($query, $args, $options); } public function prepareQuery($query) { diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php index fab1d08..084856a 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php @@ -99,25 +99,12 @@ public function execute() { elseif ($options['return'] == Database::RETURN_INSERT_ID) { $options['return'] = Database::RETURN_NULL; } - - // Create a savepoint so we can rollback a failed query. This is so we can - // mimic MySQL and SQLite transactions which don't fail if a single query - // fails. This is important for tables that are created on demand. For - // example, \Drupal\Core\Cache\DatabaseBackend. - $this->connection->addSavepoint(); - try { - // Only use the returned last_insert_id if it is not already set. - if (!empty($last_insert_id)) { - $this->connection->query($stmt, array(), $options); - } - else { - $last_insert_id = $this->connection->query($stmt, array(), $options); - } - $this->connection->releaseSavepoint(); + // Only use the returned last_insert_id if it is not already set. + if (!empty($last_insert_id)) { + $this->connection->query($stmt, array(), $options); } - catch (\Exception $e) { - $this->connection->rollbackSavepoint(); - throw $e; + else { + $last_insert_id = $this->connection->query($stmt, array(), $options); } // Re-initialize the values array so that we can re-use this query. diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php index ef8e559..1f1c94b 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php @@ -76,23 +76,11 @@ public function execute() { $options['sequence_name'] = $table_information->sequences[0]; } + $this->connection->query($stmt, [], $options); + // Re-initialize the values array so that we can re-use this query. $this->insertValues = []; - // Create a savepoint so we can rollback a failed query. This is so we can - // mimic MySQL and SQLite transactions which don't fail if a single query - // fails. This is important for tables that are created on demand. For - // example, \Drupal\Core\Cache\DatabaseBackend. - $this->connection->addSavepoint(); - try { - $this->connection->query($stmt, [], $options); - $this->connection->releaseSavepoint(); - } - catch (\Exception $e) { - $this->connection->rollbackSavepoint(); - throw $e; - } - return TRUE; } diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php index 2a811e6..95cdf53 100644 --- a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php @@ -64,9 +64,10 @@ public function __construct(SelectInterface $query, Connection $connection) { * to it. */ public function execute() { - // By calling preExecute() here, we force it to preprocess the extender - // object rather than just the base query object. That means - // hook_query_alter() gets access to the extended object. + + // Add convenience tag to mark that this is an extended query. We have to + // do this in the constructor to ensure that it is set before preExecute() + // gets called. if (!$this->preExecute($this)) { return NULL; } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index cfaf10c..06938a4 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -765,7 +765,7 @@ public function updateModules(array $module_list, array $module_filenames = arra * The cache key used for the service container. */ protected function getContainerCacheKey() { - $parts = array('service_container', $this->environment, \Drupal::VERSION, Settings::get('deployment_identifier'), serialize(Settings::get('container_yamls'))); + $parts = array('service_container', $this->environment, \Drupal::VERSION, Settings::get('deployment_identifier')); return implode(':', $parts); } @@ -968,13 +968,11 @@ protected function initializeSettings(Request $request) { } } - // If the class loader is still the same, possibly upgrade to the APC class + // If the class loader is still the same, possibly upgrade to the APCu class // loader. - // ApcClassLoader does not support APCu without backwards compatibility - // enabled. if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) - && extension_loaded('apc')) { + && function_exists('apcu_fetch')) { $prefix = Settings::getApcuPrefix('class_loader', $this->root); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); $this->classLoader->unregister(); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index e3cd861..5eb5c30 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -139,7 +139,7 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr $values[$this->langcodeKey] = $langcode; $values[$this->getEntityType()->getKey('default_langcode')] = FALSE; $this->initFieldValues($translation, $values, $field_names); - $this->invokeHook('translation_create', $translation); + $this->invokeHook('translation_create', $entity); return $translation; } @@ -440,8 +440,7 @@ protected function invokeHook($hook, EntityInterface $entity) { protected function invokeFieldMethod($method, ContentEntityInterface $entity) { $result = []; $args = array_slice(func_get_args(), 2); - $langcodes = array_keys($entity->getTranslationLanguages()); - foreach ($langcodes as $langcode) { + foreach (array_keys($entity->getTranslationLanguages()) as $langcode) { $translation = $entity->getTranslation($langcode); // For non translatable fields, there is only one field object instance // across all translations and it has as parent entity the entity in the @@ -454,20 +453,6 @@ protected function invokeFieldMethod($method, ContentEntityInterface $entity) { $result[$langcode][$name] = $args ? call_user_func_array([$items, $method], $args) : $items->{$method}(); } } - - // We need to call the delete method for field items of removed - // translations. - if ($method == 'postSave' && !empty($entity->original)) { - $original_langcodes = array_keys($entity->original->getTranslationLanguages()); - foreach (array_diff($original_langcodes, $langcodes) as $removed_langcode) { - $translation = $entity->original->getTranslation($removed_langcode); - $fields = $translation->getTranslatableFields(); - foreach ($fields as $name => $items) { - $items->delete(); - } - } - } - return $result; } diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php index d94e2b5..603e099 100644 --- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php @@ -10,7 +10,6 @@ use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Tags; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface; use Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\Textfield; @@ -147,7 +146,6 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte 'handler' => $element['#selection_handler'], 'handler_settings' => $element['#selection_settings'], ); - /** @var /Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface $handler */ $handler = \Drupal::service('plugin.manager.entity_reference_selection')->getInstance($options); $autocreate = (bool) $element['#autocreate'] && $handler instanceof SelectionWithAutocreateInterface; @@ -166,7 +164,6 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte ); } elseif ($autocreate) { - /** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface $handler */ // Auto-create item. See an example of how this is handled in // \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave(). $value[] = array( @@ -214,7 +211,6 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte } foreach ($invalid_new_entities as $entity) { - /** @var \Drupal\Core\Entity\EntityInterface $entity */ $form_state->setError($element, t('This entity (%type: %label) cannot be referenced.', array('%type' => $element['#target_type'], '%label' => $entity->label()))); } } @@ -237,8 +233,6 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte * The method will return an entity ID if one single entity unambuguously * matches the incoming input, and sill assign form errors otherwise. * - * @param \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface $handler - * Entity reference selection plugin. * @param string $input * Single string from autocomplete element. * @param array $element @@ -252,7 +246,7 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte * @return int|null * Value of a matching entity ID, or NULL if none. */ - protected static function matchEntityByTitle(SelectionInterface $handler, $input, array &$element, FormStateInterface $form_state, $strict) { + protected static function matchEntityByTitle($handler, $input, &$element, FormStateInterface $form_state, $strict) { $entities_by_bundle = $handler->getReferenceableEntities($input, '=', 6); $entities = array_reduce($entities_by_bundle, function ($flattened, $bundle_entities) { return $flattened + $bundle_entities; @@ -330,11 +324,11 @@ public static function extractEntityIdFromAutocompleteInput($input) { // Take "label (entity id)', match the ID from parenthesis when it's a // number. - if (preg_match("/.+\s\((\d+)\)/", $input, $matches)) { + if (preg_match("/.+\((\d+)\)/", $input, $matches)) { $match = $matches[1]; } // Match the ID when it's a string (e.g. for config entity types). - elseif (preg_match("/.+\s\(([\w.]+)\)/", $input, $matches)) { + elseif (preg_match("/.+\(([\w.]+)\)/", $input, $matches)) { $match = $matches[1]; } diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index b49f3d4..8164d7c 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -320,6 +320,11 @@ protected function urlRouteParameters($rel) { /** * {@inheritdoc} + * + * Returns a list of URI relationships supported by this entity. + * + * @return array + * An array of link relationships supported by this entity. */ public function uriRelationships() { return array_keys($this->linkTemplates()); @@ -492,6 +497,9 @@ public function getCacheMaxAge() { /** * {@inheritdoc} + * + * @return static|null + * The entity object or NULL if there is no entity with the given ID. */ public static function load($id) { $entity_manager = \Drupal::entityManager(); @@ -500,6 +508,10 @@ public static function load($id) { /** * {@inheritdoc} + * + * @return static[] + * An array of entity objects indexed by their IDs. Returns an empty array + * if no matching entities are found. */ public static function loadMultiple(array $ids = NULL) { $entity_manager = \Drupal::entityManager(); @@ -508,6 +520,9 @@ public static function loadMultiple(array $ids = NULL) { /** * {@inheritdoc} + * + * @return static + * The entity object. */ public static function create(array $values = array()) { $entity_manager = \Drupal::entityManager(); diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php index 27fda29..6d8d7fb 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php @@ -206,7 +206,6 @@ public function resetCache() { public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array(), $return_as_object = FALSE) { $account = $this->prepareUser($account); $context += array( - 'entity_type_id' => $this->entityTypeId, 'langcode' => LanguageInterface::LANGCODE_DEFAULT, ); diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index 3ff3b09..62a8f44 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -113,7 +113,7 @@ public function label(); * The URL object. * * @deprecated in Drupal 8.0.0, intended to be removed in Drupal 9.0.0 - * Use \Drupal\Core\Entity\EntityInterface::toUrl() instead. + * Use toUrl() instead. * * @see \Drupal\Core\Entity\EntityInterface::toUrl */ @@ -309,9 +309,6 @@ public function delete(); * The entity storage object. * * @see \Drupal\Core\Field\FieldItemListInterface::preSave() - * - * @throws \Exception - * When there is a problem that should prevent saving the entity. */ public function preSave(EntityStorageInterface $storage); diff --git a/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php b/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php index 0946ee9..39c8a8b 100644 --- a/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php @@ -22,8 +22,8 @@ * @param string $uuid * The UUID of the entity to load. * - * @return \Drupal\Core\Entity\EntityInterface|null - * The entity object, or NULL if there is no entity with the given UUID. + * @return \Drupal\Core\Entity\EntityInterface|false + * The entity object, or FALSE if there is no entity with the given UUID. * * @throws \Drupal\Core\Entity\EntityStorageException * Thrown in case the requested entity type does not support UUIDs. diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManager.php b/core/lib/Drupal/Core/Entity/EntityTypeManager.php index 25f9cff..3a24e0e 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeManager.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php @@ -177,20 +177,25 @@ public function getListBuilder($entity_type) { * {@inheritdoc} */ public function getFormObject($entity_type, $operation) { - if (!$class = $this->getDefinition($entity_type, TRUE)->getFormClass($operation)) { - throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation)); - } + if (!isset($this->handlers['form'][$operation][$entity_type])) { + if (!$class = $this->getDefinition($entity_type, TRUE)->getFormClass($operation)) { + throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation)); + } - $form_object = $this->classResolver->getInstanceFromDefinition($class); + $form_object = $this->classResolver->getInstanceFromDefinition($class); + + $form_object + ->setStringTranslation($this->stringTranslation) + ->setModuleHandler($this->moduleHandler) + ->setEntityTypeManager($this) + ->setOperation($operation) + // The entity manager cannot be injected due to a circular dependency. + // @todo Remove this set call in https://www.drupal.org/node/2603542. + ->setEntityManager(\Drupal::entityManager()); + $this->handlers['form'][$operation][$entity_type] = $form_object; + } - return $form_object - ->setStringTranslation($this->stringTranslation) - ->setModuleHandler($this->moduleHandler) - ->setEntityTypeManager($this) - ->setOperation($operation) - // The entity manager cannot be injected due to a circular dependency. - // @todo Remove this set call in https://www.drupal.org/node/2603542. - ->setEntityManager(\Drupal::entityManager()); + return $this->handlers['form'][$operation][$entity_type]; } /** diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index b108bb4..63f8c69 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -257,7 +257,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA $entities = $this->entityManager->getStorage($target_type)->loadMultiple($result); foreach ($entities as $entity_id => $entity) { $bundle = $entity->bundle(); - $options[$bundle][$entity_id] = Html::escape($this->entityManager->getTranslationFromContext($entity)->label()); + $options[$bundle][$entity_id] = Html::escape($entity->label()); } return $options; diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index d33b422..be2a903 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -592,8 +592,7 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o * The account trying to access the entity. * @param array $context * An associative array of additional context values. By default it contains - * language and the entity type ID: - * - entity_type_id - the entity type ID. + * language: * - langcode - the current language code. * @param string $entity_bundle * The entity bundle name. diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index da0ff66..6fd0b99 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -83,11 +83,8 @@ public function onKernelRequestAuthenticate(GetResponseEvent $event) { $account = $this->authenticationProvider->authenticate($request); if ($account) { $this->accountProxy->setAccount($account); - return; } } - // No account has been set explicitly, initialize the timezone here. - date_default_timezone_set(drupal_get_user_timezone()); } } diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php index 3d68561..c088eed 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -15,13 +15,6 @@ /** * Discovers available extensions in the filesystem. - * - * To also discover test modules, add - * @code - * $settings['extension_discovery_scan_tests'] = TRUE; - * @encode - * to your settings.php. - * */ class ExtensionDiscovery { @@ -141,12 +134,6 @@ public function __construct($root, $use_file_cache = TRUE, $profile_directories * - the site-wide directory; i.e., / * - the site-specific directory; e.g., /sites/example.com * - * To also find test modules, add - * @code - * $settings['extension_discovery_scan_tests'] = TRUE; - * @encode - * to your settings.php. - * * The information is returned in an associative array, keyed by the extension * name (without .info.yml extension). Extensions found later in the search * will take precedence over extensions found earlier - unless they are not diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index 3d61d2e..d614fdb 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -237,9 +237,7 @@ public function invoke($module, $hook, array $args = array()); * * @return array * An array of return values of the hook implementations. If modules return - * arrays from their implementations, those are merged into one array - * recursively. Note: integer keys in arrays will be lost, as the merge is - * done using array_merge_recursive(). + * arrays from their implementations, those are merged into one array. */ public function invokeAll($hook, array $args = array()); diff --git a/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php b/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php index 048b9e6..bd2923a 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstallerInterface.php @@ -23,12 +23,6 @@ * - Invoke hook_install() and add it to the list of installed modules. * - Invoke hook_modules_installed(). * - * To install test modules add - * @code - * $settings['extension_discovery_scan_tests'] = TRUE; - * @encode - * to your settings.php. - * * @param string[] $module_list * An array of module names. * @param bool $enable_dependencies diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 59cfd99..c3d8684 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -19,12 +19,9 @@ class ThemeHandler implements ThemeHandlerInterface { * Contains the features enabled for themes by default. * * @var array - * - * @see _system_default_theme_features() */ protected $defaultFeatures = array( 'favicon', - 'logo', 'node_user_picture', 'comment_user_picture', 'comment_user_verification', diff --git a/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php b/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php index d2c69e0..8dcadca 100644 --- a/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php +++ b/core/lib/Drupal/Core/Field/FieldFilteredMarkup.php @@ -61,7 +61,7 @@ public static function create($string) { * A list of allowed tags. */ public static function allowedTags() { - return ['a', 'b', 'big', 'code', 'del', 'em', 'i', 'ins', 'pre', 'q', 'small', 'span', 'strong', 'sub', 'sup', 'tt', 'ol', 'ul', 'li', 'p', 'br', 'img']; + return ['a', 'b', 'big', 'code', 'del', 'em', 'i', 'ins', 'pre', 'q', 'small', 'span', 'strong', 'sub', 'sup', 'tt', 'ol', 'ul', 'li', 'p', 'br', 'img']; } /** diff --git a/core/lib/Drupal/Core/Field/FieldItemBase.php b/core/lib/Drupal/Core/Field/FieldItemBase.php index 033b82e..c73c7fd 100644 --- a/core/lib/Drupal/Core/Field/FieldItemBase.php +++ b/core/lib/Drupal/Core/Field/FieldItemBase.php @@ -70,7 +70,7 @@ public function getEntity() { * {@inheritdoc} */ public function getLangcode() { - return $this->getParent()->getLangcode(); + return $this->parent->getLangcode(); } /** diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php index 8671c5b..df595e5 100644 --- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -102,28 +102,28 @@ public function filterEmptyItems(); /** * Magic method: Gets a property value of to the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__set() + * @see \Drupal\Core\Field\FieldItemInterface::__get() */ public function __get($property_name); /** * Magic method: Sets a property value of the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__get() + * @see \Drupal\Core\Field\FieldItemInterface::__set() */ public function __set($property_name, $value); /** * Magic method: Determines whether a property of the first field item is set. * - * @see \Drupal\Core\Field\FieldItemInterface::__unset() + * @see \Drupal\Core\Field\FieldItemInterface::__isset() */ public function __isset($property_name); /** * Magic method: Unsets a property of the first field item. * - * @see \Drupal\Core\Field\FieldItemInterface::__isset() + * @see \Drupal\Core\Field\FieldItemInterface::__unset() */ public function __unset($property_name); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php index 74c7523..2822905 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php @@ -83,7 +83,6 @@ public function settingsForm(array $form, FormStateInterface $form_state) { } } - $field_name = $this->fieldDefinition->getName(); $form['format'] = [ '#type' => 'select', '#title' => $this->t('Output format'), @@ -96,7 +95,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $this->getSetting('format_custom_true'), '#states' => [ 'visible' => [ - 'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'], + 'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'], ], ], ]; @@ -106,7 +105,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { '#default_value' => $this->getSetting('format_custom_false'), '#states' => [ 'visible' => [ - 'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'], + 'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'], ], ], ]; diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php index a53e0b9..0e43ac1 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php @@ -55,7 +55,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { $range = range(0, 10); $elements['scale'] = array( '#type' => 'select', - '#title' => t('Scale', array(), array('context' => 'decimal places')), + '#title' => t('Scale', array(), array('decimal places')), '#options' => array_combine($range, $range), '#default_value' => $this->getSetting('scale'), '#description' => t('The number of digits to the right of the decimal.'), diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php index afa7586..e703084 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php @@ -131,7 +131,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { ); $elements['custom_date_format']['#states']['visible'][] = array( - ':input[name="name="fields[' . $this->fieldDefinition->getName() . '][settings_edit_form][settings][date_format]"]' => array('value' => 'custom'), + ':input[name="options[settings][date_format]"]' => array('value' => 'custom'), ); $elements['timezone'] = array( diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php index 1f40b29..e3867d4 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php @@ -81,7 +81,7 @@ public function storageSettingsForm(array &$form, FormStateInterface $form_state $range = range(0, 10); $element['scale'] = array( '#type' => 'select', - '#title' => t('Scale', array(), array('context' => 'decimal places')), + '#title' => t('Scale', array(), array('decimal places')), '#options' => array_combine($range, $range), '#default_value' => $settings['scale'], '#description' => t('The number of digits to the right of the decimal.'), diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php index 581adf2..7caa26f 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php @@ -62,9 +62,6 @@ public function preSave() { $this->value = $entity->original->{$this->getFieldDefinition()->getName()}->value; } } - // Ensure that the existing password is unset to minimise risks of it - // getting serialized and stored somewhere. - $this->existing = NULL; } /** diff --git a/core/lib/Drupal/Core/Field/WidgetBaseInterface.php b/core/lib/Drupal/Core/Field/WidgetBaseInterface.php index 18683c6..541f7c5 100644 --- a/core/lib/Drupal/Core/Field/WidgetBaseInterface.php +++ b/core/lib/Drupal/Core/Field/WidgetBaseInterface.php @@ -75,7 +75,7 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis /** * Retrieves processing information about the widget from $form_state. * - * This method is static so that it can be used in static Form API callbacks. + * This method is static so that is can be used in static Form API callbacks. * * @param array $parents * The array of #parents where the field lives in the form. @@ -95,7 +95,7 @@ public static function getWidgetState(array $parents, $field_name, FormStateInte /** * Stores processing information about the widget in $form_state. * - * This method is static so that it can be used in static Form API #callbacks. + * This method is static so that is can be used in static Form API #callbacks. * * @param array $parents * The array of #parents where the widget lives in the form. diff --git a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php index cd605bc..14bd16b 100644 --- a/core/lib/Drupal/Core/FileTransfer/FTPExtension.php +++ b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php @@ -30,7 +30,7 @@ public function connect() { * {@inheritdoc} */ protected function copyFileJailed($source, $destination) { - if (!@ftp_put($this->connection, $destination, $source, FTP_BINARY)) { + if (!@ftp_put($this->connection, $destination, $source, FTP_BINARY)) { throw new FileTransferException("Cannot move @source to @destination", NULL, array("@source" => $source, "@destination" => $destination)); } } diff --git a/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php b/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php index 44ff641..7d1c4b7 100644 --- a/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php +++ b/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php @@ -81,15 +81,6 @@ public function buildResponse(Request $request, array $form, FormStateInterface $response = $result; } else { - // At this point we know callback returned a render element. If the - // element is part of the group (#group is set on it) it won't be rendered - // unless we remove #group from it. This is caused by - // \Drupal\Core\Render\Element\RenderElement::preRenderGroup(), which - // prevents all members of groups from being rendered directly. - if (!empty($result['#group'])) { - unset($result['#group']); - } - /** @var \Drupal\Core\Ajax\AjaxResponse $response */ $response = $this->ajaxRenderer->renderResponse($result, $request, $this->routeMatch); } diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php index 5c2d2af..cbc0a07 100644 --- a/core/lib/Drupal/Core/Form/FormBase.php +++ b/core/lib/Drupal/Core/Form/FormBase.php @@ -140,7 +140,7 @@ public function resetConfigFactory() { */ protected function getRequest() { if (!$this->requestStack) { - $this->requestStack = \Drupal::service('request_stack'); + $this->requestStack = $this->container()->get('request_stack'); } return $this->requestStack->getCurrentRequest(); } @@ -165,8 +165,8 @@ protected function getRouteMatch() { * * @return $this */ - public function setRequestStack(RequestStack $request_stack) { - $this->requestStack = $request_stack; + public function setRequest(Request $request) { + $this->requestStack = $request; return $this; } diff --git a/core/lib/Drupal/Core/Form/FormValidator.php b/core/lib/Drupal/Core/Form/FormValidator.php index 26d7392..afead3d 100644 --- a/core/lib/Drupal/Core/Form/FormValidator.php +++ b/core/lib/Drupal/Core/Form/FormValidator.php @@ -346,7 +346,7 @@ protected function performRequiredValidation(&$elements, FormStateInterface &$fo foreach ($value as $v) { if (!isset($options[$v])) { $form_state->setError($elements, $this->t('An illegal choice has been detected. Please contact the site administrator.')); - $this->logger->error('Illegal choice %choice in %name element.', array('%choice' => $v, '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])); + $this->logger->error('Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'])); } } } diff --git a/core/lib/Drupal/Core/Form/form.api.php b/core/lib/Drupal/Core/Form/form.api.php index 19c2543..25f71c7 100644 --- a/core/lib/Drupal/Core/Form/form.api.php +++ b/core/lib/Drupal/Core/Form/form.api.php @@ -53,7 +53,7 @@ * such as how many total items were processed. */ function callback_batch_operation($MULTIPLE_PARAMS, &$context) { - $node_storage = \Drupal::entityTypeManager()->getStorage('node'); + $node_storage = $this->container->get('entity.manager')->getStorage('node'); if (!isset($context['sandbox']['progress'])) { $context['sandbox']['progress'] = 0; @@ -146,6 +146,8 @@ function callback_batch_finished($success, $results, $operations) { * * @param \Drupal\Core\Ajax\CommandInterface[] $data * An array of all the rendered commands that will be sent to the client. + * + * @see \Drupal\Core\Ajax\AjaxResponse::ajaxRender() */ function hook_ajax_render_alter(array &$data) { // Inject any new status messages into the content area. diff --git a/core/lib/Drupal/Core/Language/Language.php b/core/lib/Drupal/Core/Language/Language.php index 675ca47..46fb892 100644 --- a/core/lib/Drupal/Core/Language/Language.php +++ b/core/lib/Drupal/Core/Language/Language.php @@ -7,8 +7,6 @@ namespace Drupal\Core\Language; -use Drupal\Core\StringTranslation\TranslatableMarkup; - /** * An object containing the information for an interface language. * @@ -153,17 +151,7 @@ public static function sort(&$languages) { $a_weight = $a->getWeight(); $b_weight = $b->getWeight(); if ($a_weight == $b_weight) { - $a_name = $a->getName(); - $b_name = $b->getName(); - // If either name is a TranslatableMarkup object it can not be converted - // to a string. This is because translation requires a sorted list of - // languages thereby causing an infinite loop. Determine the order based - // on ID if this is the case. - if ($a_name instanceof TranslatableMarkup || $b_name instanceof TranslatableMarkup) { - $a_name = $a->getId(); - $b_name = $b->getId(); - } - return strnatcasecmp($a_name, $b_name); + return strnatcasecmp($a->getName(), $b->getName()); } return ($a_weight < $b_weight) ? -1 : 1; }); diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php index d29b273..4c0172d 100644 --- a/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -253,7 +253,6 @@ public static function getStandardLanguageList() { 'dz' => array('Dzongkha', 'རྫོང་ཁ'), 'el' => array('Greek', 'Ελληνικά'), 'en' => array('English', 'English'), - 'en-x-simple' => array('Simple English', 'Simple English'), 'eo' => array('Esperanto', 'Esperanto'), 'es' => array('Spanish', 'Español'), 'et' => array('Estonian', 'Eesti'), diff --git a/core/lib/Drupal/Core/Link.php b/core/lib/Drupal/Core/Link.php index 0bf24e8..f739ad1 100644 --- a/core/lib/Drupal/Core/Link.php +++ b/core/lib/Drupal/Core/Link.php @@ -140,15 +140,11 @@ public function setUrl(Url $url) { /** * Generates the HTML for this Link object. * - * Do not use this method to render a link in an HTML context. In an HTML - * context, self::toRenderable() should be used so that render cache - * information is maintained. However, there might be use cases such as tests - * and non-HTML contexts where calling this method directly makes sense. - * * @return \Drupal\Core\GeneratedLink * The link HTML markup. * - * @see \Drupal\Core\Link::toRenderable() + * @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use + * self::toRenderable() instead. */ public function toString() { return $this->getLinkGenerator()->generateFromLink($this); diff --git a/core/lib/Drupal/Core/Lock/LockBackendInterface.php b/core/lib/Drupal/Core/Lock/LockBackendInterface.php index e4af78d..c84e42d 100644 --- a/core/lib/Drupal/Core/Lock/LockBackendInterface.php +++ b/core/lib/Drupal/Core/Lock/LockBackendInterface.php @@ -14,11 +14,11 @@ * * In most environments, multiple Drupal page requests (a.k.a. threads or * processes) will execute in parallel. This leads to potential conflicts or - * race conditions when two requests execute the same code at the same time. For - * instance, some implementations of hook_cron() implicitly assume they are - * running only once, rather than having multiple calls in parallel. To prevent - * problems with such code, the cron system uses a locking process to ensure - * that cron is not started again if it is already running. + * race conditions when two requests execute the same code at the same time. A + * common example of this is a rebuild like menu_router_rebuild() where we + * invoke many hook implementations to get and process data from all active + * modules, and then delete the current data in the database to insert the new + * afterwards. * * This is a cooperative, advisory lock system. Any long-running operation * that could potentially be attempted in parallel by multiple requests should diff --git a/core/lib/Drupal/Core/Logger/LoggerChannel.php b/core/lib/Drupal/Core/Logger/LoggerChannel.php index 8e0890c..77b84a8 100644 --- a/core/lib/Drupal/Core/Logger/LoggerChannel.php +++ b/core/lib/Drupal/Core/Logger/LoggerChannel.php @@ -93,17 +93,9 @@ public function log($level, $message, array $context = array()) { $context['request_uri'] = $request->getUri(); $context['referer'] = $request->headers->get('Referer', ''); $context['ip'] = $request->getClientIP(); - try { - if ($this->currentUser) { - $context['user'] = $this->currentUser; - $context['uid'] = $this->currentUser->id(); - } - } - catch (\Exception $e) { - // An exception might be thrown if the database connection is not - // available or due to another unexpected reason. It is more important - // to log the error that we already have so any additional exceptions - // are ignored. + if ($this->currentUser) { + $context['user'] = $this->currentUser; + $context['uid'] = $this->currentUser->id(); } } diff --git a/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php b/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php index a8125d0..67d178c 100644 --- a/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php +++ b/core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php @@ -23,7 +23,10 @@ public function get($channel); /** - * Adds a logger to all the channels. + * Adds a logger. + * + * Here is were all services tagged as 'logger' are being retrieved and then + * passed to the channels after instantiation. * * @param \Psr\Log\LoggerInterface $logger * The PSR-3 logger to add. diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkInterface.php b/core/lib/Drupal/Core/Menu/ContextualLinkInterface.php index d00cd94..04c2f7d 100644 --- a/core/lib/Drupal/Core/Menu/ContextualLinkInterface.php +++ b/core/lib/Drupal/Core/Menu/ContextualLinkInterface.php @@ -9,14 +9,6 @@ /** * Defines a contextual link plugin. - * - * Contextual links by default are in the module_name.links.contextual.yml - * file. These YAML files contain a list of contextual link plugin definitions, - * keyed by the plugin ID. Each definition must define a route_name and a group - * and might define title, options, and weight. See the getter methods on this - * interface for an explanation of each. - * - * @ingroup menu */ interface ContextualLinkInterface { diff --git a/core/lib/Drupal/Core/Menu/LocalActionManager.php b/core/lib/Drupal/Core/Menu/LocalActionManager.php index f98e60e..eb1e2d0 100644 --- a/core/lib/Drupal/Core/Menu/LocalActionManager.php +++ b/core/lib/Drupal/Core/Menu/LocalActionManager.php @@ -8,9 +8,6 @@ namespace Drupal\Core\Menu; use Drupal\Core\Access\AccessManagerInterface; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Cache\CacheableDependencyInterface; -use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; @@ -185,10 +182,8 @@ public function getActionsForRoute($route_appears) { $links = array(); /** @var $plugin \Drupal\Core\Menu\LocalActionInterface */ foreach ($this->instances[$route_appears] as $plugin_id => $plugin) { - $cacheability = new CacheableMetadata(); $route_name = $plugin->getRouteName(); $route_parameters = $plugin->getRouteParameters($this->routeMatch); - $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE); $links[$plugin_id] = array( '#theme' => 'menu_local_action', '#link' => array( @@ -196,22 +191,10 @@ public function getActionsForRoute($route_appears) { 'url' => Url::fromRoute($route_name, $route_parameters), 'localized_options' => $plugin->getOptions($this->routeMatch), ), - '#access' => $access, + '#access' => $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE), '#weight' => $plugin->getWeight(), ); - $cacheability->addCacheableDependency($access); - // For backward compatibility in 8.0.x, plugins that do not implement - // the \Drupal\Core\Cache\CacheableDependencyInterface are assumed - // to be cacheable forever. - if ($plugin instanceof CacheableDependencyInterface) { - $cacheability->addCacheableDependency($plugin); - } - else { - $cacheability->setCacheMaxAge(Cache::PERMANENT); - } - $cacheability->applyTo($links[$plugin_id]); } - $links['#cache']['contexts'][] = 'route'; return $links; } diff --git a/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php index eda4a87..da16e91 100644 --- a/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php +++ b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Menu\Plugin\Block; use Drupal\Core\Block\BlockBase; +use Drupal\Core\Cache\Cache; use Drupal\Core\Menu\LocalActionManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -83,8 +84,18 @@ public function defaultConfiguration() { public function build() { $route_name = $this->routeMatch->getRouteName(); $local_actions = $this->localActionManager->getActionsForRoute($route_name); + if (empty($local_actions)) { + return []; + } return $local_actions; } + /** + * {@inheritdoc} + */ + public function getCacheContexts() { + return Cache::mergeContexts(parent::getCacheContexts(), ['route']); + } + } diff --git a/core/lib/Drupal/Core/Render/Element/Button.php b/core/lib/Drupal/Core/Render/Element/Button.php index fc35901..29ed48a 100644 --- a/core/lib/Drupal/Core/Render/Element/Button.php +++ b/core/lib/Drupal/Core/Render/Element/Button.php @@ -27,7 +27,7 @@ * @code * $form['actions']['preview'] = array( * '#type' => 'button', - * '#value' => $this->t('Preview'), + * '#value => $this->t('Preview'), * ); * @endcode * diff --git a/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/core/lib/Drupal/Core/Render/Element/HtmlTag.php index 5ec0d3f..f2bcacf 100644 --- a/core/lib/Drupal/Core/Render/Element/HtmlTag.php +++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php @@ -16,24 +16,6 @@ /** * Provides a render element for any HTML tag, with properties and value. * - * Properties: - * - #tag: The tag name to output. - * - #attributes: (array, optional) HTML attributes to apply to the tag. The - * attributes are escaped, see \Drupal\Core\Template\Attribute. - * - #value: (string, optional) A string containing the textual contents of - * the tag. - * - #noscript: (bool, optional) When set to TRUE, the markup - * (including any prefix or suffix) will be wrapped in a