Commit 0766ddc0 authored by catch's avatar catch
Browse files

Issue #2958176 by alexpott: Replace all remaining superglobals ($_GET, $_POST,...

Issue #2958176 by alexpott: Replace all remaining superglobals ($_GET, $_POST, $_REQUEST and $_FILES) with Symfony Request object
parent fdf37cf3
...@@ -77,14 +77,15 @@ function system_requirements($phase) { ...@@ -77,14 +77,15 @@ function system_requirements($phase) {
} }
// Web server information. // Web server information.
$software = \Drupal::request()->server->get('SERVER_SOFTWARE'); $request_object = \Drupal::request();
$software = $request_object->server->get('SERVER_SOFTWARE');
$requirements['webserver'] = [ $requirements['webserver'] = [
'title' => t('Web server'), 'title' => t('Web server'),
'value' => $software, 'value' => $software,
]; ];
// Tests clean URL support. // Tests clean URL support.
if ($phase == 'install' && $install_state['interactive'] && !isset($_GET['rewrite']) && strpos($software, 'Apache') !== FALSE) { if ($phase == 'install' && $install_state['interactive'] && !$request_object->query->has('rewrite') && strpos($software, 'Apache') !== FALSE) {
// If the Apache rewrite module is not enabled, Apache version must be >= // If the Apache rewrite module is not enabled, Apache version must be >=
// 2.2.16 because of the FallbackResource directive in the root .htaccess // 2.2.16 because of the FallbackResource directive in the root .htaccess
// file. Since the Apache version reported by the server is dependent on the // file. Since the Apache version reported by the server is dependent on the
......
...@@ -135,6 +135,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { ...@@ -135,6 +135,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
*/ */
public function submitForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) {
$local_cache = NULL; $local_cache = NULL;
$all_files = $this->getRequest()->files->get('files', []);
if ($form_state->getValue('project_url')) { if ($form_state->getValue('project_url')) {
$local_cache = update_manager_file_get($form_state->getValue('project_url')); $local_cache = update_manager_file_get($form_state->getValue('project_url'));
if (!$local_cache) { if (!$local_cache) {
...@@ -142,7 +143,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -142,7 +143,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
return; return;
} }
} }
elseif ($_FILES['files']['name']['project_upload']) { elseif (!empty($all_files['project_upload'])) {
$validators = ['file_validate_extensions' => [archiver_get_extensions()]]; $validators = ['file_validate_extensions' => [archiver_get_extensions()]];
if (!($finfo = file_save_upload('project_upload', $validators, NULL, 0, FILE_EXISTS_REPLACE))) { if (!($finfo = file_save_upload('project_upload', $validators, NULL, 0, FILE_EXISTS_REPLACE))) {
// Failed to upload the file. file_save_upload() calls // Failed to upload the file. file_save_upload() calls
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment