Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function initGeneralSettings(): void {
$this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_MENTION));
$this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1'));
$this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1'));
$this->initialState->provideInitialState('valid_apache_php_configuration', (int) $this->validApachePHPConfiguration());
$this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration());
}

protected function initAllowedGroups(): void {
Expand Down Expand Up @@ -502,24 +502,32 @@ protected function getGroupDetailsArray(array $gids, string $configKey): array {
return $groups;
}

protected function validApachePHPConfiguration(): bool {
protected function validApachePHPConfiguration(): string {
if (!function_exists('exec')) {
return 'unknown';
}

$output = [];
@exec('apachectl -M | grep mpm', $output, $returnCode);
try {
@exec('apachectl -M | grep mpm', $output, $returnCode);
} catch (\Throwable $e) {
return 'unknown';
}

if ($returnCode > 0) {
return true;
return 'unknown';
}

$apacheModule = implode("\n", $output);
$usingFPM = ini_get('fpm.config') !== false;

if ($usingFPM) {
// Needs to use mpm_event
return strpos($apacheModule, 'mpm_event') !== false;
return strpos($apacheModule, 'mpm_event') !== false ? '' : 'invalid';
}

// Needs to use mpm_prefork
return strpos($apacheModule, 'mpm_prefork') !== false;
return strpos($apacheModule, 'mpm_prefork') !== false ? '' : 'invalid';
}

/**
Expand Down
12 changes: 9 additions & 3 deletions src/components/AdminSettings/WebServerSetupChecks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {
data() {
return {
backgroundBlurLoaded: undefined,
validApachePHPConfiguration: true,
validApachePHPConfiguration: '',
}
},

Expand Down Expand Up @@ -115,12 +115,18 @@ export default {
},

apacheWarning() {
return t('spreed', 'It seems that the PHP and Apache configuration is not compatible. Please note that PHP can only be used with the MPM_PREFORK module and PHP-FPM can only be used with the MPM_EVENT module.')
if (this.validApachePHPConfiguration === 'invalid') {
return t('spreed', 'It seems that the PHP and Apache configuration is not compatible. Please note that PHP can only be used with the MPM_PREFORK module and PHP-FPM can only be used with the MPM_EVENT module.')
}
if (this.validApachePHPConfiguration === 'unknown') {
return t('spreed', 'Could not detect the PHP and Apache configuration because exec is disabled or apachectl is not working as expected. Please note that PHP can only be used with the MPM_PREFORK module and PHP-FPM can only be used with the MPM_EVENT module.')
}
return ''
},
},

mounted() {
this.validApachePHPConfiguration = parseInt(loadState('spreed', 'valid_apache_php_configuration')) === 1
this.validApachePHPConfiguration = loadState('spreed', 'valid_apache_php_configuration')
},

beforeMount() {
Expand Down