Quantcast
Channel: Issues for Drupal core
Viewing all 294937 articles
Browse latest View live

Add new “Content Editor” role to Standard Profile

$
0
0

Problem/Motivation

Currently there are three Installation Profiles: Minimal, Standard and Demo: Umami Food Magazine.

When you install a new Drupal site with the Standard profile, you get three user roles by default: Admin, Authenticated user (logged-in user when this issue is fixed) and Anonymous.

  • Admin role: for site building and development purposes and comes with almost every existing permission by default.
  • Authenticated/logged-in role: has the same permissions as the Anonymous user (viewing content) plus is able to post comments.
  • Anonymous role: for visitors to the site not logged in.

Drupal is a content management system but we don’t have any default user role for creating, editing or managing content.

Proposed resolution

Based on our discovery, this proposal aims to create an out-of-the-box editor role to serve Drupal’s main purpose: manage content.

We propose that this new role is named “Content Editor.”

Installed with the standard profile, this new role will be created with a new set of permissions and options. Our initial proposal for this set is:

  • Create and edit new content — articles and pages
  • Use the basic HTML text format
  • View unpublished content
  • Create and edit terms (tags and categories)
  • Access the administration theme

Remaining tasks

  • Agree on the name and machine name for the new role
  • Define the new set of permissions
  • Create a patch
  • Code Review
  • Create tests?

User interface changes

  • Roles and permissions screen:
    • Content Editor role will be included.
    • The new permissions for the role will be checked.
  • Edit or Create user screens should include the Content Editor role in the options to select the role(s).

API changes

No changes to existing API changes?

Data model changes

No changes to existing data models?


Fix Drupal.Semantics.FunctionTriggerError coding standard

$
0
0

Following from #2908391: Add a rule for expected format of @deprecated and @trigger_error() text we need to fix core to adhere to the two new coding standards.

This issue will fix the @trigger_error() function calls to adhere to standards.
Ideally wait for #3041983: Fix unused imports and update Coder to 8.3.4 so that testing the new sniff will be simpler, but we can use the new coder code by patching it via drupalci - see comment #28. The patch in #28 can be used now to start fixing the standards.

Step 1: Preparation

Open the file core/phpcs.xml.dist and add a line for the sniff of this ticket. The sniff name is in the issue title. Make sure your patch will include the addition of this line.

Step 2: Install & configure PHPCS

Install PHP CodeSniffer and the ruleset from the Coder module:

$ composer install
$ ./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer

Once you have installed the phpcs package, you can list all the sniffs available to you like this:

$ ./vendor/bin/phpcs --standard=Drupal -e

This will give you a big list of sniffs, and the Drupal-based ones should be present.

Step 3: Prepare the phpcs.xml file

To speed up the testing you should make a copy of the file phpcs.xml.dist (in the core/ folder) and save it as phpcs.xml. This is the configuration file for PHP CodeSniffer. We only want this phpcs.xml file to specify the sniff we're interested in. So we need to remove all the rule items, and add only our own sniff's rule. Rule items look like this:

<rule ref="Drupal.Semantics.FunctionTriggerError"/>

Remove all of them, and add only the sniff from this issue title. This will make sure that our tests run quickly, and are not going to contain any output from unrelated sniffs.

Step 4: Run the test

Now you are ready to run the test! From within the core/ folder, run the following command to launch the test:

$ cd core/
$ ../vendor/bin/phpcs -p

This takes a couple of minutes. The -p flag shows the progress, so you have a bunch of nice dots to look at while it is running.

Step 5: Fix the failures

When the test is complete it will present you a list of all the files that contain violations of your sniff, and the line numbers where the violations occur.

Introduce TestRun objects and refactor TestDatabase to be testable

$
0
0

Problem/Motivation

In #3074043: Move simpletest.module DB-related functions to TestDatabase, deprecate we're trying to deprecate top-level simpletest module functions by moving them to Drupal\Core\Test\TestDatabase.

It so happens that we can't test many of our changes, because TestDatabase is mostly static and thus can't be mocked.

