1 restore.php | restore_access_allowed() |
Determines if the current user is allowed to access restore.php.
Return value
boolean: TRUE if the current user should be granted access, or FALSE otherwise.
File
- core/
restore.php, line 274 - Administrative page for restoring backup database and configuration files.
Code
function restore_access_allowed() {
global $user;
// Allow the global variable in settings.php to override the access check.
if (settings_get('restore_free_access')) {
return TRUE;
}
// If sessions are not available, then no further access can be checked.
if (backdrop_bootstrap() < BACKDROP_BOOTSTRAP_SESSION) {
return FALSE;
}
// Calls to user_access() might not be available if the site is not in a
// working state (or the database is completely empty). The user #1 fallback
// may not work either, in which case "restore_free_access" is the only
// available way to grant access.
try {
require_once BACKDROP_ROOT . '/' . backdrop_get_path('module', 'user') . '/user.module';
return user_access('restore site backups');
}
catch (Exception $e) {
return ($user->uid == 1);
}
}