mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #62512
[Bug 1931879] [NEW] Null block records in watchlist_queue causing cannot delete group
Public bug reported:
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?
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);
}
}
** Affects: mahara
Importance: Undecided
Status: New
** Summary changed:
- Currently when a person adds a page to their watchlist and page owner remove a exsiting block in page or create a block then remove it causing adminstration or group owner cannot delete this group.
+ Null block records causing cannot delete group
** Summary changed:
- Null block records causing cannot delete group
+ Null block records in watchlist_queue causing cannot delete group
** Description changed:
- Currently when a person adds a page to their watchlist and page owner remove a exsiting block in page or create a block then remove it causing adminstration or group owner cannot delete this group.
- Please consider the following code lines when delete blockinstance, Are the lines of code inside the if statement really necessary?
-
- function watchlist_block_deleted(BlockInstance $block) {
- global $USER;
- // don't catch root's changes, especially not when installing...
- if ($USER->get('id') <= 0) {
- return;
- }
+ 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.
- delete_records('watchlist_queue', 'block', $block->get('id'));
+ Please consider the following code lines when delete blockinstance, Are
+ the lines of code inside the if statement really necessary?
- 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);
- }
+ 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);
+ }
}
** Description changed:
-
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.
+ User/administration cannot delete group and show error:
+
+ ahara: 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?
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);
}
}
** 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:
ahara: 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?
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);
}
}
** 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:
- ahara: Site unavailable
+ 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?
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?
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
Follow ups