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:

Comments

ankithashetty created an issue. See original summary.

ankithashetty’s picture

Status: Active » Needs review
StatusFileSize
new52.82 KB

Replaced t() calls with $this->t() in the following patch, please review.

Thank you.

dipesh_goswami made their first commit to this issue’s fork.

dipesh_goswami’s picture

Assigned: Unassigned » dipesh_goswami

Hi,
I am reviewing your patch.
Thanks

dipesh_goswami’s picture

Assigned: dipesh_goswami » Unassigned

Hi,
Your patch does not applied for me (shown below):

dipes@Lucky MINGW64 /c/xampp/htdocs/Contribution-project/web/modules/contrib/ultimate_cron-3131660 (3131660-t-calls-should)
$ git apply -v 3131660-2.patch
Checking patch src/Commands/UltimateCronCommands.php...
Checking patch src/CronJobDiscovery.php...
error: while searching for:
  protected function getJobTitle($id) {
    $titles = array();

    $titles['comment_cron'] = t('Store the maximum possible comments per thread');
    $titles['dblog_cron'] = t('Remove expired log messages and flood control events');
    $titles['field_cron'] = t('Purges deleted Field API data');
    $titles['file_cron'] = t('Deletes temporary files');
    $titles['history_cron'] = t('Deletes history');
    $titles['search_cron'] = t('Updates indexable active search pages');
    $titles['system_cron'] = t('Cleanup (caches, batch, flood, temp-files, etc.)');
    $titles['update_cron'] = t('Update indexes');
    $titles['node_cron'] = t('Mark old nodes as read');
    $titles['aggregator_cron'] = t('Refresh feeds');
    $titles['ultimate_cron_cron'] = t('Runs internal cleanup operations');
    $titles['statistics_cron'] = t('Reset counts and clean up');
    $titles['tracker_cron'] = t('Update tracker index');

    if (isset($titles[$id])) {
      return $titles[$id];
    }
    return t('Default cron handler');
  }

  /**

error: patch failed: src/CronJobDiscovery.php:130
error: src/CronJobDiscovery.php: patch does not apply
Checking patch src/CronJobListBuilder.php...
error: while searching for:
  public function buildRow(EntityInterface $entity) {
    /* @var \Drupal\ultimate_cron\CronJobInterface $entity */
    $icon = drupal_get_path('module', 'ultimate_cron') . '/icons/hourglass.png';
    $behind_icon = ['#prefix' => ' ', '#theme' => 'image', '#uri' => file_create_url($icon), '#title' => t('Job is behind schedule!')];

    $log_entry = $entity->loadLatestLogEntry();
    $row['label'] = $entity->label();

error: patch failed: src/CronJobListBuilder.php:38
error: src/CronJobListBuilder.php: patch does not apply
Checking patch src/CronPlugin.php...
Checking patch src/Entity/CronJob.php...
Hunk #2 succeeded at 60 (offset 1 line).
Hunk #3 succeeded at 451 (offset 1 line).
Checking patch src/Form/CronJobForm.php...
Checking patch src/Form/LauncherSettingsForm.php...
Checking patch src/Form/LoggerSettingsForm.php...
error: while searching for:
    $states = array('expire' => array(), 'retain' => array());
    $form['database']['method_expire'] = array(
      '#type' => 'fieldset',
      '#title' => t('Remove logs older than a specified age'),
    ) + $states['expire'];
    $form['database']['method_expire']['expire'] = array(
      '#type' => 'textfield',
      '#title' => t('Log entry expiration'),
      '#description' => t('Remove log entries older than X seconds.'),
      '#default_value' => $config->get('logger.database.expire'),
      '#fallback' => TRUE,
      '#required' => TRUE,

error: patch failed: src/Form/LoggerSettingsForm.php:84
error: src/Form/LoggerSettingsForm.php: patch does not apply
Checking patch src/Form/SchedulerSettingsForm.php...
Checking patch src/Launcher/LauncherBase.php...
error: while searching for:
  public function formatRunning(CronJobInterface $job) {
    $file = drupal_get_path('module', 'ultimate_cron') . '/icons/hourglass.png';
    $status = theme('image', array('path' => $file));
    $title = t('running');
    return array($status, $title);
  }


error: patch failed: src/Launcher/LauncherBase.php:69
error: src/Launcher/LauncherBase.php: patch does not apply
Checking patch src/Logger/LogEntry.php...
Checking patch src/Plugin/ultimate_cron/Launcher/SerialLauncher.php...
Checking patch src/Plugin/ultimate_cron/Logger/CacheLogger.php...
Checking patch src/Plugin/ultimate_cron/Logger/DatabaseLogger.php...
Checking patch src/Plugin/ultimate_cron/Scheduler/Crontab.php...
Checking patch src/Plugin/ultimate_cron/Scheduler/Simple.php...
Checking patch src/QueueSettings.php...
Checking patch tests/src/Functional/CronJobFormTest.php...
error: while searching for:
    $edit = array('title' => $this->jobName);

    // Save the new job.
    $this->drupalPostForm(NULL, $edit, t('Save'));
    // Assert the edited Job hasn't run yet.
    $this->assertText('Never');
    // Assert messenger service message for successful updated job.
    $this->assertText(t('job @name has been updated.', array('@name' => $this->jobName)));

    // Run the Jobs.
    $this->cronRun();

error: patch failed: tests/src/Functional/CronJobFormTest.php:79
error: tests/src/Functional/CronJobFormTest.php: patch does not apply
Checking patch tests/src/Functional/CronJobInstallTest.php...
error: while searching for:
   */
  public function testRequirements() {
    $element = ultimate_cron_requirements('runtime')['cron_jobs'];
    $this->assertEqual($element['value'], t("Cron is running properly."));
    $this->assertEqual($element['severity'], REQUIREMENT_OK);



error: patch failed: tests/src/Functional/CronJobInstallTest.php:64
error: tests/src/Functional/CronJobInstallTest.php: patch does not apply
Checking patch tests/src/Kernel/UltimateCronQueueTest.php...

dipes@Lucky MINGW64 /c/xampp/htdocs/Contribution-project/web/modules/contrib/ultimate_cron-3131660 (3131660-t-calls-should)
solideogloria’s picture

Status: Needs review » Needs work
sandeepsingh199’s picture

StatusFileSize
new51.33 KB

Yahh.. patch #2 is not applied for me as well , so I have again re-rolling the same patch #2 for 9.4 and 9.5. please check again and validate.

sandeepsingh199’s picture

StatusFileSize
new51.77 KB

fixed #7 issue.

sandeepsingh199’s picture

Status: Needs work » Needs review
StatusFileSize
new674 bytes
solideogloria’s picture

Status: Needs review » Needs work

I think you missed one in CronJobFormTest.php

$this->assertSession()->pageTextContains(t('Enabled cron job @name.', array('@name' => $this->jobName)));

Maybe check again that there aren't any other t() calls that you missed.

sandeepsingh199’s picture

Status: Needs work » Needs review
StatusFileSize
new51.83 KB
new869 bytes

thanks @solideogloria for point out the bug, I have Fixed that and attaching patch same.

solideogloria’s picture

I found several more that should be $this->t(). I found them by applying the previous patch then search for the regex (?<!->)\bt\(

The specific files with missed calls were GeneralSettingsForm.php, LauncherSettingsForm.php, LoggerSettingsForm.php, LogEntry.php, and DatabaseLogger.php

See the merge request.

Here's a patch if you need it: https://git.drupalcode.org/project/ultimate_cron/-/merge_requests/25.patch

solideogloria’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3188650: Replace t() with $this->t() in all classes

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.