Skip to content

Commit

Permalink
Fixed issue: session write check is unreliable
Browse files Browse the repository at this point in the history
dev: now write something to session and check if present in the next request
  • Loading branch information
mennodekker committed Dec 21, 2012
1 parent 22ad48a commit 4369f6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 10 additions & 1 deletion application/controllers/InstallerController.php
Expand Up @@ -173,6 +173,7 @@ private function stepLicense()
{
$this->redirect($this->createUrl('installer/precheck'));
}
Yii::app()->session['saveCheck'] = 'save'; // Checked in next step

$this->render('/installer/license_view',$aData);
}
Expand Down Expand Up @@ -832,8 +833,16 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecurs
if (!check_DirectoryWriteable(Yii::app()->getConfig('uploaddir').'/', $data, 'uploaddir', 'uerror',true) )
$bProceed = false;

if (!check_DirectoryWriteable(Yii::app()->session->getSavePath().'/', $data, 'sessiondir', 'serror',true) )
// Session writable check
$session = Yii::app()->session; /* @var $session CHttpSession */
$sessionWritable = ($session->get('saveCheck', null)==='save');
$data['sessionWritable'] = $sessionWritable;
$data['sessionWritableImg'] = check_HTML_image($sessionWritable);
if (!$sessionWritable){
// For recheck, try to set the value again
$session['saveCheck'] = 'save';
$bProceed = false;
}

// ** optional settings check **

Expand Down
8 changes: 4 additions & 4 deletions application/views/installer/precheck_view.php
Expand Up @@ -92,10 +92,10 @@ function dirReport($dir, $write, $clang)
<td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?></td>
<td align="center" style="width: 225px;"><?php echo dirReport($tmpdirPresent,$tmpdirWritable,$clang); ?></td>

<tr>
<td style="width: 209px;">session.save_path <?php echo session_save_path(); ?></td>
<td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?></td>
<td align="center" style="width: 225px;"><?php echo dirReport($sessiondirPresent,$sessiondirWritable,$clang); ?></td>
<tr>
<td style="width: 209px;"><?php $clang->eT("Session writable"); ?></td>
<td align="center" style="width: 225px;"><img src="<?php echo Yii::app()->baseUrl; ?>/installer/images/tick-right.png" alt="Check" /></td>
<td align="center" style="width: 225px;"><?php echo $sessionWritableImg; if (!$sessionWritable) echo '<br/>session.save_path: ' . session_save_path(); ?></td>
</tr>
</tr>

Expand Down

0 comments on commit 4369f6f

Please sign in to comment.