backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 38 forks source link

The code shown for callback_batch_operation() calls a function that Backdrop core does not implement #6634

Open kiamlaluno opened 6 days ago

kiamlaluno commented 6 days ago

callback_batch_operation() contains the following code.

  while ($row = db_fetch_array($result)) {

    // Here we actually perform our processing on the current node.
    $node = node_load($row['nid'], NULL, TRUE);
    $node->value1 = $options1;
    $node->value2 = $options2;
    node_save($node);

    // Store some result for post-processing in the finished callback.
    $context['results'][] = check_plain($node->title);

    // Update our progress information.
    $context['sandbox']['progress']++;
    $context['sandbox']['current_node'] = $node->nid;
    $context['message'] = t('Now processing %node', array('%node' => $node->title));
  }

Backdrop core does not implement any db_fetch_array() function, which is instead implemented in Drupal 6.

The code shown for that callback needs to be updated to use only functions Backdrop core has.

This is the equivalent of callback_batch_operation() code still contains Drupal 6 code I reported for Drupal 8.

argiepiano commented 6 days ago

Well, this is mitigated by the fact that this is an example function that never gets called, and is part of an api.php file. There are several examples of other api.php files that include code that would never run.

I would call this a documentation problem, not a bug. And it would be very, very low in my list of priorities, to be honest.