Proposed resolution

  • Test runners (simpletest.module and run-test.sh) run tests opening TestRun objects that have state and an execution log.
  • TestDatabase objects only cares about setting up the SUT database, not the results logging.
  • Each TestRun object is associated with a TestRunResultsStorageInterface object, which responsibility is to store permanently the state and execution log of each test run. This interface is storage agnostic, implementations could use a database or anything else.
  • SimpletestTestRunResultsStorage is at the moment the only implementation of TestRunResultsStorageInterface, which is using the database and the legacy {simpletest} and {simpletest_test_id} tables for the purpose.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Make Drupal 9 installable on PHP8

$
0
0

Problem/Motivation

This task will try to get Drupal 9 installable on PHP8.0 alpha so we can work out issues to address.

Proposed resolution

Make Drupal 9 testable on PHP 8 and PHP 7 at the same time.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Broken aria-describedby in radios and checkboxes.

$
0
0

Steps to reproduce

  1. Go to admin/config/people/accounts
  2. Navigate to REGISTRATION AND CANCELLATION > When cancelling a user account
  3. Inspect the radio buttons. Seeing that aria-describedby="edit-user-cancel-method--description" which edit-user-cancel-method--description doesn't exists.

Those 3 radio buttons don't have any description. So I think they don't need to have aria-describedby attribute.
For example, in REGISTRATION AND CANCELLATION > Who can register accounts?, the radio buttons don't have aria-describedby attribute since they don't have description.
However, the description below (Users with the Select method ...) is a description of the fieldset wrapper.

Attached Screenshot

[backport] Migrate D7 i18n menu links

$
0
0

This is postponed on #3112249: [backport] Migrate d7 menu translation.

Problem/Motivation

Menu links in Drupal 7 are translated using i18n_menu submodule of the suite i18n, we need to migrate those respecting the language settings. This should be similar to the D6 version, #2225587: Migrate D6 i18n menu links

The D6 patch included a migration for language content menu settings as well. For D7 that was done in a separate issue, #3110669: [backport] Migrate d7 menu language content settings.

Proposed resolution

Ensure that the menu_links migration sets a default value for the langcode. From #3013625: Menu language not properly migrated from D7 localized menu links..

Add two migrations one for localized menu links, d7_menu_links_localized, and another one for translations that are not localized, d7_menu_links_translation.

This migration should also set the state of the menu_links migration to finished.

Remaining tasks

Write a patch
Review
Commit

Wrong language in token_options in user_mail function

$
0
0

Issue Summary Updates

The actual cause of recovery mail's token not respecting user account's preferred language is due to the $langcode set in submitForm (UserPasswordForm.php), further detailed discussion can be found at #86287: "reset password" page ignores the user's language selection.

As discussed in #21#22, #23, MailManagerInterface::mail() (which will further invoke user_mail_token) should actually be using the $langcode provided by _user_notify_mail().

Original Problem/Motivation

In the user_mail function, the language manager is set to the preferred langcode of the user.

$language = $language_manager->getLanguage($params['account']->getPreferredLangcode());
$original_language = $language_manager->getConfigOverrideLanguage();
$language_manager->setConfigOverrideLanguage($language);

In some cases if we load config, the mail_config is translated in the language of the user:

$mail_config = \Drupal::config('user.mail');

While loading the token options, an other langcode is set?!

Steps required to reproduce the bug

While sending a "Password Recovery" mail, the mail subject and body is in the language of the user.
The [user:one-time-login-url] token is in another language.

Solution, see patch.

Proposed resolution

Set the correct langcode in $token_options array:

  $token_options = ['langcode' => $language->getId(), 'callback' => 'user_mail_tokens', 'clear' => TRUE];

See Patch.

Remaining tasks

Review patch.

User interface changes

None

API changes

None

Data model changes

None

Allow the book outline functionality on non-book-enabled node types to be hidden from users with the "Administer book outlines" permission

$
0
0

It is somewhat disconcerting to users who have the 'administer book outlines' permission to see the 'outline' tab and 'outline' fieldset on every single node type, regardless of whether that node type has been configured to be allowed in books. I can see a use-case where that might be a desired feature, but i think its probably relatively rare.

The steps to repeat this are:
with a clean install of drupal,
1) turn the book module on
2) configure book module to only use 'book' content type
3) as admin or a user with 'administer book outlines' permission, create or edit a 'page' node (not a book node)

