Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-qtype_stack
Commits
856ac571
Commit
856ac571
authored
3 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
WIP/proposal to make sure the bulk tester does not stop because of exceptions.
parent
5a1372bd
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
locallib.php
+22
-0
22 additions, 0 deletions
locallib.php
stack/bulktester.class.php
+2
-0
2 additions, 0 deletions
stack/bulktester.class.php
stack/cas/castext2/processor.class.php
+4
-1
4 additions, 1 deletion
stack/cas/castext2/processor.class.php
with
28 additions
and
1 deletion
locallib.php
+
22
−
0
View file @
856ac571
...
@@ -238,3 +238,25 @@ function qtype_stack_setup_question_test_page($question) {
...
@@ -238,3 +238,25 @@ function qtype_stack_setup_question_test_page($question) {
return
array
(
$context
,
$seed
,
$urlparams
);
return
array
(
$context
,
$seed
,
$urlparams
);
}
}
/* This class is needed to ignore requests for pluginfile rewrites in the bulk tester
* and possibly elsewhere, e.g. API.
*/
class
stack_outofcontext_process
{
public
function
__construct
()
{
}
/**
* Calls {@link question_rewrite_question_urls()} with appropriate parameters
* for content belonging to this question.
* @param string $text the content to output.
* @param string $component the component name (normally 'question' or 'qtype_...')
* @param string $filearea the name of the file area.
* @param int $itemid the item id.
* @return string the content with the URLs rewritten.
*/
public
function
rewrite_pluginfile_urls
(
$text
,
$component
,
$filearea
,
$itemid
)
{
return
$text
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
stack/bulktester.class.php
+
2
−
0
View file @
856ac571
...
@@ -161,6 +161,8 @@ class stack_bulk_tester {
...
@@ -161,6 +161,8 @@ class stack_bulk_tester {
$qdotoutput
=
0
;
$qdotoutput
=
0
;
}
}
// At this point we have no question context and so we can't possibly correctly evaluate URLs.
$question
->
castextprocessor
=
new
castext2_qa_processor
(
new
stack_outofcontext_process
());
$upgradeerrors
=
$question
->
validate_against_stackversion
();
$upgradeerrors
=
$question
->
validate_against_stackversion
();
if
(
$upgradeerrors
!=
''
)
{
if
(
$upgradeerrors
!=
''
)
{
if
(
$outputmode
==
'web'
)
{
if
(
$outputmode
==
'web'
)
{
...
...
This diff is collapsed.
Click to expand it.
stack/cas/castext2/processor.class.php
+
4
−
1
View file @
856ac571
<?php
<?php
// This file is part of Stateful
// This file is part of Stateful
.
//
//
// Stateful is free software: you can redistribute it and/or modify
// Stateful is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// it under the terms of the GNU General Public License as published by
...
@@ -71,6 +71,9 @@ class castext2_qa_processor extends castext2_default_processor {
...
@@ -71,6 +71,9 @@ class castext2_qa_processor extends castext2_default_processor {
// can call things like `rewrite_pluginfile_urls`.
// can call things like `rewrite_pluginfile_urls`.
public
$qa
;
public
$qa
;
public
function
__construct
(
$qa
)
{
public
function
__construct
(
$qa
)
{
if
(
!
method_exists
(
$qa
,
'rewrite_pluginfile_urls'
))
{
stack_exception
(
'Error in constructing castext2_qa_processor: argument must provide rewrite_pluginfile_urls.'
);
}
$this
->
qa
=
$qa
;
$this
->
qa
=
$qa
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment