Skip to content

Commit

Permalink
quiz-data - Catch empty argument
Browse files Browse the repository at this point in the history
  • Loading branch information
EJMFarrow committed Dec 10, 2024
1 parent ede7681 commit e61b047
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/create_repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function __construct(cli_helper $clihelper, array $moodleinstances) {
} else {
$this->directory = $arguments['rootdirectory'];
}
if ($arguments['nonquizmanifestpath']) {
if (!empty($arguments['nonquizmanifestpath'])) {
$this->nonquizmanifestpath = ($arguments['rootdirectory']) ?
$arguments['rootdirectory'] . '/' . $arguments['nonquizmanifestpath'] : $arguments['nonquizmanifestpath'];
} else {
Expand Down
2 changes: 1 addition & 1 deletion classes/export_quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __construct(cli_helper $clihelper, array $moodleinstances) {
$this->call_exit();
}
$instanceid = $this->quizmanifestcontents->context->instanceid;
if ($arguments['nonquizmanifestpath']) {
if (!empty($arguments['nonquizmanifestpath'])) {
$this->nonquizmanifestpath = ($arguments['nonquizmanifestpath']) ?
$rootdirectory . $arguments['nonquizmanifestpath'] : null;
$this->nonquizmanifestcontents = json_decode(file_get_contents($this->nonquizmanifestpath));
Expand Down
2 changes: 1 addition & 1 deletion classes/export_repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function __construct(cli_helper $clihelper, array $moodleinstances) {
} else {
$this->manifestpath = null;
}
if ($arguments['nonquizmanifestpath']) {
if (!empty($arguments['nonquizmanifestpath'])) {
$this->nonquizmanifestpath = ($arguments['rootdirectory']) ?
$arguments['rootdirectory'] . '/' . $arguments['nonquizmanifestpath'] : $arguments['nonquizmanifestpath'];
} else {
Expand Down
2 changes: 1 addition & 1 deletion classes/import_quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function import_all($clihelper, $scriptdirectory): void {
} else {
$directory = $arguments['rootdirectory'];
}
if ($arguments['nonquizmanifestpath']) {
if (!empty($arguments['nonquizmanifestpath'])) {
$this->nonquizmanifestpath = ($arguments['rootdirectory']) ?
$arguments['rootdirectory'] . '/' . $arguments['nonquizmanifestpath'] : $arguments['nonquizmanifestpath'];
} else {
Expand Down

0 comments on commit e61b047

Please sign in to comment.