i would expect that 'outline' would not show for 'page' nodes since only 'book' nodes are set to use outlines.

I created the following patch to gracefully address this issue. The simplest solution I could think of was to create an additional checkbox in the content/book/settings form that when checked restricts book outlines to only the designated book-types. By default this is not checked, so that any drupal installs that might rely on "seeing outline information on all node types regardless of config settings" wont be broken by this patch after upgrading.

Its pretty basic, doesn't change anything by default and so hopefully it will be well received (and help someone too!)


Encapsulate \PDOStatement instead of extending from it

$
0
0

Problem/Motivation

As noted in #3156881-35: Various methods of \Drupal\Core\Database\StatementInterface have changed their signature for PHP 8, the database Statement class is extending from PDO, and is therefore exposed to the changing winds of new PHP versions.

We should have our own Statement envelope instead, encapsulating a PDO (or, potentially, other) lower-level Statement object.

In https://github.com/mondrake/drudbal/blob/master/src/Driver/Database/dbal..., I have an example: the Statement object implemented for the DruDbal driver encapsulates a doctrine/dbal Statement (which is not a PDO Statement).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

[meeting] Migrate Meeting 2020-10-08

$
0
0

Hello all, it’s time for the weekly migration initiative meeting. The meeting will take place in slack in various threads
This meeting:
➤ Is for core migrate maintainers and developers and anybody else in the community with an interest in migrations
➤ Usually happens every Thursday and alternates between 1400 and 2100 UTC.
➤ Is done on the #migration channel in Drupal Slack (see www.drupal.org/slack for information).
➤ Happens in threads, which you can follow to be notified of new replies even if you don’t comment in the thread. You may also join the meeting later and participate asynchronously!
➤ Has a public agenda anyone can add to here: https://www.drupal.org/project/drupal/issues/3174626. See the parent issue for an idea of the typical agenda.
➤*Transcript will be exported and posted* to the agenda issue. For anonymous comments, start with a :bust_in_silhouette: emoji. To take a comment or thread off the record, start with a :no_entry_sign: emoji.

Core migration issues:

0️⃣ Who is here today? What is your favorite flavor of ice cream?

damienmckennaMango, or mint, or... ah just pass it over, I'm not that picky when it comes to frozen treats :grin:
larowlanlee, I don’t like ice cream, but pistachio or coconut gelato is :ok_hand:
benjifisherI have a recipe for ginger ice cream that is a lot of work, but the result is outstanding.
dinarconHello :wave:
alisonAlison here!  Chocolate / death by chocolate type flavors... any flavor with coffee and chocolate... Sometimes lemon... Fresh peach sundaes made with vanilla custard...NOTHING WITH NUTS :woman-gesturing-no: :blob_no: :no_entry_sign:
larowlanactually, I change my order https://www.weis.com.au/products/macadamia-mango-and-ice-cream-bar/ is top-shelf - worth looking up if you like mango damien
irinazhi, I like coffee flavor
quietoneCoconut in the summer and pistachio any time
heddnSome flavor of dark chocolate. Maybe with nuts.

1️⃣ What should we talk about today? Suggest topics here and I will add threads.

larowlanI wanted to convey how much the migrate APIs rock, been working on a client migration from Grav and it has come out so well. I’ll release a migrate_source_grav contrib module.

2️⃣ Action items. To be added later.

benjifisherNR (Major): #3006750: Move memory management from MigrateExecutable to an event subscriber. @benjifisher
benjifisherDocumentation:Alphabetize the glossary and generally review, add, update as needed. @dinarcon, @alison Start a page of pipeline snippets/recipes/examples. @benjifisher
benjifisherFM review of #3167267: MigrateExecutable should catch not only exceptions, but also fatal errors: @larowlan
benjifisherContinue work on #3150949: Add a migration source plugin for JSON:API: @quietone, @benjifisher

3️⃣ Statistics

benjifisherFixed since last week's meeting: 4 (not counting issues for meetings).
benjifisherRTBC: 6, including one Major. Two have been waiting more than a month.
benjifisherNR: 20, including 4 Major. One has been waiting more than a month (and is Major). I started reviewing that one before the meeting, and I will finish today.

4️⃣ Documention

