Problem/Motivation

Follow-up to #2507031-158: Optimize automatic cron subscriber by moving automatic cron to a module

@catch

I'm not 100% on keeping the form and altering it, we could possibly move that to a status report item, then link to the form if automated cron is enabled.

The cron should not be run when the user clicks "Save configuration" button.

Proposed resolution

Move the cron form to a status report item, then link to the form if automated cron is enabled

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions
(clarify the problem) Update the issue summary Instructions
Embed before and after screenshots in the issue summary Novice Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions

User interface changes

  1. With automated_cron module disabled, the cron form is disabled at /admin/config/system/cron.
  2. In Status report there's a new line under "Cron maintenance tasks" telling to enable the automated_cron module, if disabled, or linking to Automated Cron settings form, if enabled.
  3. The former route/link title 'Cron' (in /admin/config/system) renamed to 'Automated Cron'
  4. .

  5. Rearranged form elements in /admin/config/system/cron to give priority to 'interval' setting.
  6. .

API changes

None.

Data model changes

None.

Comments

YesCT created an issue. See original summary.

claudiu.cristea’s picture

Assigned: Unassigned » claudiu.cristea

Working on it.

claudiu.cristea’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new14.81 KB

Patch. Fixed IS.

Status: Needs review » Needs work

The last submitted patch, 3: 2581949-3.patch, failed testing.

The last submitted patch, 3: 2581949-3.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new31.13 KB
new16.66 KB

Let's see.

Status: Needs review » Needs work

The last submitted patch, 6: 2581949-6.patch, failed testing.

The last submitted patch, 6: 2581949-6.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new33.95 KB
new2.83 KB

Fix

dawehner’s picture

