Skip to content

Commit

Permalink
Dev: Fix the installation process.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11751 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
GautamGupta committed Dec 24, 2011
1 parent 9c32088 commit 70300fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
27 changes: 7 additions & 20 deletions application/controllers/InstallerController.php
Expand Up @@ -11,17 +11,16 @@
* See COPYRIGHT.php for copyright notices and details.
*
* @author Shubham Sachdeva
* @author Gautam Gupta
*/

/**
* Installer
*
* FIXME output code belongs into view
* @todo Output code belongs into view
* @todo Make it write the config.php file
*
* @package LimeSurvey
* @author Shubham Sachdeva
* @author Gautam Gupta
* @copyright 2011
* @version $Id$
* @access public
Expand Down Expand Up @@ -590,15 +589,6 @@ private function stepOptionalConfiguration()

Yii::app()->session['deletedirectories'] = true;

//DELETE SAMPLE INSTALLER FILE. If we can't, notify user of the same.
$installer_file = Yii::app()->getConfig('rootdir').'/tmp/sample_installer_file.txt';
if (is_writable($installer_file))
{
rename($installer_file, $installer_file.'.removed');
} else {
$aData['error'] = true;
}

$aData['title'] = $clang->gT("Success!");
$aData['descp'] = $clang->gT("LimeSurvey has been installed successfully.");
$aData['classesForStep'] = array('off','off','off','off','off','off');
Expand Down Expand Up @@ -762,12 +752,8 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError)

// ** file and directory permissions checking **

// config file
if (!check_FileWriteable(Yii::app()->getConfig('rootdir').'/application/config/config.php', $data, 'config', 'derror') )
$bProceed = false;

// tmp directory check
if (!check_DirectoryWriteable(Yii::app()->getConfig('rootdir').'/tmp/', $data, 'tmpdir', 'terror') )
// config directory
if (!check_DirectoryWriteable(Yii::app()->getConfig('rootdir').'/application/config', $data, 'config', 'derror') )
$bProceed = false;

// templates directory check
Expand Down Expand Up @@ -962,13 +948,14 @@ function _writeConfigFile()
. "/* End of file config.php */" . "\n"
. "/* Location: ./application/config/config.php */";

if (is_writable(APPPATH . 'config/config.php')) {
if (is_writable(APPPATH . 'config')) {
write_file(APPPATH . 'config/config.php', $dbdata);
Yii::app()->session['configFileWritten'] = true;
} else {
header('refresh:5;url='.$this->createUrl("installer/welcome"));
echo "<b>".$clang->gT("Configuration file directory is not writable")."</b><br/>";
echo "<b>".$clang->gT("Configuration directory is not writable")."</b><br/>";
printf($clang->gT('You will be redirected in about 5 secs. If not, click <a href="%s">here</a>.' ,'unescaped'), $this->createUrl('installer/welcome'));
exit;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSYii_Controller.php
Expand Up @@ -49,7 +49,7 @@ public function __construct($id, $module = null)
protected function _checkInstallation()
{
$file_name = Yii::app()->getConfig('rootdir').'/application/config/config.php';
if (!file_exists($file_name))
if (!file_exists($file_name) && empty(Yii::app()->session['configFileWritten']))
{
$this->redirect($this->createUrl('/installer'));
}
Expand Down

0 comments on commit 70300fb

Please sign in to comment.