Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
9fb22ac0
Commit
9fb22ac0
authored
Nov 30, 2020
by
Lisa Seeto
Committed by
Gerrit Code Review
Nov 30, 2020
Browse files
Merge "Bug 1904352: Clean up bad navigation blocks in database"
parents
89875fa9
238eb572
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/upgrade.php
View file @
9fb22ac0
...
@@ -1990,5 +1990,42 @@ function xmldb_core_upgrade($oldversion=0) {
...
@@ -1990,5 +1990,42 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
}
}
if
(
$oldversion
<
2020111600
)
{
log_debug
(
'Adjust navigation block on collection pages in old format'
);
// Find all the pages that have a navigation block on them and the navigation block is saved with information in
// the block_instance_dimension table that also have other blocks on the page that don't have information in the
// block_inatance_dimension table - indicating that the navigation block was saved wrong and needs fixing up
if
(
$records
=
get_records_sql_array
(
"SELECT abi.view, (
SELECT COUNT(*) FROM
{
block_instance
}
bbi WHERE bbi.view = abi.view
) AS block_count,
COUNT(abid.block) AS block_dimension_count
FROM
{
block_instance_dimension
}
abid
JOIN
{
block_instance
}
abi ON abi.id = abid.block
WHERE abi.view IN (
SELECT bi.view FROM
{
block_instance
}
bi
JOIN
{
block_instance_dimension
}
bid ON bid.block = bi.id
WHERE bi.blocktype = 'navigation'
)
GROUP BY abi.view HAVING COUNT(abid.block) = 1
AND (
SELECT COUNT(*) FROM
{
block_instance
}
bbi WHERE bbi.view = abi.view
) > 1"
))
{
foreach
(
$records
as
$record
)
{
// Now find the block id that needs fixing
$blockid
=
get_field_sql
(
"SELECT b.block FROM
{
block_instance_dimension
}
b
WHERE b.block IN (
SELECT id FROM
{
block_instance
}
WHERE view = ?
)"
,
array
(
$record
->
view
));
// Update it with old layout info
$order
=
get_field_sql
(
"SELECT MAX(bi.order) + 1 FROM
{
block_instance
}
bi WHERE bi.view = ?"
,
array
(
$record
->
view
));
execute_sql
(
"UPDATE
{
block_instance
}
SET
\"
row
\"
= ?,
\"
column
\"
= ?,
\"
order
\"
= ?
WHERE id = ?"
,
array
(
1
,
1
,
$order
,
$blockid
));
// Remove the new dimension info
execute_sql
(
"DELETE FROM
{
block_instance_dimension
}
WHERE block = ?"
,
array
(
$blockid
));
}
}
}
return
$status
;
return
$status
;
}
}
htdocs/lib/version.php
View file @
9fb22ac0
...
@@ -16,7 +16,7 @@ $config = new stdClass();
...
@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config
->
version
=
20201
012
00
;
$config
->
version
=
20201
116
00
;
$config
->
series
=
'21.04'
;
$config
->
series
=
'21.04'
;
$config
->
release
=
'21.04dev'
;
$config
->
release
=
'21.04dev'
;
$config
->
minupgradefrom
=
2017031605
;
$config
->
minupgradefrom
=
2017031605
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment