function update_access_allowed

Determines if the current user is allowed to run update.php.

Return value

TRUE if the current user should be granted access, or FALSE otherwise.

1 call to update_access_allowed()
update.php in drupal/update.php
Administrative page for handling updates from one Drupal version to another.

File

drupal/update.php, line 304
Administrative page for handling updates from one Drupal version to another.

Code

function update_access_allowed() {
  global $update_free_access, $user;

  // Allow the global variable in settings.php to override the access check.
  if (!empty($update_free_access)) {
    return TRUE;
  }

  // Calls to user_access() might fail during the Drupal 6 to 7 update process,
  // so we fall back on requiring that the user be logged in as user #1.
  try {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'user') . '/user.module';
    return user_access('administer software updates');
  } catch (Exception $e) {
    return $user->uid == 1;
  }
}