Part of #1998638: Replace almost all remaining superglobals ($_GET, $_POST, etc.) with Symfony Request object

Files needing conversion are:

  • core/modules/action/tests/action_loop_test/action_loop_test.module

Comments

chertzog’s picture

Assigned: Unassigned » chertzog
Status: Active » Needs review
StatusFileSize
new1.37 KB
pbuyle’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
/**
 * Replacement of the watchdog() function that eliminates the use of semaphores
 * so that we can test the abortion of an action loop.
 */
function watchdog_skip_semaphore($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
  global $user, $base_root;

  // Prepare the fields to be logged
  $log_entry = array(
    'type'        => $type,
    'message'     => $message,
    'variables'   => $variables,
    'severity'    => $severity,
    'link'        => $link,
    'user'        => $user,
    'uid'         => isset($user->uid) ? $user->uid : 0,
    'request_uri' => $base_root . request_uri(),
    'referer'     => $_SERVER['HTTP_REFERER'],
    'ip'          => Drupal::request()->getClientIP(),
    'timestamp'   => REQUEST_TIME,
  );

  // Call the logging hooks to log/process the message
  foreach (module_implements('watchdog') as $module) {
    module_invoke($module, 'watchdog', $log_entry);
  }
}

There another function that accessing globals... need to also replace REQUEST_TIME and the $_SERVER

kim.pepper’s picture

Status: Needs work » Closed (won't fix)

This file was recently removed in #1846172: Replace the actions API