Merge branch 'master' into logformat-awstats

This commit is contained in:
Patrik Kernstock 2020-01-02 12:44:35 +01:00 committed by GitHub
commit 09aed61dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 201 additions and 3 deletions

View File

@ -850,6 +850,7 @@ CREATE TABLE `panel_fpmdaemons` (
`max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '30',
`limit_extensions` varchar(255) NOT NULL default '.php',
`custom_config` text,
PRIMARY KEY (`id`),
UNIQUE KEY `reload` (`reload_cmd`),
UNIQUE KEY `config` (`config_dir`)

View File

@ -531,6 +531,13 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201912100')) {
\Froxlor\Froxlor::updateToDbVersion('201912310');
}
if (\Froxlor\Froxlor::isDatabaseVersion('201912310')) {
showUpdateStep("Adding custom phpfpm pool configuration field");
Database::query("ALTER TABLE `" . TABLE_PANEL_FPMDAEMONS . "` ADD `custom_config` text AFTER `limit_extensions`;");
lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('201912311');
}
if (\Froxlor\Froxlor::isDatabaseVersion('201912312')) {
showUpdateStep("Adding option change awstats LogFormat");
Settings::AddNew("system.awstats_logformat", '1');

View File

@ -150,6 +150,8 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
* optional, default 0
* @param string $limit_extensions
* optional, limit execution to the following extensions, default '.php'
* @param string $custom_config
* optional, custom settings appended to phpfpm pool configuration
*
* @access admin
* @throws \Exception
@ -173,6 +175,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$max_requests = $this->getParam('max_requests', true, 0);
$idle_timeout = $this->getParam('idle_timeout', true, 0);
$limit_extensions = $this->getParam('limit_extensions', true, '.php');
$custom_config = $this->getParam('custom_config', true, '');
// validation
$description = \Froxlor\Validate\Validate::validate($description, 'description', '', '', array(), true);
@ -206,7 +209,8 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
`max_spare_servers` = :max_spare_servers,
`max_requests` = :max_requests,
`idle_timeout` = :idle_timeout,
`limit_extensions` = :limit_extensions
`limit_extensions` = :limit_extensions,
`custom_config` = :custom_config
");
$ins_data = array(
'desc' => $description,
@ -219,7 +223,8 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
'max_spare_servers' => $max_spare_servers,
'max_requests' => $max_requests,
'idle_timeout' => $idle_timeout,
'limit_extensions' => $limit_extensions
'limit_extensions' => $limit_extensions,
'custom_config' => $custom_config
);
Database::pexecute($ins_stmt, $ins_data);
$id = Database::lastInsertId();
@ -261,6 +266,8 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
* optional, default 0
* @param string $limit_extensions
* optional, limit execution to the following extensions, default '.php'
* @param string $custom_config
* optional, custom settings appended to phpfpm pool configuration
*
* @access admin
* @throws \Exception
@ -289,6 +296,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$max_requests = $this->getParam('max_requests', true, $result['max_requests']);
$idle_timeout = $this->getParam('idle_timeout', true, $result['idle_timeout']);
$limit_extensions = $this->getParam('limit_extensions', true, $result['limit_extensions']);
$custom_config = $this->getParam('custom_config', true, $result['custom_config']);
// validation
$description = \Froxlor\Validate\Validate::validate($description, 'description', '', '', array(), true);
@ -322,7 +330,8 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
`max_spare_servers` = :max_spare_servers,
`max_requests` = :max_requests,
`idle_timeout` = :idle_timeout,
`limit_extensions` = :limit_extensions
`limit_extensions` = :limit_extensions,
`custom_config` = :custom_config
WHERE `id` = :id
");
$upd_data = array(
@ -337,6 +346,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
'max_requests' => $max_requests,
'idle_timeout' => $idle_timeout,
'limit_extensions' => $limit_extensions,
'custom_config' => $custom_config,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data, true, true);

View File

@ -115,6 +115,7 @@ class Fpm
$fpm_requests = (int) $this->fpm_cfg['max_requests'];
$fpm_process_idle_timeout = (int) $this->fpm_cfg['idle_timeout'];
$fpm_limit_extensions = $this->fpm_cfg['limit_extensions'];
$fpm_custom_config = $this->fpm_cfg['custom_config'];
if ($fpm_children == 0) {
$fpm_children = 1;
@ -260,6 +261,12 @@ class Fpm
$fpm_config .= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f ' . $this->domain['email'] . "\n";
}
// append custom phpfpm configuration
if (! empty($fpm_custom_config)) {
$fpm_config .= "\n; Custom Configuration\n";
$fpm_config .= \Froxlor\PhpHelper::replaceVariables($fpm_custom_config, $php_ini_variables);
}
fwrite($fh, $fpm_config, strlen($fpm_config));
fclose($fh);
}

View File

@ -86,6 +86,13 @@ return array(
'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'],
'type' => 'text',
'value' => '.php'
),
'custom_config' => array(
'label' => $lng['serversettings']['phpfpm_settings']['custom_config']['title'],
'desc' => $lng['serversettings']['phpfpm_settings']['custom_config']['description'],
'type' => 'textarea',
'cols' => 50,
'rows' => 7
)
)
)

View File

@ -87,6 +87,14 @@ return array(
'desc' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['description'],
'type' => 'text',
'value' => $result['limit_extensions']
),
'custom_config' => array(
'label' => $lng['serversettings']['phpfpm_settings']['custom_config']['title'],
'desc' => $lng['serversettings']['phpfpm_settings']['custom_config']['description'],
'type' => 'textarea',
'cols' => 50,
'rows' => 7,
'value' => $result['custom_config']
)
)
)

View File

@ -2085,8 +2085,13 @@ $lng['serversettings']['apply_phpconfigs_default']['title'] = 'Default value for
$lng['admin']['domain_sslenabled'] = 'Enable usage of SSL';
$lng['admin']['domain_honorcipherorder'] = 'Honor the (server) cipher order, default <strong>no</strong>';
$lng['admin']['domain_sessiontickets'] = 'Enable TLS sessiontickets (RFC 5077), default <strong>yes</strong>';
$lng['admin']['domain_sessionticketsenabled']['title'] = 'Enable usage of TLS sessiontickets globally';
$lng['admin']['domain_sessionticketsenabled']['description'] = 'Default <strong>yes</strong><br>Requires apache-2.4.11+ or nginx-1.5.9+';
$lng['serversettings']['phpfpm_settings']['restart_note'] = 'Attention: The config won\'t be checked for any errors. If it contains errors, PHP-FPM might not start again!';
$lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Custom configuration';
$lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Add custom configuration to each PHP-FPM version instance, for example <i>pm.status_path = /status</i> for monitoring. Variables below can be used here. ' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>';
$lng['serversettings']['awstats']['logformat']['title'] = 'LogFormat setting';
$lng['serversettings']['awstats']['logformat']['description'] = 'If you use customized logformat for your webserver, you need change the awstats LogFormat too.<br/>Default is 1. For more information check documentation <a target="_blank" href="https://awstats.sourceforge.io/docs/awstats_config.html#LogFormat">here</a>.';

View File

@ -1732,8 +1732,13 @@ $lng['serversettings']['apply_phpconfigs_default']['title'] = 'Standardwert für
$lng['admin']['domain_sslenabled'] = 'Aktiviere Nutzung von SSL';
$lng['admin']['domain_honorcipherorder'] = 'Bevorzuge die serverseitige Cipher Reihenfolge, Standardwert <strong>nein</strong>';
$lng['admin']['domain_sessiontickets'] = 'Aktiviere TLS Sessiontickets (RFC 5077), Standardwert <strong>ja</strong>';
$lng['admin']['domain_sessionticketsenabled']['title'] = 'Aktiviere Nutzung von TLS Sessiontickets systemweit';
$lng['admin']['domain_sessionticketsenabled']['description'] = 'Standardwert <strong>yes</strong><br>Erfordert apache-2.4.11+ oder nginx-1.5.9+';
$lng['serversettings']['phpfpm_settings']['restart_note'] = 'Achtung: Der Code wird nicht auf Fehler geprüft. Bei etwaigen Fehlern könnte der PHP-FPM-Prozess nicht mehr starten!';
$lng['serversettings']['phpfpm_settings']['custom_config']['title'] = 'Benutzerdefinierte Konfiguration';
$lng['serversettings']['phpfpm_settings']['custom_config']['description'] = 'Füge eine benutzerdefinierte Einstellungen zur PHP-FPM Instanz hinzu, beispielsweise <i>pm.status_path = /status</i> für Monitoring. Unten ersichtliche Variablen können verwendet werden.' . ' <strong>' . $lng['serversettings']['phpfpm_settings']['restart_note'] . '</strong>';
$lng['serversettings']['awstats']['logformat']['title'] = 'LogFormat Einstellung';
$lng['serversettings']['awstats']['logformat']['description'] = 'Wenn ein benutzerdefiniertes LogFormat beim Webserver verwendet wird, muss LogFormat von awstats ebenso angepasst werden.<br/>Standard ist 1. Für weitere Informationen siehe Dokumentation unter <a target="_blank" href="https://awstats.sourceforge.io/docs/awstats_config.html#LogFormat">hier</a>.';

View File

@ -21,4 +21,78 @@ $header
</form>
</section>
</article>
<br />
<article>
<header>
<h3>
{$lng['admin']['templates']['template_replace_vars']}
</h3>
</header>
<section>
<table class="full">
<thead>
<tr>
<th>{$lng['panel']['variable']}</th>
<th>{$lng['panel']['description']}</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>{PEAR_DIR}</em></td>
<td>{$lng['admin']['phpconfig']['pear_dir']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR_C}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir_c']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR_GLOBAL}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir_global']}</td>
</tr>
<tr>
<td><em>{TMP_DIR}</em></td>
<td>{$lng['admin']['phpconfig']['tmp_dir']}</td>
</tr>
<tr>
<td><em>{CUSTOMER_EMAIL}</em></td>
<td>{$lng['admin']['phpconfig']['customer_email']}</td>
</tr>
<tr>
<td><em>{ADMIN_EMAIL}</em></td>
<td>{$lng['admin']['phpconfig']['admin_email']}</td>
</tr>
<tr>
<td><em>{DOMAIN}</em></td>
<td>{$lng['admin']['phpconfig']['domain']}</td>
</tr>
<tr>
<td><em>{CUSTOMER}</em></td>
<td>{$lng['admin']['phpconfig']['customer']}</td>
</tr>
<tr>
<td><em>{ADMIN}</em></td>
<td>{$lng['admin']['phpconfig']['admin']}</td>
</tr>
<tr>
<td><em>{DOCUMENT_ROOT}</em></td>
<td>{$lng['admin']['phpconfig']['docroot']}</td>
</tr>
<tr>
<td><em>{CUSTOMER_HOMEDIR}</em></td>
<td>{$lng['admin']['phpconfig']['homedir']}</td>
</tr>
</tbody>
</table>
</section>
</article>
$footer

View File

@ -22,4 +22,78 @@ $header
</form>
</section>
</article>
<br />
<article>
<header>
<h3>
{$lng['admin']['templates']['template_replace_vars']}
</h3>
</header>
<section>
<table class="full">
<thead>
<tr>
<th>{$lng['panel']['variable']}</th>
<th>{$lng['panel']['description']}</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>{PEAR_DIR}</em></td>
<td>{$lng['admin']['phpconfig']['pear_dir']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR_C}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir_c']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir']}</td>
</tr>
<tr>
<td><em>{OPEN_BASEDIR_GLOBAL}</em></td>
<td>{$lng['admin']['phpconfig']['open_basedir_global']}</td>
</tr>
<tr>
<td><em>{TMP_DIR}</em></td>
<td>{$lng['admin']['phpconfig']['tmp_dir']}</td>
</tr>
<tr>
<td><em>{CUSTOMER_EMAIL}</em></td>
<td>{$lng['admin']['phpconfig']['customer_email']}</td>
</tr>
<tr>
<td><em>{ADMIN_EMAIL}</em></td>
<td>{$lng['admin']['phpconfig']['admin_email']}</td>
</tr>
<tr>
<td><em>{DOMAIN}</em></td>
<td>{$lng['admin']['phpconfig']['domain']}</td>
</tr>
<tr>
<td><em>{CUSTOMER}</em></td>
<td>{$lng['admin']['phpconfig']['customer']}</td>
</tr>
<tr>
<td><em>{ADMIN}</em></td>
<td>{$lng['admin']['phpconfig']['admin']}</td>
</tr>
<tr>
<td><em>{DOCUMENT_ROOT}</em></td>
<td>{$lng['admin']['phpconfig']['docroot']}</td>
</tr>
<tr>
<td><em>{CUSTOMER_HOMEDIR}</em></td>
<td>{$lng['admin']['phpconfig']['homedir']}</td>
</tr>
</tbody>
</table>
</section>
</article>
$footer