Skip to main content
Tweeted twitter.com/StackDrupal/status/1181630470523670530
added 338 characters in body
Source Link
Diep Tang
  • 185
  • 1
  • 2
  • 11

I am working on Drupal 8 and batch API. I created the batch api calling importingmatch and it should automatically importing every 1 hour.

My solution is use Drush for make it works without the browser, but I don't know how I can get the batch id.

Here is my code about the Batch API:

// Set up the Batch API
    $batch = array(
        'operations' => $operations,
        'finished' => 'importingmatch_finishedBatch',
        'title' => t('Import match'),
        'init_message' => t('Starting import match.....'),
        'progress_message' => t('Completed @current step of @total.'),
        'error_message' => t('Import match deletion has encountered an error.'),
    );

    batch_set($batch);

Currently, this batch is runing perfect if I access from my PC. Url: www.mysite.com/importing_match I am not sure how make it working from the server Centos with Drush, I need the batch ID for execute: Drush batch-process

So,UPDATE:

I need a good solution for thatchanged from localhost to 127.0.0.1 from the settings.php but it's not helpful. Any idea?

I am working on Drupal 8 and batch API. I created the batch api calling importingmatch and it should automatically importing every 1 hour.

My solution is use Drush for make it works without the browser, but I don't know how I can get the batch id.

Here is my code about the Batch API:

// Set up the Batch API
    $batch = array(
        'operations' => $operations,
        'finished' => 'importingmatch_finishedBatch',
        'title' => t('Import match'),
        'init_message' => t('Starting import match.....'),
        'progress_message' => t('Completed @current step of @total.'),
        'error_message' => t('Import match deletion has encountered an error.'),
    );

    batch_set($batch);

Currently, this batch is runing perfect if I access from my PC. Url: www.mysite.com/importing_match I am not sure how make it working from the server Centos with Drush, I need the batch ID for execute: Drush batch-process

So, I need a good solution for that.

I am working on Drupal 8 and batch API. I created the batch api calling importingmatch and it should automatically importing every 1 hour.

My solution is use Drush for make it works without the browser, but I don't know how I can get the batch id.

Here is my code about the Batch API:

// Set up the Batch API
    $batch = array(
        'operations' => $operations,
        'finished' => 'importingmatch_finishedBatch',
        'title' => t('Import match'),
        'init_message' => t('Starting import match.....'),
        'progress_message' => t('Completed @current step of @total.'),
        'error_message' => t('Import match deletion has encountered an error.'),
    );

    batch_set($batch);

Currently, this batch is runing perfect if I access from my PC. Url: www.mysite.com/importing_match I am not sure how make it working from the server Centos with Drush, I need the batch ID for execute: Drush batch-process

UPDATE:

I changed from localhost to 127.0.0.1 from the settings.php but it's not helpful. Any idea?

Source Link
Diep Tang
  • 185
  • 1
  • 2
  • 11

How can execute batch api over cron jobs

I am working on Drupal 8 and batch API. I created the batch api calling importingmatch and it should automatically importing every 1 hour.

My solution is use Drush for make it works without the browser, but I don't know how I can get the batch id.

Here is my code about the Batch API:

// Set up the Batch API
    $batch = array(
        'operations' => $operations,
        'finished' => 'importingmatch_finishedBatch',
        'title' => t('Import match'),
        'init_message' => t('Starting import match.....'),
        'progress_message' => t('Completed @current step of @total.'),
        'error_message' => t('Import match deletion has encountered an error.'),
    );

    batch_set($batch);

Currently, this batch is runing perfect if I access from my PC. Url: www.mysite.com/importing_match I am not sure how make it working from the server Centos with Drush, I need the batch ID for execute: Drush batch-process

So, I need a good solution for that.