benjifisherAs promised, @dinarcon started work on a glossary: https://www.drupal.org/docs/drupal-apis/migrate-api/migrate-api-overview.... #DrupalThanks!
benjifisherIf you nudge me, I might start a page with examples of process pipelines. For example, clean up whitespace in an HTML string. (This is what I came up with this week. There is room for improvement.) - plugin: callback callable: htmlentities - plugin: str_replace search: - ' ' - ' ' replace: '' - plugin: str_replace regex: true search: '@\s+@' replace: '' - plugin: callback callable: trim
dinarconThis bring back memories when there were code snippet sections on drupal .org. I guess they still exists. Having like a "cookbook" with migration "recipes" would be useful.
dinarconAs for the glossary, I was tempted to add information about source/process/destination plugins, but they have their own section in the documentation. Not sure if it is worth repeating in the glossary and pointing to the respective pages. Also, the example migration goes beyond what a glossary is. Feedback on things to add/change/remove are very welcomed.
alisonVery cool!  I was just going to ask if you have a list or anything in mind, for stuff that should be added.
alisonsource/process/destination plugins -- repeating in the glossary and pointing to the respective pages^^ I like that idea (edited)
alisonI think the Glossary might need to be on its own page -- but that could wait til it's longer / til we're sure it's going to be longer :slightly_smiling_face:
dinarconSome time ago I wrote https://understanddrupal.com/articles/configuration-options-migration-ya... to explain which configuration options are available in migration files. Having every possible key in the glossary might be overkill, but things like migration tags, groups, and dependencies could be added. Also, an overview of id and uuid and how they are used in the system. For instance, the id is used to run the migration and create the migrate map/messages tables. (edited)
alisonOh and, alphabetization, an important attribute of a glossary :slightly_smiling_face:  .....but I recognize that it might be complicated with multi-word (or "phrase") entries.  But, still worth alphabetizing, IMO.If folks agree, I'd be happy to help with that -- there aren't too many now, so if we have them alphabetized now, it'll (hopefully) convey to anyone adding more entries to do so alphabetically.
benjifisherYes, glossaries should be alphabetical. Be bold, and edit it!I think we agreed at the start to move it to a separate page if it gets big enough.
dinarconYes, having them in alphabetical order makes a lot of sense. The only reason I wrote them in the current order was to try to follow the order in which concepts appear in a migration. But again, having an example migration in a glossary is probably out of scope. +1 on having them in alphabetical order.
alisonCool, I'll do that -- just wanted to make sure there was consensus :slightly_smiling_face:
alisonre: your message about configuration options etc.  -- interesting, yeah, I think it makes sense to add the examples you mention??  I can imagine it becoming complicated, deciding what to include / not include... Sometimes it's ok to just wait to worry about that kind of thing, see how things go.  I'm not sure if this is one of those times, buuuut.....
benjifisherYes, the idea of the "example pipelines" page is to have usable snippets or recipes. I would also link to the issue to make pipeline snippets reusable; for now I do a lot of copy/paste.
alisonexample snippets / recipes -- yessssssssssssss
alisonAlso, there are examples in source code files, so, sometimes could be enough to link to those examples?
benjifisherI think embedded examples will be a lot easier to use than links for this (vaporware) page.
alisonOk!  (What vaporware page?)@dinarcon Are you thinking the process pipeline example will be moved to the future snippet-examples/recipes page?  (Not right this second.)
dinarcon@alison yes, a dedicated snippet page/section is created, the current example in the glossary can be moved over. For now, I would say to keep it there.
benjifisherYes, at the top of this thread, I suggested a new page for examples of pipelines. That is the vaporware.
alisonYeah I saw your message earlier -- hmm definitely not familiar with the term vaporware... Sounds fun.  (googled) (edited)
benjifisherAs in "The JSON:API source plugin has progressed from half-baked idea to vaporware".
alisonAlphabetization done.
alisonI was relieved that I didn't have to make a decision about how to treat the connecting word "as".....
benjifisherThanks!
dinarconThank you @alison !
alisonmy pleasure!
alisonI'll think about what else to add.Do you think it's worth adding words without definitions, like "groups: to do" or something, or no benefit to doing that?I think it could encourage ppl to fill stuff in, or just, having more things there encourages adding more things... Plus, having more examples is helpful for conveying the intent of the section. (edited)