I'm actually not convinced by all the changes you made in that issue. There seems to be multiple things. IMHO we should keep the existing form in system module + have a dedicated configuration form for automated cron, but not intersect the two.

  1. +++ b/core/modules/aggregator/aggregator.module
    @@ -42,8 +42,10 @@ function aggregator_help($route_name, RouteMatchInterface $route_match) {
    +      if (\Drupal::moduleHandler()->moduleExists('automated_cron')) {
    +        $output .= '<dt>' . t('Configuring cron') . '</dt>';
    +        $output .= '<dd>' . t('A working <a href=":cron">cron maintenance task</a> is required to update feeds automatically.', array(':cron' => \Drupal::url('automated_cron.settings'))) . '</dd>';
    +      }
    
    +++ b/core/modules/search/search.module
    @@ -80,7 +80,12 @@ function search_help($route_name, RouteMatchInterface $route_match) {
    -      $output .= '<dd>' . t('Some search page plugins, such as the core Content search page, index searchable text using the Drupal core search index, and will not work unless content is indexed. Indexing is done during <em>cron</em> runs, so it requires a <a href=":cron">cron maintenance task</a> to be set up. There are also several settings affecting indexing that can be configured on the <a href=":search-settings">Search pages page</a>: the number of items to index per cron run, the minimum word length to index, and how to handle Chinese, Japanese, and Korean characters.', array(':cron' => \Drupal::url('system.cron_settings'), ':search-settings' => \Drupal::url('entity.search_page.collection'))) . '</dd>';
    +      if (\Drupal::moduleHandler()->moduleExists('automated_cron')) {
    +        $output .= '<dd>' . t('Some search page plugins, such as the core Content search page, index searchable text using the Drupal core search index, and will not work unless content is indexed. Indexing is done during <em>cron</em> runs, so it requires a <a href=":cron">cron maintenance task</a> to be set up. There are also several settings affecting indexing that can be configured on the <a href=":search-settings">Search pages page</a>: the number of items to index per cron run, the minimum word length to index, and how to handle Chinese, Japanese, and Korean characters.', [':cron' => \Drupal::url('automated_cron.settings'), ':search-settings' => \Drupal::url('entity.search_page.collection')]) . '</dd>';
    +      }
    +      else {
    
    +++ b/core/modules/search/src/SearchPageListBuilder.php
    @@ -184,11 +184,17 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +    if ($automated_cron = $this->moduleHandler()->moduleExists('automated_cron')) {
    +      $description = $this->t('Only items in the index will appear in search results. To build and maintain the index, a correctly configured <a href=":cron">cron maintenance task</a> is required.', [':cron' => \Drupal::url('automated_cron.settings')]);
    +    }
    +    else {
    +      $description = $this->t('Only items in the index will appear in search results. To build and maintain the index, a correctly configured cron maintenance task is required.');
    +    }
    

    That module check doens't make sense, cron is a generic functionality usable outside of the automated_cron module.

  2. +++ /dev/null
    @@ -1,139 +0,0 @@
    -    );
    -    $form['run'] = array(
    -      '#type' => 'submit',
    -      '#value' => t('Run cron'),
    -    );
    -    $status = '<p>' . $this->t('Last run: %time ago.', array('%time' => $this->dateFormatter->formatTimeDiffSince($this->state->get('system.cron_last')))) . '</p>';
    -    $form['status'] = array(
    -      '#markup' => $status,
    -    );
    -
    

    This functionality doesn't make sense to live just in automated_cron module ...

claudiu.cristea’s picture

Assigned: claudiu.cristea » catch

@dawehner.

IMHO we should keep the existing form in system module + have a dedicated configuration form for automated cron, but not intersect the two.

In the absence of automated_cron module, the form simply duplicates what we already have in admin/reports/status, under "Cron maintenance tasks". Items provided in both:

  • The cron status info (last run, etc).
  • A trigger for manually running the cron (here we have the only difference because in the form this is a button, while in status is a link).
  • The link to run cron from outside the site

So it's pure duplication. Also note that, without automated_cron module enabled, the form doesn't expose any value/config/setting to be saved. It's only info and a manual cron run trigger.

If we keep the actual form (from system), the IS must be redefined. I'm passing this issue to @catch for an evaluation because he raised first the concern that this form, in absence of automated_cron, is a duplication of status.

dawehner’s picture

So it's pure duplication. Also note that, without automated_cron module enabled, the form doesn't expose any value/config/setting to be saved. It's only info and a manual cron run trigger.

Well, in this case I would get rid of the button in the first place.

catch’s picture

Assigned: catch » Unassigned
Issue tags: +Needs usability review, +Needs issue summary update

Tagging for usability review. This comes down to whether the page is useful with no modules enabled and how the other modules either extend it or add their own administration pages without it.

yesct’s picture

Issue summary: View changes
Issue tags: +Needs screenshots
Bojhan’s picture

I am not sure if the functionality changes in this patch offer any additional value to users? @catch could you entail what the goal is here? It seems to mainly just add clutter.

Bojhan’s picture

Issue tags: -Needs usability review
catch’s picture

@Bojhan it removes the automated cron form (and hence the link to it in the admin interface), if the module isn't enabled. So there is more on status reports, but less menu items in admin/config. Also there is nothing to configure if the module isn't enabled, which makes it odd to have a configuration form.

Bojhan’s picture

claudiu.cristea’s picture

When automated_cron is uninstalled, the form shows the same info as the status. The only difference is that the manual cron trigger is a button on the form, while it's a link on the status page. Without automated_cron that form has no settings to configure.

chi’s picture

Issue summary: View changes
claudiu.cristea’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue tags: -Needs issue summary update

Status: Needs review » Needs work

The last submitted patch, 9: 2581949-8.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new33.95 KB

Reroll for 8.1.x.

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now 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.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.

br0ken’s picture

StatusFileSize
new13.96 KB

I'm proposing not do cardinal changes and just override (read "extend") default form.

Bojhan’s picture

Issue tags: +Usability, +sprint

What does this mean for releasability - considering BC?

br0ken’s picture

@Bojhan, I'm not sure I understand what you meant by. Changes means that:

- cron will not be triggered during saving its configuration;
- configuration saving will not performed by clicking on "Run cron";
- interval configuration ain't available when "automated_cron" module disabled.

Does it make sense for you?

br0ken’s picture

Any updates?

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.

br0ken’s picture

Issue tags: +DevDaysSeville

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.

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.

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.

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)

Wonder if this is still a valid task. And what is needed for D10 to move this forward?

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.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there hasn't been a follow up in over a year going to close out for now.

If still a valid task please reopen.