This is a sub-issue of #1910624: [META] Introduce and complete configuration schemas in all of core.

Problem/motivation

#1866610: Introduce Kwalify-inspired schema format for configuration introduced the idea of config schema. The changelog leads to (hopefully extensive) documentation on the format at http://drupal.org/node/1905070. While there are little cleanups planned for the format overall, the current format is a result of months of back and forths, so it should be perfectly fine to apply it more widely to core.

Proposed solution

Create a configuration schema for update module.

Schema in place

Schema not yet in place
update.settings.yml

Files: 
CommentFileSizeAuthor
#24 1919218-update-schema-24.patch1.38 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 53,024 pass(es). View
#19 1919218-update-schema-19.patch834 bytessandipmkhairnar
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919218-update-schema-19.patch. Unable to apply patch. See the log in the details link for more information. View
#19 1919218-diff-17-19.txt834 bytessandipmkhairnar
#17 1919218-update-schema-17.patch825 bytessandipmkhairnar
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919218-update-schema-17.patch. Unable to apply patch. See the log in the details link for more information. View
#17 1919218-diff-12-16.txt825 bytessandipmkhairnar
#14 update-schema-form.png39.39 KBsandipmkhairnar
#10 1919218-update-schema-10.patch1.36 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,547 pass(es). View
#10 update-schema.png16.1 KBsandipmkhairnar
#9 1919218-update-schema-9.patch1.36 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 52,231 pass(es). View
#9 1919218-diff-2-9.txt735 bytesvijaycs85
#2 1919218-update-schema-2.patch1.37 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,212 pass(es). View
#2 update-schema-form.png20.68 KBsandipmkhairnar
#1 1919218-update-schema-1.patch809 bytesvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 50,924 pass(es). View

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
809 bytes
PASSED: [[SimpleTest]]: [MySQL] 50,924 pass(es). View

Adding schema file.

sandipmkhairnar’s picture

FileSize
20.68 KB
1.37 KB
PASSED: [[SimpleTest]]: [MySQL] 52,212 pass(es). View

updating schema as per code style in http://drupal.org/node/1905070#codestyle and verified in config_inspector

schema form

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Are these the labels used on the forms where forms exist to edit these values? Eg. "Check for updates" looks odd for a day interval value. My initial reaction was if its an on/off switch it should be a boolean. Now seeing from the schema it is an interval. What about other labels?

sandipmkhairnar’s picture

Status: Needs work » Needs review

I checked the module and updated the same label whichever available. Updated my own for remaining.

pfrenssen’s picture

Assigned: Unassigned » pfrenssen

Assigning for review.

pfrenssen’s picture

@Gabor, yeah that is how it is presented in the config forms. These are actually radio buttons which have labels that clarify the meaning:

  $form['update_check_frequency'] = array(
    '#type' => 'radios',
    '#title' => t('Check for updates'),
    '#default_value' => $config->get('check.interval_days'),
    '#options' => array(
      '1' => t('Daily'),
      '7' => t('Weekly'),
    ),
    '#description' => t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'),
  );

Would it be better to use 'Update check frequency' here?

pfrenssen’s picture

Got an answer from alexpott on #6. For the moment the best practice is to use the existing strings.

pfrenssen’s picture

Assigned: pfrenssen » Unassigned
Status: Needs review » Needs work

+ label: 'E-mail addresses to nofity when updates are available'
nofity -> notify

+    notification:
+      type: mapping
+      label: 'Notification settings'
+      mapping:
 ...
+        threshold:
+          type: integer
+          label: 'E-mail notification threshold'

notification.threshold should not be an integer but a string containing 'all' or 'security' according to the form:

  $form['update_notification_threshold'] = array(
    '#type' => 'radios',
    '#title' => t('E-mail notification threshold'),
    '#default_value' => $config->get('notification.threshold'),
    '#options' => array(
      'all' => t('All newer versions'),
      'security' => t('Only security updates'),
    ),
  );
+    notification:
+      type: mapping
+      label: 'Notification settings'
+      mapping:
+        emails:
+          type: sequence
+          label: 'E-mail addresses to nofity when updates are available'
+          sequence:
+            - type: string
+              label: 'E-mail'

This should be type 'email' instead of type 'string'.

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
735 bytes
1.36 KB
PASSED: [[SimpleTest]]: [MySQL] 52,231 pass(es). View

Thank @pfrenssen for the review. Updated all changes mentioned in #8.

sandipmkhairnar’s picture

FileSize
16.1 KB
1.36 KB
PASSED: [[SimpleTest]]: [MySQL] 52,547 pass(es). View

small changed in label. patch is working fine for me.
schema form

joates’s picture

