@@ -50,7 +50,7 @@ class Installer {
5050 * Minimum required PHP version to install ProcessWire
5151 *
5252 */
53- const MIN_REQUIRED_PHP_VERSION = '7.4.0 ' ;
53+ const MIN_REQUIRED_PHP_VERSION = '5.3.8 ' ;
5454
5555 /**
5656 * Test mode for installer development, non destructive
@@ -62,7 +62,7 @@ class Installer {
6262 * Default site profile
6363 *
6464 */
65- const PROFILE_DEFAULT = 'site-default ' ;
65+ const PROFILE_DEFAULT = 'site-blank ' ;
6666
6767 /**
6868 * File permissions, determined in the dbConfig function
@@ -79,15 +79,6 @@ class Installer {
7979 */
8080 protected $ numErrors = 0 ;
8181
82- /**
83- * Available color themes
84- *
85- */
86- protected $ colors = array (
87- 'classic ' ,
88- 'warm '
89- );
90-
9182 /**
9283 * @param LoggerInterface $log
9384 */
@@ -354,7 +345,17 @@ public function checkDatabaseConnection($values, $out = true) {
354345 * @param array $values
355346 */
356347 protected function dbSaveConfigFile (array $ values ) {
357- $ salt = md5 (mt_rand () . microtime (true ));
348+ $ file = __FILE__ ;
349+ $ time = time ();
350+ $ host = empty ($ values ['httpHosts ' ]) ? '' : implode (', ' , $ values ['httpHosts ' ]);
351+
352+ if (function_exists ('random_bytes ' )) {
353+ $ authSalt = sha1 (random_bytes (random_int (40 , 128 )));
354+ $ tableSalt = sha1 (random_int (0 , 65535 ) . "$ host$ file$ time " );
355+ } else {
356+ $ authSalt = md5 (mt_rand () . microtime (true ));
357+ $ tableSalt = md5 (mt_rand () . "$ host$ file$ time " );
358+ }
358359
359360 $ cfg = "\n/** " .
360361 "\n * Installer: Database Configuration " .
@@ -366,14 +367,27 @@ protected function dbSaveConfigFile(array $values) {
366367 "\n\$config->dbPass = ' $ values [dbPass]'; " .
367368 "\n\$config->dbPort = ' $ values [dbPort]'; " .
368369 "\n" .
369- "\n/** " .
370- "\n * Installer: User Authentication Salt " .
371- "\n * " .
372- "\n * Must be retained if you migrate your site from one server to another " .
373- "\n * " .
374- "\n */ " .
375- "\n\$config->userAuthSalt = ' $ salt'; " .
376- "\n" .
370+ "\n/** " .
371+ "\n * Installer: User Authentication Salt " .
372+ "\n * " .
373+ "\n * This value was randomly generated for your system on " . date ('Y/m/d ' ) . ". " .
374+ "\n * This should be kept as private as a password and never stored in the database. " .
375+ "\n * Must be retained if you migrate your site from one server to another. " .
376+ "\n * Do not change this value, or user passwords will no longer work. " .
377+ "\n * " .
378+ "\n */ " .
379+ "\n\$config->userAuthSalt = ' $ authSalt'; " .
380+ "\n" .
381+ "\n/** " .
382+ "\n * Installer: Table Salt (General Purpose) " .
383+ "\n * " .
384+ "\n * Use this rather than userAuthSalt when a hashing salt is needed for non user " .
385+ "\n * authentication purposes. Like with userAuthSalt, you should never change " .
386+ "\n * this value or it may break internal system comparisons that use it. " .
387+ "\n * " .
388+ "\n */ " .
389+ "\n\$config->tableSalt = ' $ tableSalt'; " .
390+ "\n" .
377391 "\n/** " .
378392 "\n * Installer: File Permission Configuration " .
379393 "\n * " .
@@ -392,6 +406,15 @@ protected function dbSaveConfigFile(array $values) {
392406 "\n * " .
393407 "\n */ " .
394408 "\n\$config->defaultAdminTheme = 'AdminThemeUikit'; " .
409+ "\n" .
410+ "\n/** " .
411+ "\n * Installer: Unix timestamp of date/time installed " .
412+ "\n * " .
413+ "\n * This is used to detect which when certain behaviors must be backwards compatible. " .
414+ "\n * Please leave this value as-is. " .
415+ "\n * " .
416+ "\n */ " .
417+ "\n\$config->installed = " . time () . "; " .
395418 "\n\n" ;
396419
397420 if (!empty ($ values ['httpHosts ' ])) {
@@ -611,14 +634,9 @@ protected function adminAccountSave($accountInfo) {
611634 $ adminName = htmlentities ($ adminName , ENT_QUOTES , "UTF-8 " );
612635
613636 if ($ this ->v ) $ this ->log ->info ("User account saved: <b> {$ user ->name }</b> " );
614-
615- $ colors = $ wire ->sanitizer ->pageName ($ accountInfo ['colors ' ]);
616- if (!in_array ($ colors , $ this ->colors )) $ colors = reset ($ this ->colors );
617637 $ theme = $ wire ->modules ->getInstall ('AdminThemeUikit ' );
618638 $ configData = $ wire ->modules ->getModuleConfigData ('AdminThemeUikit ' );
619- $ configData ['colors ' ] = $ colors ;
620639 $ wire ->modules ->saveModuleConfigData ('AdminThemeUikit ' , $ configData );
621- if ($ this ->v ) $ this ->log ->info ("Saved admin color set <b> $ colors</b> - you will see this when you login. " );
622640
623641 if ($ this ->v ) $ this ->log ->info ("It is recommended that you make <b>/site/config.php</b> non-writable, for security. " );
624642
0 commit comments