notify for allowoverride

This commit is contained in:
marcos 2020-04-07 18:40:47 +02:00
parent a73c9ecb22
commit f8f2da4d40
1 changed files with 50 additions and 0 deletions

View File

@ -215,6 +215,12 @@ class ConsoleSupervisor
*/
$this->checkConsoleServerVersions();
/*
* Check if AllowOverride is None or All.
* NOTIF.ALLOWOVERIDE.MESSAGE
*/
$this->checkAllowOverrideEnabled();
}
@ -440,6 +446,11 @@ class ConsoleSupervisor
*/
$this->checkConsoleServerVersions();
/*
* Check if AllowOverride is None or All.
*/
$this->checkAllowOverrideEnabled();
}
@ -606,6 +617,7 @@ class ConsoleSupervisor
case 'NOTIF.UPDATEMANAGER.MINOR':
case 'NOTIF.UPDATEMANAGER.MESSAGES':
case 'NOTIF.CRON.CONFIGURED':
case 'NOTIF.ALLOWOVERRIDE.MESSAGE':
default:
// NOTIF.SERVER.STATUS.
// NOTIF.SERVER.STATUS.ID_SERVER.
@ -2360,4 +2372,42 @@ class ConsoleSupervisor
}
/**
* Check if AllowOveride is None or All.
*
* @return void
*/
public function checkAllowOverrideEnabled()
{
global $config;
$message = 'If AllowOverride is disabled, .htaccess will not works.';
$message .= '<pre>Please check /etc/httpd/conf/httpd.conf for keep this problems';
$file = file_get_contents('/etc/httpd/conf/httpd.conf');
$file_lines = preg_split("#\r?\n#", $file, -1, PREG_SPLIT_NO_EMPTY);
$is_none = false;
foreach ($file_lines as $line) {
if (preg_match('/ AllowOverride/', $line)) {
$result = explode(' ', $line);
if ($result[9] == 'None') {
$is_none = true;
$this->notify(
[
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
'title' => __('AllowOverride is disabled'),
'message' => __($message),
'url' => '',
]
);
}
}
}
if (!$is_none) {
$this->cleanNotifications('NOTIF.ALLOWOVERRIDE.MESSAGE');
}
}
}