Permalink
Browse files

Merge branch 'MDL-26436_close_recordsets3' of git://github.com/andyjd…

…avis/moodle into MOODLE_20_STABLE
  • Loading branch information...
2 parents c7d4a92 + 9f2e9b5 commit 890c7fae4ef305275afc63e2df7cc4e48f1be6f9 @stronk7 stronk7 committed May 16, 2011
Showing with 9 additions and 9 deletions.
  1. +9 −9 message/lib.php
View
@@ -200,6 +200,8 @@ function message_get_blocked_users($user1=null, $user2=null) {
$user2->isblocked = false;
}
+ $blockedusers = array();
+
$userfields = user_picture::fields('u', array('lastaccess'));
$blockeduserssql = "SELECT $userfields, COUNT(m.id) AS messagecount
FROM {message_contacts} mc
@@ -210,18 +212,14 @@ function message_get_blocked_users($user1=null, $user2=null) {
ORDER BY u.firstname ASC";
$rs = $DB->get_recordset_sql($blockeduserssql, array('user1id1' => $user1->id, 'user1id2' => $user1->id));
- $blockedusers = array();
- if (!empty($rs)) {
- foreach($rs as $rd) {
- $blockedusers[] = $rd;
+ foreach($rs as $rd) {
+ $blockedusers[] = $rd;
- if (!empty($user2) && $user2->id == $rd->id) {
- $user2->isblocked = true;
- }
+ if (!empty($user2) && $user2->id == $rd->id) {
+ $user2->isblocked = true;
}
- unset($rd);
- $rs->close();
}
+ $rs->close();
return $blockedusers;
}
@@ -2129,6 +2127,8 @@ function message_mark_messages_read($touserid, $fromuserid){
foreach ($messages as $message) {
message_mark_message_read($message, time());
}
+
+ $messages->close();
}
/**

0 comments on commit 890c7fa

Please sign in to comment.