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
076886d5
Commit
076886d5
authored
2 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Update dependences checker to work with moodle 4 DB changes.
More work required on hidden questions.
parent
1657a97e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
adminui/dependencies.php
+23
-9
23 additions, 9 deletions
adminui/dependencies.php
with
23 additions
and
9 deletions
adminui/dependencies.php
+
23
−
9
View file @
076886d5
...
...
@@ -34,6 +34,7 @@ require_once(__DIR__ . '/../../../engine/lib.php');
require_once
(
__DIR__
.
'/../stack/utils.class.php'
);
require_once
(
__DIR__
.
'/../stack/options.class.php'
);
require_once
(
__DIR__
.
'/../stack/maximaparser/utils.php'
);
require_once
(
__DIR__
.
'/../vle_specific.php'
);
require_login
();
$context
=
context_system
::
instance
();
...
...
@@ -48,8 +49,15 @@ $title = 'Dependency checker';
$PAGE
->
set_title
(
$title
);
// Figure out the number of questions that can be explored.
$notcompiled
=
$DB
->
get_recordset_sql
(
'SELECT count(*) as notcompiled FROM {question} q, '
.
'{qtype_stack_options} o WHERE q.id = o.questionid AND q.hidden = 0 AND o.compiledcache = ?;'
,
[
'{}'
]);
$query
=
'SELECT count(*) as notcompiled FROM {question} q, '
.
'{qtype_stack_options} o WHERE q.id = o.questionid AND o.compiledcache = ?;'
;
// TODO: figure out about hidden questions in Moodle 4+.
// This needs to be added to all versions below in which I've omitted this clause.
if
(
stack_determine_moodle_version
()
<
400
)
{
$query
=
'SELECT count(*) as notcompiled FROM {question} q, '
.
'{qtype_stack_options} o WHERE q.id = o.questionid AND q.hidden = 0 AND o.compiledcache = ?;'
;
}
$notcompiled
=
$DB
->
get_recordset_sql
(
$query
,
[
'{}'
]);
$nnotcompiled
=
0
;
$ncompiled
=
0
;
...
...
@@ -58,8 +66,14 @@ foreach ($notcompiled as $item) {
}
$notcompiled
->
close
();
$compiled
=
$DB
->
get_recordset_sql
(
'SELECT count(*) as compiled FROM {question} q, {qtype_stack_options} '
.
'o WHERE q.id = o.questionid AND q.hidden = 0 AND NOT o.compiledcache = ?;'
,
[
'{}'
]);
$query
=
'SELECT count(*) as compiled FROM {question} q, '
.
'{qtype_stack_options} o WHERE q.id = o.questionid AND NOT o.compiledcache = ?;'
;
if
(
stack_determine_moodle_version
()
<
400
)
{
$query
=
'SELECT count(*) as compiled FROM {question} q, {qtype_stack_options} '
.
'o WHERE q.id = o.questionid AND q.hidden = 0 AND NOT o.compiledcache = ?;'
;
}
$compiled
=
$DB
->
get_recordset_sql
(
$query
,
[
'{}'
]);
foreach
(
$compiled
as
$item
)
{
$ncompiled
=
$item
->
compiled
;
...
...
@@ -99,7 +113,7 @@ if (data_submitted() && optional_param('includes', false, PARAM_BOOL)) {
* Both are noted in the compiled cache as important meta.
*/
$qs
=
$DB
->
get_recordset_sql
(
'SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE '
.
'q.id = o.questionid AND
q.hidden = 0 AND
'
.
'q.id = o.questionid AND '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
)
.
';'
,
[
'trg'
=>
'%"includes"%'
]);
echo
'<h4>Questions using includes</h4>'
;
echo
'<table><thead><tr><th>Question</th><th>Keyval includes</th><th>Castext includes</th></tr></thead><tbody>'
;
...
...
@@ -145,7 +159,7 @@ if (data_submitted() && optional_param('jsxgraphs', false, PARAM_BOOL)) {
* form then we probably have something else in play or a "TODO" note.
*/
$qs
=
$DB
->
get_recordset_sql
(
'SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE '
.
'q.id = o.questionid AND
q.hidden = 0 AND
'
.
'q.id = o.questionid AND '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
,
false
)
.
';'
,
[
'trg'
=>
'%jsxgraph%'
]);
echo
'<h4>Questions containing JSXGraph related terms</h4>'
;
echo
'<table><thead><tr><th>Question</th>'
.
...
...
@@ -186,7 +200,7 @@ if (data_submitted() && optional_param('script', false, PARAM_BOOL)) {
* <script present in the question
*/
$qs
=
$DB
->
get_recordset_sql
(
'SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE '
.
'q.id = o.questionid AND
q.hidden = 0 AND
'
.
'q.id = o.questionid AND '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
,
false
)
.
';'
,
[
'trg'
=>
'%<script%'
]);
echo
'<h4>Questions containing script tags</h4>'
;
echo
'<table><thead><tr><th>Question</th></thead><tbody>'
;
...
...
@@ -206,7 +220,7 @@ if (data_submitted() && optional_param('PLUGINFILE', false, PARAM_BOOL)) {
* @@PLUGINFILE@@ present in the question.
*/
$qs
=
$DB
->
get_recordset_sql
(
'SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE '
.
'q.id = o.questionid AND
q.hidden = 0 AND
'
.
'q.id = o.questionid AND '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
)
.
';'
,
[
'trg'
=>
'%@@PLUGINFILE@@%'
]);
echo
'<h4>Questions containing attached files handled by Moodle</h4>'
;
echo
'<table><thead><tr><th>Question</th></thead><tbody>'
;
...
...
@@ -226,7 +240,7 @@ if (data_submitted() && optional_param('langs', false, PARAM_BOOL)) {
* Questions that have localisation.
*/
$qs
=
$DB
->
get_recordset_sql
(
'SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE '
.
'q.id = o.questionid AND
q.hidden = 0 AND
'
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
)
.
' AND NOT '
.
'q.id = o.questionid AND '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':trg'
)
.
' AND NOT '
.
$DB
->
sql_like
(
'o.compiledcache'
,
':other'
)
.
';'
,
[
'trg'
=>
'%"langs":[%'
,
'other'
=>
'%"langs":[]%'
]);
echo
'<h4>Questions containing that have localisation using means we understand.</h4>'
;
echo
'<table><thead><tr><th>Question</th><th>Langs</th></thead><tbody>'
;
...
...
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