Unverified Commit 32a13379 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2422681 by berdir, catch, ressa, nicxvan, alexpott, longwave: Remove...

Issue #2422681 by berdir, catch, ressa, nicxvan, alexpott, longwave: Remove the automatic cron run from the installer
parent b36a4fc5
Loading
Loading
Loading
Loading
Loading
+0 −5
Changes for core/includes/install.core.inc: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -1910,11 +1910,6 @@ function install_finished(&$install_state) {
  // installer does not use an HttpKernel, that event is never triggered.
  \Drupal::service('router.builder')->rebuild();

  // Run cron to populate update status tables (if available) so that users
  // will be warned if they've installed an out of date Drupal version.
  // Will also trigger indexing of profile-supplied content or feeds.
  \Drupal::service('cron')->run();

  if ($install_state['interactive']) {
    // Load current user and perform final login tasks.
    // This has to be done after drupal_flush_all_caches()
+6 −1
Changes for core/modules/system/src/Form/CronForm.php: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -111,7 +111,12 @@ public function buildForm(array $form, FormStateInterface $form_state) {
      '#value' => $this->t('Run cron'),
      '#submit' => ['::runCron'],
    ];
    $status = '<p>' . $this->t('Last run: %time ago.', ['%time' => $this->dateFormatter->formatTimeDiffSince($this->state->get('system.cron_last'))]) . '</p>';
    if ($time_ago = $this->state->get('system.cron_last')) {
      $status = '<p>' . $this->t('Last run: %time ago.', ['%time' => $this->dateFormatter->formatTimeDiffSince($time_ago)]) . '</p>';
    }
    else {
      $status = '<p>' . $this->t('Last run: never') . '</p>';
    }
    $form['status'] = [
      '#markup' => $status,
    ];
+10 −4
Changes for core/modules/system/tests/src/Functional/System/CronRunTest.php: 10 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -120,11 +120,17 @@ public function testCronExceptions(): void {
  public function testCronUI(): void {
    $admin_user = $this->drupalCreateUser(['administer site configuration']);
    $this->drupalLogin($admin_user);
    \Drupal::state()->delete('system.cron_last');
    $this->drupalGet('admin/config/system/cron');
    // Don't use REQUEST to calculate the exact time, because that will
    // fail randomly. Look for the word 'years', because without a timestamp,
    // the time will start at 1 January 1970.
    $this->assertSession()->pageTextNotContains('years');
    // Check that cron has never run.
    $this->assertSession()->pageTextContains('Last run: never');

    // Now check that it has run.
    // Sleep to allow cron time to complete since it happens during kernel
    // terminate after the page response is set.
    sleep(3);
    $this->drupalGet('admin/config/system/cron');
    $this->assertSession()->pageTextNotContains('Last run: never');

    $cron_last = time() - 200;
    \Drupal::state()->set('system.cron_last', $cron_last);