Skip to content

Commit

Permalink
create directory
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Jan 7, 2018
1 parent 2a79908 commit b2f1c09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions application/models/SurveyActivator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class SurveyActivator
private $createSurveyDir = false;



/** @var boolean */
public $isSimulation;

Expand All @@ -43,7 +42,6 @@ public function activate(){
return ['error'=>$this->error];
}


$this->prepareResponsesTable();

if ($this->isSimulation) {
Expand All @@ -70,6 +68,10 @@ public function activate(){
'status' => 'OK',
'pluginFeedback' => $this->event->get('pluginFeedback')
);
if(!$this->createSurveyDirectory()){
$aResult['warning'] = 'nouploadsurveydir';
}

return $aResult;
}

Expand Down Expand Up @@ -337,12 +339,13 @@ private function createSurveyDirectory(){
if ($this->createSurveyDir) {
if (!file_exists(Yii::app()->getConfig('uploaddir')."/surveys/".$iSurveyID."/files")) {
if (!(mkdir(Yii::app()->getConfig('uploaddir')."/surveys/".$iSurveyID."/files", 0777, true))) {
$aResult['warning'] = 'nouploadsurveydir';
return false;
} else {
file_put_contents(Yii::app()->getConfig('uploaddir')."/surveys/".$iSurveyID."/files/index.html", '<html><head></head><body></body></html>');
}
}
}
return true;

}

Expand Down

0 comments on commit b2f1c09

Please sign in to comment.