5️⃣ MigrateExecutable should catch not only exceptions, but also fatal errors

benjifisher#3167267: MigrateExecutable should catch not only exceptions, but also fatal errors
benjifisherThis one is tagged for FM review. @larowlan, since you are here today, can you have a look?
larowlansure

6️⃣ Move memory management from MigrateExecutable to an event subscriber

benjifisher#3006750: Move memory management from MigrateExecutable to an event subscriber
benjifisherThis is the issue I am in the middle of reviewing.

7️⃣ Recent successes that we can share.

benjifisherFrom 1️⃣:I’ll release a migrate_source_grav contrib module.
larowlanyeah, we blew the clients’ socks off with a migration, and it would not have been possible without all the hard work that has gone into the migrate apis
larowlanso thank you everyone who has made the apis what they are :heart:
dinarconI have mentioned this before, but many migrations written for D8 can be run on D9 with minimal or no changes. Last week I updated several of the examples in the 31 days of migration series. The only required change to most modules was adding core_version_requirement: ^8 || ^9 to the *.info.yml file. :blue_heart:
larowlanyeah, this was a d9 project
benjifisherI have a few process plugins that I plan to contribute to migrate_plus:dom_select: similar to dom_extract (currently NR) to extract strings/attributes from a DOMDocument objectdom_remove: once you have extracted stuff, remove it from the DOMDocument objecttranspose: if you have multiple URLs in one source property and multiple link titles in another, now you can combine them into one array-of-arrays for use with the sub_process plugin to generate links.
alisonoo dom_remove that would've been amazing to have in our project last year (back when I was more involved here)... yeah I love all of those...Transpose makes me think of Python "zip" :zipper_mouth_face:

8️⃣ Add a migration source plugin for JSON:API

benjifisher#3150949: Add a migration source plugin for JSON:API
benjifisher@quietone has done a lot of work recently, and @wimleers (he/him) has given the first review. This is high on my todo list.
benjifisher@wimleers (he/him): If you read the earlier comments on the issue,@quietone started by copying some code from the Migrate Plus module, which explains why some parts look like they are designed for generic JSON.There are some comments about how the JSON:API source should be different from the generic JSON source.I think you answered a few of the earlier questions, such as whether there is anything better than json_decode(). Thanks!

9️⃣ DrupalSpoons vs. d.o for Migrate Plus, Migrate Tools, etc.

benjifisherWe discussed this last week, even though it came up after the usual end of the meeting. @heddn, are you willing to move these back to d.o?
benjifisherIIRC, issue forks will be available for all projects in about a month. There has already been one core issue fixed with a fork and a merged branch instead of a patch.
heddnThe UX on drupal's issue forks is a still a little rough. I'm not sure the right answer here. I used it on a recent core issue that just landed and was confused about the whole process the entire time. I wish we had a more unified and easier to use toolset available to us. That would make the decisions easier. Much of the tooling in drupal spoons are head and shoulders above what we see in issue forks. It doesn't come without some downsides though :grimacing:
benjifisherYou have worked with it more than I have. I am optimistic that the DX on d.o will improve over time, probably based on the DrupalSpoons experiment.For the record, here is a tweet with the announcement: https://twitter.com/drupal_org/status/1313575017586716672?s=20

1️⃣0️⃣ Config schema definitions for plugins aren't applied to their derivatives - Migration plugins

benjifisher#2320937: Config schema definitions for plugins aren't applied to their derivatives - Migration plugins
benjifisherWe discussed this issue at last week's meeting, and there was some further discussion on a thread outside the meeting. I think @quietone and @mikelutz (he/him) were involved.Can we just close it as outdated?
benjifisherI will close it tomorrow, unless someone beats me to it.

1️⃣1️⃣ Wrap up

benjifisherThanks for participating! I have already updated 2️⃣. Please continue to add comments in the threads. In 1-7 days, we will post a transcript for today's meeting.
dinarconThanks for facilitating @benjifisher !
alisonThank you, Benji!!

Participants:

damienmckenna, larowlan, benjifisher, dinarcon, alison, irinaz, quietone, heddn

