Skip to content

Commit

Permalink
Fixed issue #8997
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Apr 27, 2014
1 parent a860610 commit 77e736c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions application/commands/InstallCommand.php
Expand Up @@ -103,7 +103,6 @@ function _executeSQLFile($sFileName)
$this->connection->createCommand($sCommand)->execute();
} catch(Exception $e) {
$aMessages[] = "Executing: ".$sCommand." failed! Reason: ".$e;
var_dump($e); die();
}

$sCommand = '';
Expand All @@ -117,14 +116,16 @@ function _executeSQLFile($sFileName)

}

function getDBConnectionStringProperty($sProperty)
function getDBConnectionStringProperty($sProperty, $connectionString = null)
{
if (!isset($connectionString))
{
$connectionString = $this->connection->connectionString;
}
// Yii doesn't give us a good way to get the database name
preg_match('/'.$sProperty.'=([^;]*)/', $this->connection->connectionString, $aMatches);
if ( count($aMatches) === 0 ) {
return null;
if ( preg_match('/'.$sProperty.'=([^;]*)/', $connectionString, $aMatches) == 1 ) {
return $aMatches[1];
}
return $aMatches[1];
}


Expand All @@ -137,10 +138,10 @@ protected function createDatabase()
$this->connection->active=true;
}
catch(Exception $e){
echo "Invalid access data. Check your config.php db access data"; die();
throw new CException("Invalid access data. Check your config.php db access data");
}

$sDatabaseName= $this->getDBConnectionStringProperty('dbname');
$sDatabaseName= $this->getDBConnectionStringProperty('dbname', $connectionString);
try {
switch ($this->connection->driverName)
{
Expand Down

0 comments on commit 77e736c

Please sign in to comment.