Skip to content

Commit

Permalink
CRM-20148 WP-CLI: DB_DSN_MODE should be auto; also fix path slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
agh1 committed Feb 21, 2017
1 parent 5612d6f commit 72202de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions wp-cli/civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ private function install() {
$dsn = "mysql://{$dbuser}:{$dbpass}@{$dbhost}/{$dbname}?new_link=true";
$dsn_nodb = "mysql://{$dbuser}:{$dbpass}@{$dbhost}";

if ( ! defined( 'DB_DSN_MODE' ) ) {
define( 'DB_DSN_MODE', 'auto' );
}

require_once "$crmPath/packages/DB.php";

$db = DB::connect( $dsn );
Expand Down Expand Up @@ -449,11 +453,9 @@ private function install() {
if ( substr( $base_url, -1 ) != '/' ) {
$base_url .= '/';
}
$upload_dir = wp_upload_dir();
$settings_dir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR;
$params = array(
'crmRoot' => $crmPath . '/',
'templateCompileDir' => "$settings_dir/files/civicrm/templates_c",
'templateCompileDir' => "{$settings_dir}files/civicrm/templates_c",
'frontEnd' => 0,
'cms' => 'WordPress',
'baseURL' => $base_url,
Expand All @@ -475,7 +477,7 @@ private function install() {

$str = trim( $str );

$config_file = "$settings_dir/civicrm.settings.php";
$config_file = "{$settings_dir}civicrm.settings.php";
civicrm_write_file( $config_file, $str );
WP_CLI::launch( "chmod 0644 $config_file" );
WP_CLI::success( sprintf( 'Settings file generated: %s', $config_file ) );
Expand Down

0 comments on commit 72202de

Please sign in to comment.