mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #62514
[Bug 1931879] Re: Null block records in watchlist_queue causing cannot delete group
** Description changed:
Version of Mahara: 20.04
Step to reproduce:
- User create group and then add a public page.
- Other user add this page to watchlist
- User create some new blocks
- User delete a block
User/administration cannot delete group and show error:
Mahara: Site unavailable
A nonrecoverable error occurred. This probably means you have encountered a bug in the system
Please consider the following code lines when delete blockinstance, Are
- the lines of code inside the if statement really necessary?
+ the lines of code inside the if statement really necessary? Is there any
+ business here that i don't really understand them?
function watchlist_block_deleted(BlockInstance $block) {
global $USER;
// don't catch root's changes, especially not when installing...
if ($USER->get('id') <= 0) {
return;
}
delete_records('watchlist_queue', 'block', $block->get('id'));
if (record_exists('usr_watchlist_view', 'view', $block->get('view'))) {
$whereobj = new stdClass();
$whereobj->view = $block->get('view');
$whereobj->block = null;
$whereobj->usr = $USER->get('id');
$dataobj = clone $whereobj;
$dataobj->changed_on = date('Y-m-d H:i:s');
ensure_record_exists('watchlist_queue', $whereobj, $dataobj);
}
}
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1931879
Title:
Null block records in watchlist_queue causing cannot delete group
Status in Mahara:
New
Bug description:
Version of Mahara: 20.04
Step to reproduce:
- User create group and then add a public page.
- Other user add this page to watchlist
- User create some new blocks
- User delete a block
User/administration cannot delete group and show error:
Mahara: Site unavailable
A nonrecoverable error occurred. This probably means you have encountered a bug in the system
Please consider the following code lines when delete blockinstance,
Are the lines of code inside the if statement really necessary? Is
there any business here that i don't really understand them?
function watchlist_block_deleted(BlockInstance $block) {
global $USER;
// don't catch root's changes, especially not when installing...
if ($USER->get('id') <= 0) {
return;
}
delete_records('watchlist_queue', 'block', $block->get('id'));
if (record_exists('usr_watchlist_view', 'view', $block->get('view'))) {
$whereobj = new stdClass();
$whereobj->view = $block->get('view');
$whereobj->block = null;
$whereobj->usr = $USER->get('id');
$dataobj = clone $whereobj;
$dataobj->changed_on = date('Y-m-d H:i:s');
ensure_record_exists('watchlist_queue', $whereobj, $dataobj);
}
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1931879/+subscriptions
References