You are here

function _patterns_section_success in Patterns 7.2

Outputs information about a successful execution of a section of a pattern and updates its db status

Parameters

mixed $pid The pid of the pattern:

mixed $pattern_title The title of the pattern:

mixed $section The title of the section executed:

mixed $msg Optional. An additional message to be displayed:

2 calls to _patterns_section_success()
patterns_batch_finish in includes/core/batch.inc
Finishes a batch operation.
patterns_execute_pattern_php in includes/core/php.inc
Execute a Pattern. Actions will be called sequentially.

File

includes/core/common.inc, line 317
The common functions used by the Batch and PHP running modes.

Code

function _patterns_section_success($pid, $pattern_title, $section, $msg = NULL) {
  $params = array(
    '@pattern' => $pattern_title,
    '@section' => $section,
  );
  drupal_set_message(t('Section "@section" of pattern "@pattern" ran successfully.', $params));
  if (!empty($msg)) {
    drupal_set_message($msg);
  }
  $query_params = array(
    ':time' => time(),
    // Note: time() != $_SERVER['REQUEST_TIME']
    ':pid' => $pid,
    ':en' => PATTERNS_STATUS_ENABLED,
  );
  db_query("UPDATE {patterns} SET status = :en, enabled = :time WHERE pid = :pid", $query_params);
}