Migrate Drupal 7 date field "todate" value

$
0
0

Problem/Motivation

The Drupal 7 date module allowed the site builder to configure whether to collect an end date or not:

(This is called 'todate' in the code.)

For example, on my personal site, I have a projectNodeType which has a "time range"date. Example: https://wimleers.com/work/project/ledgrid.

Upon migration, the start value (value) is migrated, but the end value (value2) is dropped

D7

D8 HEAD

That's because this is being migrated to a @FieldType=datetime field in D8 instead of a @FieldType=daterange field in D8!

Proposed resolution

Make \Drupal\datetime\Plugin\migrate\field\DateField detect the todate setting and:

  1. expand the process chain to also transform data for @FieldType=daterangeend_value property, instead of only the value property
  2. dynamically override the statically computed destination field type: return daterange instead of datetime when appropriate
  3. most simple, but perhaps most controversial: change the destination_module key in the @MigrateField annotation to datetime_range instead of datetime. The migration system seems to not have been designed for dynamic conditional edge cases like this one, and the harm of requiring that module to be installed even if unused is minimal; and certainly does not outweigh the data loss that is currently happening.

Remaining tasks

  • Fix failing tests.
  • Add a new test (and provide a test-only patch).

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD

Move memory management from MigrateExecutable to an event subscriber

$
0
0

Problem/Motivation

This issue is postponed on #3000050: Replace \Drupal\Component\Utility\Environment::checkMemoryLimit with a PHP memory checking helper class and service.

MigrateExecutable has a lot of code devote to managing and reclaiming memory, since memory usage is quite relevant to migration. There's nothing wrong with this code per se, but we'd like to remove MigrateExecutable entirely. To that end, let's move all the memory management code into a new internal class (Drupal\migrate\MemoryManager) and have MigrateExecutable's constructor instantiate it.

The new MemoryManager class will be explicitly internal because it is not an API. Eventually we may want to add an interface to it (and possibly plugin-ize it), at which point we can remove the internal designation, but that's all way out of scope for this issue. For now, we just want to remove as much code from MigrateExecutable as we can.

Cool enough I implemented it and replaced my wonky hook_row_alter :-D

I don't like the setMessage but our message "service" logic is just all over and I wasn't sure how to handle it.

Remaining tasks

  • Change record - Explain why the threshold is 0.9 and the memory limit is 0.85
  • Inject the new EnvironmentMemory class from #3000050: Replace \Drupal\Component\Utility\Environment::checkMemoryLimit with a PHP memory checking helper class and service into the MemoryManager class and remove redundant methods like getUsageInBytes().
  • Instead of setting integer properties in the dispatched event, pass the EnvironmentMemory object. Update the event subscriber.
  • Update the MemoryManager test to use a mocked version of EnvironmentMemory.
  • Implement the suggestion in #79.2. Or argue against it.
  • Respond to the suggestion in #80.
  • Use returnCallback() as suggested in #82 or open a follow-up issue to do this. See also the last part of #83.

UID base field override configs can still have old default value callbacks

$
0
0

After upgrading from Drupal 8.9 to Drupal 9.0 I get the two following error/warning messages when trying to create new content using some (not all) of my content types, among them the native “page”-type:

Error message:

The website encountered an unexpected error. Please try again later. Error: Call to a member function getAccountName() on null in Drupal\node\NodeForm->form() (line 155 of core/modules/node/src/NodeForm.php).

Warning message:

call_user_func() expects parameter 1 to be a valid callback, class 'Drupal\node\Entity\Node' does not have a method 'getCurrentUserId' in Drupal\Core\Field\FieldConfigBase->getDefaultValue() (line 397 of core/lib/Drupal/Core/Field/FieldConfigBase.php).

Does anyone know what causes this?

Replace \Drupal\Component\Utility\Environment::checkMemoryLimit with a PHP memory checking helper class and service

$
0
0

Problem/Motivation

In #2583041: [PP-2] GD toolkit & operations should check for available memory we identified how \Drupal\Component\Utility\Environment::checkMemoryLimit, being a static method, cannot be unit tested under assumption of unavailable memory.

Proposed resolution

