From 498d5bfaf07e1089f8ea38fe6d91d752e94fbc09 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 10 Apr 2021 21:13:34 -0400 Subject: [PATCH] Slugify cache prefix and quote it in the env --- app/Services/Installer/ConfigService.php | 3 ++- resources/stubs/installer/env.stub | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Services/Installer/ConfigService.php b/app/Services/Installer/ConfigService.php index 8a06748c..1e433a4c 100644 --- a/app/Services/Installer/ConfigService.php +++ b/app/Services/Installer/ConfigService.php @@ -212,7 +212,8 @@ class ConfigService extends Service protected function configCacheDriver($opts) { // Set the cache prefix - $opts['CACHE_PREFIX'] = uniqid($opts['SITE_NAME'].'_'); + $prefix = substr(str_slug($opts['SITE_NAME'], '_'), 0, 8); + $opts['CACHE_PREFIX'] = strtolower(uniqid($prefix.'_')); // Figure out what cache driver to initially use, depending on // what is installed. It won't detect redis or anything, though diff --git a/resources/stubs/installer/env.stub b/resources/stubs/installer/env.stub index de0b89db..4e30534f 100644 --- a/resources/stubs/installer/env.stub +++ b/resources/stubs/installer/env.stub @@ -34,7 +34,7 @@ DB_SOCKET= # CACHE SETTINGS CACHE_DRIVER=$CACHE_DRIVER$ -CACHE_PREFIX=$CACHE_PREFIX$ +CACHE_PREFIX='$CACHE_PREFIX$' # EMAIL SETTINGS # Look at the available mail configs in config/mail.php