Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle_mod-hvp
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_mod-hvp
Commits
81ac9857
Commit
81ac9857
authored
6 years ago
by
Paal Joergensen
Browse files
Options
Downloads
Patches
Plain Diff
JI-848 Fix bug in content upgrade for metadata
parent
2bd39ce0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
locallib.php
+12
-22
12 additions, 22 deletions
locallib.php
with
12 additions
and
22 deletions
locallib.php
+
12
−
22
View file @
81ac9857
...
...
@@ -315,13 +315,17 @@ function hvp_content_upgrade_progress($libraryid) {
// Update params.
$params
=
json_decode
(
$params
);
foreach
(
$params
as
$id
=>
$param
)
{
$DB
->
update_record
(
'hvp'
,
(
object
)
array
(
$upgraded
=
json_decode
(
$param
);
$fields
=
array_merge
(
\H5PMetadata
::
toDBArray
(
$upgraded
->
metadata
,
false
),
array
(
'id'
=>
$id
,
'main_library_id'
=>
$tolibrary
->
id
,
'json_content'
=>
$
param
,
'json_content'
=>
json_encode
(
$upgraded
->
param
s
)
,
'filtered'
=>
''
));
$DB
->
update_record
(
'hvp'
,
$fields
);
// Log content upgrade successful.
new
\mod_hvp\event
(
'content'
,
'upgrade'
,
...
...
@@ -331,21 +335,6 @@ function hvp_content_upgrade_progress($libraryid) {
}
}
// Get updated extras.
$extras
=
filter_input
(
INPUT_POST
,
'extras'
);
if
(
$extras
!==
null
)
{
// Update extras.
$extras
=
json_decode
(
$extras
);
if
(
isset
(
$extras
->
metadata
))
{
$fields
=
\H5PMetadata
::
toDBArray
(
$extras
->
metadata
,
false
);
$fields
[
'id'
]
=
$id
;
$fields
[
'name'
]
=
$fields
[
'title'
];
unset
(
$fields
[
'title'
]);
$DB
->
update_record
(
'hvp'
,
(
object
)
$fields
);
}
}
// Get number of contents for this library.
$out
->
left
=
$interface
->
getNumContent
(
$libraryid
);
...
...
@@ -360,8 +349,9 @@ function hvp_content_upgrade_progress($libraryid) {
);
foreach
(
$results
as
$content
)
{
$out
->
params
[
$content
->
id
]
=
$content
->
params
;
$out
->
metadata
[
$content
->
id
]
=
\H5PMetadata
::
toJSON
(
$content
);
$out
->
params
[
$content
->
id
]
=
'{"params":'
.
$content
->
params
.
',"metadata":'
.
\H5PMetadata
::
toJSON
(
$content
)
.
'}'
;
}
}
...
...
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