Last active
February 20, 2022 21:50
-
-
Save mstraczkowski/d1a372527244a35aca9d32da74ff92e4 to your computer and use it in GitHub Desktop.
Simple script to regenerate prestashop 1.7 keys for encryption etc... (increase security in case of duplicating prestashop instances).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Be sure you are at root directory | |
// Loading prestashop configuration | |
require __DIR__ . '/config/config.inc.php'; | |
// Loading parameters array | |
$parameters = require __DIR__ . '/app/config/parameters.php'; | |
// Setting new keys | |
$parameters['parameters']['new_cookie_key'] = PhpEncryption::createNewRandomKey(); | |
$parameters['parameters']['cookie_key'] = Tools::passwdGen(64); | |
$parameters['parameters']['cookie_iv'] = Tools::passwdGen(32); | |
$parameters['parameters']['secret'] = Tools::passwdGen(64); | |
// Saving modified parameters | |
file_put_contents( | |
__DIR__ . '/app/config/parameters.php', | |
'<?php return ' . var_export($parameters, true) . ';' | |
); | |
// Clearing cache | |
exec("rm -rf " . __DIR__ . '/var/cache/prod'); | |
exec("rm -rf " . __DIR__ . '/var/cache/dev'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment