Commit 72fee8b5 authored by Marius Burkard's avatar Marius Burkard
Browse files

- added option to only use system php

- added passive port range option for pure ftp
parent 2dd52148
......@@ -162,6 +162,14 @@ class ISPConfig {
}
}
public static function wantsPHP() {
if(isset($_GET['use-php']) && $_GET['use-php']) {
return $_GET['use-php'];
} else {
return false;
}
}
public static function getISPConfigChannel() {
if(isset($_GET['channel']) && $_GET['channel']) {
return $_GET['channel'];
......@@ -170,6 +178,17 @@ class ISPConfig {
}
}
public static function getFTPPassivePorts() {
if(isset($_GET['use-ftp-ports'])) {
list($from, $to) = explode('-', $_GET['use-ftp-ports']);
return array(
'from' => intval($from),
'to' => intval($to)
);
}
return false;
}
private static function printHelp() {
$message = '
......@@ -193,6 +212,11 @@ Possible arguments are:
--interactive ->Don\'t install ISPConfig in non-interactive mode. This is needed if you want to use expert mode, e. g. to install a slave server that shall be integrated into an existing multiserver setup.
--use-nginx ->Use nginx webserver instead of apache2
--use-amavis ->Use amavis instead of rspamd for mail filtering
--use-php ->Use specific PHP version instead of installing multiple PHP, e.g. --use-php=7.3 (5.6, 7.0, 7.1, 7.2 and 7.3 available).
->--use-php=system disables the sury repository and just installs the system\'s default PHP version.
->CURRENTLY ONLY EITHER --use-php=system OR OMITTING THE ARGUMENT (use all versions) IS SUPPORTED!
--use-ftp-ports ->This option sets the passive port range for pure-ftpd. You have to specify the port range separated by hyphen, e. g. --use-ftp-ports=40110-40210.
->If not provided the passive port range will not be configured.
--no-web ->Do not use ISPConfig on this server to manage webserver setting and don\'t install nginx/apache or pureftpd. This will also prevent installing an ISPConfig UI and implies --no-roundcube as well as --no-pma
--no-mail ->Do not use ISPConfig on this server to manage mailserver settings. This will install postfix for sending system mails, but not dovecot and not configure any settings for ISPConfig mail. It implies --no-mailman.
--no-dns ->Do not use ISPConfig on this server to manage DNS entries. Bind will be installed for local DNS caching / resolving only.
......@@ -214,15 +238,17 @@ Possible arguments are:
public static function run() {
self::init();
$pmatch = null;
$valid_args = array(
'help', 'debug', 'interactive',
'use-nginx', 'use-amavis', 'channel', 'lang',
'use-nginx', 'use-amavis', 'use-php', 'use-ftp-ports', 'channel', 'lang',
'no-web', 'no-mail', 'no-dns', 'no-firewall', 'no-roundcube', 'no-pma', 'no-mailman',
'i-know-what-i-am-doing'
);
reset($_GET);
foreach($_GET as $key => $value) {
foreach(array_keys($_GET) as $key) {
if(!in_array($key, $valid_args, true)) {
self::printHelp();
exit;
......@@ -238,6 +264,12 @@ Possible arguments are:
} elseif(isset($_GET['lang']) && !in_array($_GET['lang'], array('de', 'en'), true)) {
self::printHelp();
exit;
} elseif(isset($_GET['use-php']) && $_GET['use-php'] !== 'system') {//!in_array($_GET['use-php'], array('5.6', '7.0', '7.1', '7.2', '7.3', 'system'), true)) {
self::printHelp();
exit;
} elseif(isset($_GET['use-ftp-ports']) && (!preg_match('/^([1-9][0-9]+)-([1-9][0-9]+)$/', $_GET['use-ftp-ports'], $pmatch) || intval($pmatch[1]) >= intval($pmatch[2]))) {
self::printHelp();
exit;
}
if(!isset($_GET['i-know-what-i-am-doing']) || !$_GET['i-know-what-i-am-doing']) {
......
......@@ -94,21 +94,26 @@ class ISPConfigLog {
if(mb_strlen($line_prefix) >= $colw) {
$line_prefix = ' ';
}
$ln = 0;
while(mb_strlen($line) > $colw) {
$tmp = explode("{###}", wordwrap($line, $colw, "{###}", true), 2);
$ln++;
$wrap_prefix = preg_replace('/^(\s+)\S.*?$/', '$1', $line);
$wrapped = $wrap_prefix . wordwrap(substr($line, strlen($wrap_prefix)), $colw - strlen($wrap_prefix), "{###}", true);
$tmp = explode("{###}", $wrapped, 2);
$tmp = array_shift($tmp);
print $tmp . "\n";
$line = $line_prefix . trim(mb_substr($line, mb_strlen($tmp)));
unset($tmp);
if(trim($line) === '') {
break;
} elseif($ln > 1000) {
break;
}
}
print $line ."\n";
}
}
/**
* @param string $message
* @param int $priority
......
......@@ -348,6 +348,10 @@ class ISPConfigBaseOS {
}
}
protected function getSystemPHPVersion() {
return '7.3';
}
protected function afterPackageInstall($section = '') {
}
......
......@@ -172,5 +172,9 @@ Alias /phpmyadmin /usr/share/phpmyadmin
'/^(?:\s*\/\/)?\s*(\$cfg\[\'Servers\'\]\[\$i\]\[\'controlpass\'\])\s*=.*$/m' => '$1 = \'' . $pma_pass_enc . '\';',
);
$this->replaceContents('/usr/share/phpmyadmin/config.inc.php', $replacements, false);
}
}
protected function getSystemPHPVersion() {
return '7.3';
}
}
......@@ -415,7 +415,9 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
}
}
$this->addSuryRepo();
if(ISPConfig::wantsPHP() !== 'system') {
$this->addSuryRepo();
}
$this->updatePackageList();
......@@ -744,13 +746,17 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
'php-apcu'
);
$php_versions = array(
'5.6',
'7.0',
'7.1',
'7.2',
'7.3'
);
if(ISPConfig::wantsPHP() === 'system') {
$php_versions = array($this->getSystemPHPVersion());
} else {
$php_versions = array(
'5.6',
'7.0',
'7.1',
'7.2',
'7.3'
);
}
$php_modules = array(
'common',
......@@ -909,6 +915,12 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
}
chmod('/etc/ssl/private/pure-ftpd.pem', 0600);
// set passive port range if needed
$ftp_ports = ISPConfig::getFTPPassivePorts();
if($ftp_ports) {
file_put_contents('/etc/pure-ftpd/conf/PassivePortRange', $ftp_ports['from'] . ' ' . $ftp_ports['to']);
}
$this->restartService('pure-ftpd-mysql');
ISPConfigLog::info('Disabling awstats cron.', true);
......@@ -1161,4 +1173,8 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"';
return true;
}
protected function getSystemPHPVersion() {
return '7.0';
}
}
......@@ -90,4 +90,8 @@ maxretry = 3';
}
}
protected function getSystemPHPVersion() {
return '7.2';
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment