Skip to content

Commit

Permalink
MDL-11279:
Browse files Browse the repository at this point in the history
Code was not properly checking for empty category.
Check moved to right place and proper print_error() function called as appropriate

Merged from STABLE_18
  • Loading branch information
thepurpleblob committed Sep 17, 2007
1 parent 5bb8a81 commit 2c6d2c8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions question/format.php
Expand Up @@ -642,16 +642,25 @@ function exportprocess() {
}
}

// continue path for following error checks
$course = $this->course;
$continuepath = "$CFG->wwwroot/question/export.php?courseid=$course->id";

// did we actually process anything
if ($count==0) {
print_error( 'noquestions','quiz',$continuepath );
}

// final pre-process on exported data
$expout = $this->presave_process( $expout );

// write file
$filepath = $path."/".$this->filename . $this->export_file_extension();
if (!$fh=fopen($filepath,"w")) {
error( get_string('cannotopen','quiz',$filepath) );
print_error( 'cannotopen','quiz',$continuepath,$filepath );
}
if (!fwrite($fh, $expout, strlen($expout) )) {
error( get_string('cannotwrite','quiz',$filepath) );
print_error( 'cannotwrite','quiz',$continuepath,$filepath );
}
fclose($fh);
return true;
Expand Down

0 comments on commit 2c6d2c8

Please sign in to comment.