Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drush civicrm-install now accepts optional site_key #97

Open
wants to merge 5 commits into
base: 1.x-master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions drush/civicrm.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function civicrm_drush_command() {
'site_url' => 'Base Url for your backdrop/CiviCRM website without http (e.g. mysite.com)',
'ssl' => 'Using ssl for your backdrop/CiviCRM website if set to on (e.g. --ssl=on)',
'load_generated_data' => 'Loads the demo generated data. Defaults to FALSE.',
'site_key' => 'Define a site key, suggest md5 hash. Otional, install will generate if not present',
),
'aliases' => array('cvi'),
);
Expand Down Expand Up @@ -511,7 +512,9 @@ function _civicrm_generate_settings_file($dbuser, $dbpass, $dbhost, $dbname, $mo
$v = civicrmVersion();
$cms = $v['cms'];
}

if (!$sitekey = drush_get_option('site_key', FALSE)) {
$sitekey = md5(rand() . mt_rand() . rand() . uniqid('', TRUE) . $baseUrl);
}
$params = array(
'crmRoot' => $crmPath,
'templateCompileDir' => "$backdropRoot/$siteRoot/files/civicrm/templates_c",
Expand All @@ -526,7 +529,7 @@ function _civicrm_generate_settings_file($dbuser, $dbpass, $dbhost, $dbname, $mo
'CMSdbPass' => $db_spec['password'],
'CMSdbHost' => $db_spec['host'],
'CMSdbName' => $db_spec['database'],
'siteKey' => md5(uniqid('', TRUE) . $baseUrl),
'siteKey' => $sitekey,
);
$str = file_get_contents($settingsTplFile);
foreach ($params as $key => $value) {
Expand Down