Spin off a part of #2583041-66: [PP-2] GD toolkit & operations should check for available memory:

  • Add a EnvironmentMemory class that manage calculating the actual memory size from php.ini, and provide methods to return total, used and free memory, as well as methods to check against a memory requirement (either total or remaining available).
  • Enable providing PHP Unit test that stub the currently used memory.
  • Add PHP unit tests.
  • Deprecate \Drupal\Component\Utility\Environment::checkMemoryLimit.

Remaining tasks

User interface changes

none

API changes

\Drupal\Component\Utility\Environment::checkMemoryLimit deprecated.

Data model changes

none

Promote pameeela to non-provisional committer facilitator


Identifiers longer than 63 characters are truncated, causing Views to break

$
0
0

We are running our Drupal on Postgres and have a view with 2 relations (joines tables). The Preview SQL is attached below.
Due to the table names and field names, Views2 is generating a field alias, which is longer than 63 chars. In the SQL below, it's the alias "node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value", causing Postgres not to throw an error, but truncation the name in the resultset. Postgres will only return "node_node_data_field_parent_node_node_data_field_pbcontent_year" as the column name in the resultset, which causes Views2 to break, as there is no data in the expected field "node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value".

SELECT node_node_data_field_parent_node_node_data_field_pbcontent_year.field_pbcontent_year_value AS node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value,
   COUNT(DISTINCT(node.nid)) AS num_records
 FROM node node 
 LEFT JOIN content_type_video node_data_field_video_gallery ON node.vid = node_data_field_video_gallery.vid
 INNER JOIN node node_node_data_field_video_gallery ON node_data_field_video_gallery.field_video_gallery_nid = node_node_data_field_video_gallery.nid
 LEFT JOIN content_type_video_gallery node_node_data_field_video_gallery_node_data_field_parent_node ON node_node_data_field_video_gallery.vid = node_node_data_field_video_gallery_node_data_field_parent_node.vid
 INNER JOIN node node_node_data_field_parent_node ON node_node_data_field_video_gallery_node_data_field_parent_node.field_parent_node_nid = node_node_data_field_parent_node.nid
 LEFT JOIN content_type_pbcontent node_node_data_field_parent_node_node_data_field_pbcontent_year ON node_node_data_field_parent_node.vid = node_node_data_field_parent_node_node_data_field_pbcontent_year.vid
 WHERE (node.status <> 0) AND (node.type in ('video'))
 GROUP BY node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value
  ORDER BY node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value DESC

Could anyone provide me with a workaround? Renaming the base fields and thus getting an shorter alias for the column name would work, but is not an option at the moment.
I tried to rewrite the SQL with hook_views_query_alter(), replacing all aliases in $query->fields with an generic one, if the alias is longer than 63 chars. The query then runs fine, but Views2 continues to search for the long columnames in the resultset. Any way I can tell Views2 that it shouldn't expect the data in field "node_node_data_field_parent_node_node_data_field_pbcontent_year_field_pbcontent_year_value" but for example in "generic_1"?

Deprecate passing a StatementInterface object to Connection::query

$
0
0

Problem/Motivation

Connection::query can overload the $query argument to be either a string or an already prepared statement. This is a bit confusing, since the logic of potentially calling query to get a statement and then query again with the statement as input is weird. Normally in PHP world you would prepare a statement, execute it and iterate to fetch the results - then execute it again with different $args if you want to reuse.

Also the current status will prevent in the future to typehint the $query argument, which is now possible in PHP 7+.

Proposed resolution

- Deprecate passing a StatementInterface as $query argument to Connection::query.
- When a database operation is started with a Connection::prepareStatement, follow suit with StatementInterface::execute and StatementInterface::fetch (in case of a SELECT), or other statement inspection methods for INSERT / DELETE / UPDATE.
- Keep Connection::query as a convenience helper that prepares the statement and executes it in one go.

Remaining tasks

User interface changes

None

API changes

Add the wrapper method: Drupal\Core\Database\Connection::lastInsertId(). This method is a wrapper method for \PDO::lastInsertId().

Data model changes

None

Release notes snippet

Deprecate passing a Drupal\Core\Database\StatementInterface object to Drupal\Core\Database\Connection::query() and add new method Drupal\Core\Database\Connection::lastInsertId().

