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

@ -116,7 +116,7 @@ if (!extension_loaded('zip')) {
}
// check for main config
$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.");
}
// stop login if critical errors occured

View File

@ -2312,6 +2312,16 @@ class LAMCfgMain {
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.
*