Skip to content

Commit

Permalink
Release 2.00+ Build 121024
Browse files Browse the repository at this point in the history
Dev Install script fix for command line install and XAMPP package
  • Loading branch information
c-schmitz committed Oct 24, 2012
1 parent 640ecee commit 9d16ebb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
19 changes: 18 additions & 1 deletion application/commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class InstallCommand extends CConsoleCommand

public function run($sArgument)
{
if (!isset($sArgument) || !isset($sArgument[0]) || !isset($sArgument[1]) || !isset($sArgument[2]) || !isset($sArgument[3])) die('You have to set admin/password/full name and email address on the command line like this: php starter.php adminname mypassword fullname emailaddress');
Yii::import('application.helpers.common_helper', true);
$aConfig=Yii::app()->getComponents(false);
$bDatabaseExists=true;
Expand Down Expand Up @@ -122,7 +123,23 @@ public function run($sArgument)
default:
throw new Exception(sprintf('Unkown database type "%s".', $sDatabaseType));
}
return $this->_executeSQLFile(dirname(Yii::app()->basePath).'/installer/sql/create-'.$sql_file.'.sql', $aConfig['db']['tablePrefix']);
$this->_executeSQLFile(dirname(Yii::app()->basePath).'/installer/sql/create-'.$sql_file.'.sql', $aConfig['db']['tablePrefix']);
$this->connection->createCommand()->insert($aConfig['db']['tablePrefix'].'users', array(
'users_name'=>$sArgument[0],
'password'=>hash('sha256',$sArgument[1]),
'full_name'=>$sArgument[2],
'parent_id'=>0,
'lang'=>'auto',
'email'=>$sArgument[3],
'create_survey'=>1,
'participant_panel'=>1,
'create_user'=>1,
'delete_user'=>1,
'superadmin'=>1,
'configurator'=>1,
'manage_template'=>1,
'manage_label'=>1
));

}

Expand Down
12 changes: 10 additions & 2 deletions application/config/config-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,15 @@
//The following url and dir locations do not need to be modified unless you have a non-standard
//LimeSurvey installation. Do not change unless you know what you are doing.

$config['publicurl'] = Yii::app()->baseUrl . '/'; // The public website location (url) of the public survey script
if(!isset($argv[0]))
{
$config['publicurl'] = Yii::app()->baseUrl . '/'; // The public website location (url) of the public survey script
}
else
{
$config['publicurl'] = '/';
}

$config['homeurl'] = $config['publicurl'].'admin'; // The website location (url) of the admin scripts
$config['tempurl'] = $config['publicurl'].'tmp';
$config['imageurl'] = $config['publicurl'].'images'; // Location of button bar files for admin script
Expand Down Expand Up @@ -537,7 +545,7 @@
// $relativeurl is the url relative to you DocumentRoot where is installed LimeSurvey.
// Usually same as $rooturl without http://{$_SERVER['HTTP_HOST']}.
// $relativeurl is now automatically computed from $rooturl
if(!isset($cmd_install) || !$cmd_install==true)
if(!isset($argv[0]))
{
$parsedurl = parse_url(Yii::app()->createUrl('/'));
$config['relativeurl'] = isset($parsedurl['path']) ? $parsedurl['path'] : "";
Expand Down

0 comments on commit 9d16ebb

Please sign in to comment.