| @@ -169,13 +169,8 @@ | ||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | private function isXSendFileAvailable(): bool |
| 172 | 172 | { |
| 173 | - // On nginx, X-Accel-Redirect is always available — no HTTP test needed. | |
| 174 | - if ($this->wordpress->isNginx()) { | |
| 175 | - return true; | |
| 176 | - } | |
| 177 | - | |
| 178 | 173 | $content = @file_get_contents($this->wordpress->getSiteUrl() . '?testXSendFile'); |
| 179 | 174 | $this->fileHandler->removeXSendFileTestFile(); |
| 180 | 175 | |
| 181 | 176 | return ($content === 'success'); |
| @@ -180,43 +175,34 @@ | ||
| 180 | 175 | |
| 181 | 176 | return ($content === 'success'); |
| 182 | 177 | } |
| 183 | 178 | |
| 184 | - private function configureXSendFileOption(Form $form): void | |
| 179 | + private function disableXSendFileOption(Form $form): void | |
| 185 | 180 | { |
| 186 | 181 | $formElements = $form->getElements(); |
| 187 | 182 | |
| 188 | - if (isset($formElements['download_type']) === false) { | |
| 189 | - return; | |
| 190 | - } | |
| 183 | + if (isset($formElements['download_type']) === true) { | |
| 184 | + /** @var ValueSetFormElement $downloadType */ | |
| 185 | + $downloadType = $formElements['download_type']; | |
| 186 | + $possibleValues = $downloadType->getPossibleValues(); | |
| 191 | 187 | |
| 192 | - /** @var ValueSetFormElement $downloadType */ | |
| 193 | - $downloadType = $formElements['download_type']; | |
| 194 | - $possibleValues = $downloadType->getPossibleValues(); | |
| 195 | - | |
| 196 | - if (isset($possibleValues['xsendfile']) === false) { | |
| 197 | - return; | |
| 188 | + if (isset($possibleValues['xsendfile']) === true) { | |
| 189 | + $possibleValues['xsendfile']->markDisabled(); | |
| 190 | + } | |
| 198 | 191 | } |
| 199 | - | |
| 200 | - if ($this->wordpress->isNginx() === true) { | |
| 201 | - // X-Accel-Redirect is always available on nginx — just relabel the option. | |
| 202 | - $possibleValues['xsendfile']->setLabel(TXT_UAM_DOWNLOAD_TYPE_XACCELREDIRECT); | |
| 203 | - } elseif ($this->isXSendFileAvailable() === false) { | |
| 204 | - $possibleValues['xsendfile']->markDisabled(); | |
| 205 | - } | |
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | private function addLockFileTypes(array $configParameters, array &$parameters): void |
| 209 | 195 | { |
| 210 | - if (isset($configParameters['lock_file_types']) === true) { | |
| 196 | + if (isset($configParameters['lock_file_types']) === true | |
| 197 | + && $this->wordpress->isNginx() === false | |
| 198 | + ) { | |
| 211 | 199 | $parameters['lock_file_types'] = [ |
| 212 | 200 | 'selected' => 'locked_file_types', |
| 213 | 201 | 'not_selected' => 'not_locked_file_types' |
| 214 | 202 | ]; |
| 215 | 203 | |
| 216 | - if ($this->wordpress->isNginx() === false | |
| 217 | - && $this->wordpress->gotModRewrite() === false | |
| 218 | - ) { | |
| 204 | + if ($this->wordpress->gotModRewrite() === false) { | |
| 219 | 205 | $parameters[] = 'file_pass_type'; |
| 220 | 206 | } |
| 221 | 207 | } |
| 222 | 208 | } |
| @@ -250,9 +236,11 @@ | ||
| 250 | 236 | $this->addLockFileTypes($configParameters, $parameters); |
| 251 | 237 | |
| 252 | 238 | $form = $this->formHelper->getSettingsForm($parameters); |
| 253 | 239 | |
| 254 | - $this->configureXSendFileOption($form); | |
| 240 | + if ($this->isXSendFileAvailable() === false) { | |
| 241 | + $this->disableXSendFileOption($form); | |
| 242 | + } | |
| 255 | 243 | |
| 256 | 244 | return $form; |
| 257 | 245 | } |
| 258 | 246 | |