Replace deprecated assertEqual( with assertEquals( in Kernel Unit Test for module views

$
0
0

Problem/Motivation

In the Kernel test, there are a bunch of using the assertEqual method and it could be replaced already with assertEquals.

Steps to reproduce

bunch of calling deprecated assertEqual in views kernel tests

Proposed resolution

Apply the patch in the attachment.

Expand the remove diacritics feature to other scripts

$
0
0

Problem/Motivation

Our current transliteration class has a method to remove diacritics from certain Latin characters. It is desirable this to be expanded to other scripts.

The current behavior is custom. It was written to remove diacritics from a range of characters with an eye on how HTML entities are called, not from a Unicode perspective. The commonly suggested way -- utlizied by Libreoffice and Firefox both -- is to use Unicode decomposition rules, remove Unicode major category "M" (aka combining characters) and re-compose them. But our solution is different. For example, it changes o with stroke to just o and as this SO answer notes, Unicode doesn't decompose it and leaves it alone. There's no right or wrong answer whether it should be rewritten: Wikipedia notes this character is treated as a separate letter in Norwegian and Danish and as such it probably shouldn't be rewritten for those but in other languages it perhaps should be.

In other words, currently the word Øresund will be stored as oresund but if we were to follow the standard way above it would be stored literally. And then searching for oresund finds it currently but wouldn't if we were to follow the standard way.

Out of the 323 characters falling within the ranges PhpTransliteration::removeDiacritics() as many as 48 (~15%) exhibit different behavior under the suggested standard route compared to the current one. Six of them are genuine bugs fixed in #3151364: diacritics are not removed from ǢǣǼǽǮǯ .

Proposed resolution

If intl is not enabled we stick to the current behavior. It is certainly possible to generate the NFD and NFC tables from the UCD and https://gist.github.com/hoehrmann/5652435 and the XO_NFD / XO_NFC properties. I doubt the effort is worth it and also the speed, especially for NFC would be abominably slow.

If intl is enabled then we introduce a pair of new classes, similar to the current Php pairs, the Component one does the work, the Core one does the alter. Also pass the langcode from search to removeDiacritics. We add the rules necessary to achieve parity with PhpTransliterator on the range it operates.

Remaining tasks

Immediate: write the test for alter. Possibly separate the component tests for the two classes by moving the classname to a constant, extending the class for intl and skip the test if intl is not enabled.

Either here or followups: give the community some way to supply sensible rules and settings as adequate. A Hungarian site for a Hungarian audience doesn't want to remove the diacritics Hungarian uses at all. However, a site about Hungary for more international audiences? I do not even know.

User interface changes

API changes

TransliterationInterface::removeDiacritics gets a new, optional argument.

Data model changes

Release notes snippet

Original report

when removing diacritics in function search_simplify(), it not considering remove Arabic diacritics. How to test: add this text to any article: "السُّلَّامُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ" then search for "السلام". learning form this article, I develop an ugly patch to fix it. It may be better to move it to PhpTransliteration.php but I am not sure.

Claro Shortcuts star fails WCAG Use of Color and Non-text contrast

$
0
0

Problem

The shortcuts star icon doesn't satisfy WCAG Success Criteria 1.4.1 "Use of Color", or 1.4.11 "Non-text contrast".

  • The grey outline of the star is too faint. It has a contrast ratio of just 2.78:1 against the grey page background.
  • The yellow fill isn't sufficiently distinguishable from the transparent fill. The contrast between the yellow and the grey page background is 1.29:1.
  • The yellow-fill is the only indication of state. On it's own, it isn't a reliable signifier. Even if these did have good contrast in the full-colour situation, the state can still be difficult for some users to notice: users with a colour vision impairment, or other visual impairments, or who have adjusted the colour space in some way, or where the screen is overpowered by ambient light.
  • When a Windows high-contrast theme is used, the star remains the same colour. We cannot rely on either the grey outline or the yellow fill to be distinguishable from the page background, because we cannot know what the background colour will be.
  • The Star is missing entirely in IE 11 when a Windows High Contrast theme is used. It's a CSS background image, and it gets stripped out by the browser. Users cannot perceive, operate, or understand it; they likely won't know it's there at all.
Viewing all 294937 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>