Assigned: Unassigned » joates

...

joates’s picture

Assigned: Unassigned » joates
Status: Needs review » Needs work
FileSize
41.1 KB

this notice / error showed up in config-inspector..
1919218-cmi-update-screenshot.png

joates’s picture

Assigned: joates » Unassigned
sandipmkhairnar’s picture

Assigned: joates » Unassigned
FileSize
39.39 KB

I have reverted and again apply same patch. Its working fine for me.schema form

joates’s picture

Assigned: Unassigned » joates
Status: Needs work » Needs review

@sandipmkhairnar my sincere apologies,
i had disabled the 'Update Manager' during the initial install (which is my normal workflow for a dev environment) and then re-enabled it to review your patch, this caused the site default email to somehow be excluded from the config (but that's obviously outside the scope of this issue -- i will raise that as a separate CMI tagged bug report)

your patch applies cleanly, i will follow up with a review..

joates’s picture

Assigned: joates » Unassigned
Status: Needs review » Needs work

taken from the coding style guide..

The schema items should have labels anyway, which should describe them well.

+++ b/core/modules/update/config/schema/update.schema.ymlundefined
@@ -0,0 +1,42 @@
+          label: 'Check for updates'

this label doesn't mention that it is how many "days" have passed since the last check.. it should specify number of days since last check

+++ b/core/modules/update/config/schema/update.schema.ymlundefined
@@ -0,0 +1,42 @@
+          label: 'Timeout'

Timeout? Timeout (ms) might be better, without an interval measurement being specified i don't know what this value represents. (i assume milliseconds but 5ms seems a ridiculously low threshold for a HTTP request.. is it 500ms?)

+++ b/core/modules/update/config/schema/update.schema.ymlundefined
@@ -0,0 +1,42 @@
+        threshold:
+          type: string
+          label: 'E-mail notification threshold'

this 'string' contains a zero.. is there a reason this needs to be a string? (to contain a threshold value?)

sandipmkhairnar’s picture

FileSize
825 bytes
825 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919218-update-schema-17.patch. Unable to apply patch. See the log in the details link for more information. View

@joates Thanks for comment. Updated labels as per comment.

As per @pfrenssen comment in #8 notification.threshold should not be an integer but a string containing 'all' or 'security' according to the form.

joates’s picture

+          label: 'Number of days since last check'

this is a good improvement for this label but i think it could be equally good as just 'Days since last check'

+          label: 'Timeout(ms)'

there should be a single space between like this.. 'Timeout (ms)'

sandipmkhairnar’s picture

FileSize
834 bytes
834 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919218-update-schema-19.patch. Unable to apply patch. See the log in the details link for more information. View

Thanks @joates. Updated labels as per comment.

vijaycs85’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1919218-update-schema-19.patch, failed testing.

joates’s picture

@sandipmkhairnar..

just a friendly tip, looks like you are having some problems with yr patch uploading and creating an interdiff workflow, i would suggest uploading a complete and working patch at this stage (so that it can pass the tests and be applied by a reviewer) -- the interdiff part is basically optional (although some argue it's "best practice") the documentation here states:

You should supply one whenever you update a significant patch in the issue queues

(i added the bold) i don't mean that your patch is insignificant in this context 'significant' means large and/or complex.

the .patch file is really whats needed :))

thanks for your great work on this issue sandipmkhairnar.

joates’s picture

small change to 'Timeout' label..

core/modules/update/update.fetch.inc: $end = time() + config('update.settings')->get('fetch.timeout');

its actually seconds not milliseconds (ms)

'Timeout in seconds' seems to be the most appropriate label.. your thoughts ?

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
1.38 KB
PASSED: [[SimpleTest]]: [MySQL] 53,024 pass(es). View

Updating patch with changes...

reg

this 'string' contains a zero.. is there a reason this needs to be a string? (to contain a threshold value?)

in #16, as per UI,

    '#options' => array(
      'all' => t('All newer versions'),
      'security' => t('Only security updates'),
    ),

as options and by default, we don't want to select any of this.

Status: Needs review » Needs work
Issue tags: -Configuration system, -D8MI, -language-config, -Configuration schema

The last submitted patch, 1919218-update-schema-24.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
Issue tags: +Configuration system, +D8MI, +language-config, +Configuration schema

#24: 1919218-update-schema-24.patch queued for re-testing.

joates’s picture

Status: Needs review » Reviewed & tested by the community

patch looks great to me !

thanks @vijaycs85 and @sandipmkhairnar for your work on this issue.

joates’s picture

FileSize
31.71 KB

screenshot..
1919218-patch-24.png

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x.

Automatically closed -- issue fixed for 2 weeks with no activity.