diff --git a/lam/lib/checkEnvironment.inc b/lam/lib/checkEnvironment.inc index e6b3fb80..35b1bba7 100644 --- a/lam/lib/checkEnvironment.inc +++ b/lam/lib/checkEnvironment.inc @@ -103,7 +103,7 @@ $memLimit = ini_get('memory_limit'); if (isset($memLimit) && ($memLimit != '') && (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')) { 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\".", - "Your current memory limit is $memLimit."); + "Your current memory limit is $memLimit."); } } // check PCRE regex system @@ -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 diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 43e73b60..88fc2fee 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -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. *