install sample config

This commit is contained in:
Roland Gruber 2016-11-01 08:55:34 +01:00
parent aa5020d46b
commit bc68b0eb5a
2 changed files with 12 additions and 2 deletions

View File

@ -103,7 +103,7 @@ $memLimit = ini_get('memory_limit');
if (isset($memLimit) && ($memLimit != '') && (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')) { if (isset($memLimit) && ($memLimit != '') && (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')) {
if (intval(substr($memLimit, 0, strlen($memLimit) - 1)) < 128) { if (intval(substr($memLimit, 0, strlen($memLimit) - 1)) < 128) {
$criticalErrors[] = array("ERROR", "Please increase the \"memory_limit\" parameter in your php.ini to at least \"128M\".", $criticalErrors[] = array("ERROR", "Please increase the \"memory_limit\" parameter in your php.ini to at least \"128M\".",
"Your current memory limit is $memLimit."); "Your current memory limit is $memLimit.");
} }
} }
// check PCRE regex system // check PCRE regex system
@ -116,7 +116,7 @@ if (!extension_loaded('zip')) {
} }
// check for main config // check for main config
$mainConfig = new LAMCfgMain(); $mainConfig = new LAMCfgMain();
if (!$mainConfig->isConfigFileExisting()) { if (!$mainConfig->isConfigFileExisting() && !$mainConfig->installSampleConfig()) {
$criticalErrors[] = array("ERROR", "The main config file (config.cfg) does not exist.", "Please see the manual for installation instructions."); $criticalErrors[] = array("ERROR", "The main config file (config.cfg) does not exist.", "Please see the manual for installation instructions.");
} }
// stop login if critical errors occured // stop login if critical errors occured

View File

@ -2312,6 +2312,16 @@ class LAMCfgMain {
return file_exists($this->conffile); return file_exists($this->conffile);
} }
/**
* Tries to copy the config file from sample config.
*
* @return boolean copied
*/
public function installSampleConfig() {
$samplePath = dirname(dirname(__FILE__)) . '/config/config.cfg.sample';
return file_exists($samplePath) && copy($samplePath, $this->conffile);
}
/** /**
* Returns the path to the SSL CA certificate file that overrides the system certificates. * Returns the path to the SSL CA certificate file that overrides the system certificates.
* *