Skip to content

Commit

Permalink
+Added a firstrun variable to the installation process so that you ha…
Browse files Browse the repository at this point in the history
…ve to use the standard installation procedure before using the system
  • Loading branch information
jtanderson committed Apr 19, 2012
1 parent 47ecf00 commit 9fcc776
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions application/config/database.php
Expand Up @@ -39,6 +39,9 @@
$db['default']['password'] = "kayakodev";
$db['default']['database'] = "db_kayako";

// A flag to denote wheter the user has run the install script
$config['firstrun'] = FALSE;

// The following values can probably stay the same.
$db['default']['hostname'] = "localhost";
$db['default']['dbdriver'] = "mysql";
Expand Down
5 changes: 4 additions & 1 deletion application/core/MY_Controller.php
Expand Up @@ -14,7 +14,10 @@ class MY_Controller extends CI_Controller{

function __construct(){
parent::__construct();
// $this->output->enable_profiler(TRUE);
$this->load->config('database');
if ( $this->config->item('firstrun') == FALSE ){
redirect('/install');
}

if ( ! $this->input->is_ajax_request() ){
// $this->output->cache(15);
Expand Down
3 changes: 3 additions & 0 deletions install/config/database.php
Expand Up @@ -39,6 +39,9 @@
$db['default']['password'] = "%PASSWORD%";
$db['default']['database'] = "%DATABASE%";

// A flag to denote wheter the user has run the install script
$config['firstrun'] = FALSE;

// The following values can probably stay the same.
$db['default']['hostname'] = "%HOSTNAME%";
$db['default']['dbdriver'] = "mysql";
Expand Down
1 change: 1 addition & 0 deletions install/includes/core_class.php
Expand Up @@ -73,6 +73,7 @@ function write_config($data) {
$new = str_replace("%USERNAME%",$data['username'],$new);
$new = str_replace("%PASSWORD%",$data['password'],$new);
$new = str_replace("%DATABASE%",$data['database'],$new);
$new = str_replace('$config[\'firstrun\'] = FALSE;', '$config[\'firstrun\'] = TRUE;', $new);

// Write the new database.php file
$handle = fopen($output_path,'w+');
Expand Down
6 changes: 3 additions & 3 deletions install/index.php
Expand Up @@ -109,9 +109,9 @@ function previousPanel(){
<fieldset id="install_panel_2" style="display:none;">
<legend>Kayako Fusion</legend>
<p>Enter the details for the system to access the Kayako Fusion server. The URL is the base url of your Kayako server with no trailing slash.</p>
<label for="kayakoapi">Kayako API Key</label><input type="text" id="kayakoapi" placeholder="e.g. 24c1a733-837f-57e4-f9e9-13de5c3cc671" class="input_text" name="kayakoapi" />
<label for="swifturl">Kayako URL (no trailing slash)</label><input type="text" placeholder="e.g. http://servicedesk.mydomain.com" id="swifturl" class="input_text" name="swifturl" />
<label for="kayakosecretkey">Kayako Secret Key</label><input type="text" id="kayakosecretkey" class="input_text" name="kayakosecretkey" /><br/>
<label for="kayakoapi">Kayako API Key</label><input type="text" id="kayakoapi" placeholder="e.g. 24c1a733-837f-57e4-f9e9-13de5c3cc671" class="input_text span7" name="kayakoapi" />
<label for="swifturl">Kayako URL (no trailing slash)</label><input type="text" placeholder="e.g. http://servicedesk.mydomain.com" id="swifturl" class="input_text span7" name="swifturl" />
<label for="kayakosecretkey">Kayako Secret Key</label><input type="text" id="kayakosecretkey" class="input_text span7" name="kayakosecretkey" /><br/>
<input type="button" class="btn" value="&#x2190; Back" onclick="previousPanel();" id="next_1" />
<input type="button" class="btn" value="Next &#x2192;" onclick="nextPanel();" id="next_1" />
</fieldset>
Expand Down

0 comments on commit 9fcc776

Please sign in to comment.