Add more codes to be accepted to change the htaccess see BT#12478

pull/2487/head
jmontoyaa 8 years ago
parent 3540e6d97b
commit 9090f95b74
  1. 24
      plugin/maintenancemode/plugin.php

@ -157,26 +157,32 @@ RewriteRule \.*$ '.$append.'/maintenance.html [R=302,L]
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
// Looks htaccess contains errors. Restore as it was.
if ($httpCode != 200) {
$statusOkList = [
200,
301,
302,
];
if (in_array($httpCode, $statusOkList)) {
$result = file_put_contents($maintenanceHtml, $content);
if ($result === false) {
Display::addFlash(
Display::return_message(
'Check your htaccess instructions. The original file was restored.',
sprintf($plugin->get_lang('MaintenanceFileNotPresent'), $maintenanceHtml),
'warning'
)
);
$originalContent = str_replace("\x0D", '', $originalContent);
file_put_contents($file, $originalContent);
}
} else {
$result = file_put_contents($maintenanceHtml, $content);
if ($result === false) {
// Looks htaccess contains errors. Restore as it was.
Display::addFlash(
Display::return_message(
sprintf($plugin->get_lang('MaintenanceFileNotPresent'), $maintenanceHtml),
'Check your htaccess instructions. The original file was restored.',
'warning'
)
);
}
$originalContent = str_replace("\x0D", '', $originalContent);
file_put_contents($file, $originalContent);
}
if ($active == false) {

Loading…
Cancel
Save