#1920902: Add a Drupal Yaml wrapper so we can default to PECL Yaml component if it is available.

Need to:

1. Tell people what's installed.

2. Potentially suggest the PECL parser if it's not installed.

Image module does the same for uploads.

Issue fork drupal-2157447

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Makes sense

larowlan’s picture

Status: Active » Needs review
FileSize
30.19 KB
16.61 KB
1.37 KB

Something like this

Screenshots:

Without

before

With

after

benjy’s picture

  1. +++ b/core/modules/system/system.install
    @@ -529,6 +529,24 @@ function system_requirements($phase) {
    +        '@url' => 'http://pecl.php.net/package/yaml'
    

    Missing comma

  2. +++ b/core/modules/system/system.install
    @@ -529,6 +529,24 @@ function system_requirements($phase) {
    +        '@url' => 'http://pecl.php.net/package/yaml'
    

    And again.

Just a few style issues otherwise looks good.

Status: Needs review » Needs work

The last submitted patch, 2: yaml-extension-2157447.1.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review

2: yaml-extension-2157447.1.patch queued for re-testing.

benjy’s picture

Added the commas, fixed a typo and a minor rewording.

marvil07’s picture

Status: Needs review » Reviewed & tested by the community

I tested this locally both without and with the extension enabled, and it works as expected.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
catch’s picture

Status: Needs work » Postponed
marvil07’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Postponed » Needs work
+++ b/core/modules/system/system.install
@@ -529,6 +529,24 @@ function system_requirements($phase) {
+      $requirements['pecl_yaml']['value'] = t('Enabled');

I'd better displayed version installed somehow

sidharthap’s picture

Status: Needs work » Needs review
FileSize
1.31 KB

reroll patch against 8.3.x. tried to find out the version but not yet success.

andypost’s picture

sidharthap’s picture

Thank you @andypost for sharing the link. Here is the updated patch along with the screen short after change.

andypost’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Looks great for me

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/system/system.install
@@ -257,6 +257,25 @@ function system_requirements($phase) {
+  if ($phase == 'runtime') {

Any reason we're not also doing this for $phase == 'install' ?

For checking the opcache extension, for example, we are also taking both install and runtime into account.

andypost’s picture

Probably it makes sense to notice at install as well otoh this is PECL and not so easy as opcache shiped
Looking at #2792877: Symfony YAML parser fails on some strings when running PHP 7 also I worry about this sort of issues

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Reroll & fix #19

alexpott’s picture

+++ b/core/modules/system/system.install
@@ -283,6 +283,25 @@ function system_requirements($phase) {
+      'severity' => REQUIREMENT_WARNING,

This shouldn't be a warning. It's not wrong to not use it. Personally I feel like this is not necessary to put requirements screen. Also I can't see how this is related to #2844452: Export configuration YAML strings as multiline at all.

andypost’s picture

It is related by different behavior when pecl enabled.
As it gives 10% speed-up sometimes this looks like warning similar to opcache

alexpott’s picture

10% only on very cold caches. It is completely unlike opcache which affects every request. This affects 0 requests once caches are in place. Also the only reason you are seeing differences is because you are writing with PECL yaml which we do not support at all. All writes should take place with Symfony to ensure that config is transportable regardless of what you have installed.

andypost’s picture

I wonders why you so cares about formating when yaml supposed to be formating agnostic, and it was the main reason to select it over more common xml because it more readable for humans

Finally core operates at config objects which are going to be typed (mostly) then excachange should just have tests that pecl->SF and back works at config level

alexpott’s picture

@andypost so... we care about portability and people ending up with the same results regardless of what PHP extensions installed. And seeing unexpected differences in YAML files which end up having no differences in the data is to be avoided at all costs. That's why Symfony is always used to write. Plus there's the fact that Symfony respects the 1.2 spec whereas PECL is 1.1.

As stated before I think we shouldn't recommend PECL Yaml on the status report and certainly not with a warning.

joachim’s picture

I agree that the WARNING is a bit alarming.

For comparison, upload progress doesn't set a severity level: https://api.drupal.org/api/drupal/core%21modules%21file%21file.install/f...

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joachim’s picture

Status: Needs review » Needs work

Let's downgrade the warning.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

andypost’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Created MR with the latest patch

andypost’s picture

Fixed #33

alexpott’s picture

Status: Needs review » Needs work

I don't know if we have to recommend the PECL yaml parser. I think we could indicate what's be used for YAML parsing on the status report and link to a page on drupal.org that discusses the possibilities..

Wim Leers’s picture

#47++

Recommending it is too strong, because one needs control over their hosting environment to be able to do this.

Informing is great 👍

andypost’s picture

Status: Needs work » Needs review

The MR already provides informing

Your server is not using the PECL YAML extension for parsing YAML. Installing this extension will improve the performance of parsing YAML files on your server.

maybe it needs section at https://www.drupal.org/docs/getting-started/system-requirements/php-requ... with the link from report/status

Wim Leers’s picture

"will improve" sounds like a recommendation to me? 😅

Left a suggestion for changing it to "merely informing", i.e. purely observing.

smustgrave’s picture

Status: Needs review » Needs work

Agree that

Installing this extension will improve the performance of parsing YAML files on your server.

sounds like a recommendation, or. that not doing it means I'm doing something wrong.

But maybe that sentence could be added to a section in https://www.drupal.org/docs/getting-started/system-requirements/php-requ... that @andypost recommended.

So maybe

Your server is not using the PECL YAML extension for parsing YAML. See @link for more information.

andypost’s picture

Title: Add hook_requirements() for PECL YAML parser » Remove hook_requirements() for PECL YAML parser
andypost’s picture

Title: Remove hook_requirements() for PECL YAML parser » Add hook_requirements() for PECL YAML parser
Status: Needs work » Closed (outdated)

proper status