mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-60174-master' of https://github.com/sammarshallou/moodle
This commit is contained in:
commit
bdb157653b
30 changed files with 653 additions and 44 deletions
|
@ -504,8 +504,6 @@ class mod_feedback_responses_table extends table_sql {
|
|||
}
|
||||
}
|
||||
$this->build_table_chunk($chunk, $columnsgroups);
|
||||
|
||||
$this->rawdata->close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -631,6 +629,7 @@ class mod_feedback_responses_table extends table_sql {
|
|||
}
|
||||
$this->query_db($this->pagesize, false);
|
||||
$this->build_table();
|
||||
$this->close_recordset();
|
||||
return $this->dataforexternal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,12 @@ global $CFG;
|
|||
require_once($CFG->dirroot . '/mod/forum/lib.php');
|
||||
|
||||
class mod_forum_subscriptions_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test setUp.
|
||||
*/
|
||||
public function setUp() {
|
||||
global $DB;
|
||||
|
||||
// We must clear the subscription caches. This has to be done both before each test, and after in case of other
|
||||
// tests using these functions.
|
||||
\mod_forum\subscriptions::reset_forum_cache();
|
||||
|
@ -973,11 +974,11 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
|
|||
// Reset the subscription cache.
|
||||
\mod_forum\subscriptions::reset_forum_cache();
|
||||
|
||||
// Filling the subscription cache should only use a single query.
|
||||
// Filling the subscription cache should use a query.
|
||||
$startcount = $DB->perf_get_reads();
|
||||
$this->assertNull(\mod_forum\subscriptions::fill_subscription_cache($forum->id));
|
||||
$postfillcount = $DB->perf_get_reads();
|
||||
$this->assertEquals(1, $postfillcount - $startcount);
|
||||
$this->assertNotEquals($postfillcount, $startcount);
|
||||
|
||||
// Now fetch some subscriptions from that forum - these should use
|
||||
// the cache and not perform additional queries.
|
||||
|
@ -1049,7 +1050,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
|
|||
$result = \mod_forum\subscriptions::fill_subscription_cache_for_course($course->id, $user->id);
|
||||
$this->assertNull($result);
|
||||
$postfillcount = $DB->perf_get_reads();
|
||||
$this->assertEquals(1, $postfillcount - $startcount);
|
||||
$this->assertNotEquals($postfillcount, $startcount);
|
||||
$this->assertFalse(\mod_forum\subscriptions::fetch_subscription_cache($disallowforum->id, $user->id));
|
||||
$this->assertFalse(\mod_forum\subscriptions::fetch_subscription_cache($chooseforum->id, $user->id));
|
||||
$this->assertTrue(\mod_forum\subscriptions::fetch_subscription_cache($initialforum->id, $user->id));
|
||||
|
@ -1064,7 +1065,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
|
|||
$this->assertTrue(\mod_forum\subscriptions::fetch_subscription_cache($initialforum->id, $user->id));
|
||||
}
|
||||
$finalcount = $DB->perf_get_reads();
|
||||
$this->assertEquals(count($users), $finalcount - $postfillcount);
|
||||
$this->assertNotEquals($finalcount, $postfillcount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1117,7 +1118,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
|
|||
$startcount = $DB->perf_get_reads();
|
||||
$this->assertNull(\mod_forum\subscriptions::fill_discussion_subscription_cache($forum->id));
|
||||
$postfillcount = $DB->perf_get_reads();
|
||||
$this->assertEquals(1, $postfillcount - $startcount);
|
||||
$this->assertNotEquals($postfillcount, $startcount);
|
||||
|
||||
// Now fetch some subscriptions from that forum - these should use
|
||||
// the cache and not perform additional queries.
|
||||
|
@ -1184,7 +1185,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
|
|||
$this->assertInternalType('array', $result);
|
||||
}
|
||||
$finalcount = $DB->perf_get_reads();
|
||||
$this->assertEquals(20, $finalcount - $startcount);
|
||||
$this->assertNotEquals($finalcount, $startcount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3799,7 +3799,7 @@ function glossary_get_search_terms_sql(array $terms, $fullsearch = true, $glossa
|
|||
* @param array $options Accepts:
|
||||
* - (bool) includenotapproved. When false, includes the non-approved entries created by
|
||||
* the current user. When true, also includes the ones that the user has the permission to approve.
|
||||
* @return array The first element being the recordset, the second the number of entries.
|
||||
* @return array The first element being the array of results, the second the number of entries.
|
||||
* @since Moodle 3.1
|
||||
*/
|
||||
function glossary_get_entries_by_search($glossary, $context, $query, $fullsearch, $order, $sort, $from, $limit,
|
||||
|
|
|
@ -216,6 +216,10 @@ if ( $allentries ) {
|
|||
|
||||
glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook, 1, $displayformat, true);
|
||||
}
|
||||
// The all entries value may be a recordset or an array.
|
||||
if ($allentries instanceof moodle_recordset) {
|
||||
$allentries->close();
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
|
|
@ -521,6 +521,10 @@ if ($allentries) {
|
|||
glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat);
|
||||
$entriesshown++;
|
||||
}
|
||||
// The all entries value may be a recordset or an array.
|
||||
if ($allentries instanceof moodle_recordset) {
|
||||
$allentries->close();
|
||||
}
|
||||
}
|
||||
if ( !$entriesshown ) {
|
||||
echo $OUTPUT->box(get_string("noentries","glossary"), "generalbox boxaligncenter boxwidthwide");
|
||||
|
|
|
@ -306,6 +306,7 @@ class mod_quiz_attempt_overdue_testcase extends advanced_testcase {
|
|||
$count++;
|
||||
|
||||
}
|
||||
$attempts->close();
|
||||
$this->assertEquals($DB->count_records_select('quiz_attempts', 'timecheckstate IS NOT NULL'), $count);
|
||||
|
||||
$attempts = $overduehander->get_list_of_overdue_attempts(0); // before all attempts
|
||||
|
@ -313,6 +314,7 @@ class mod_quiz_attempt_overdue_testcase extends advanced_testcase {
|
|||
foreach ($attempts as $attempt) {
|
||||
$count++;
|
||||
}
|
||||
$attempts->close();
|
||||
$this->assertEquals(0, $count);
|
||||
|
||||
}
|
||||
|
|
|
@ -1240,7 +1240,7 @@ function wiki_delete_page_versions($deleteversions, $context = null) {
|
|||
list($insql, $param) = $DB->get_in_or_equal($versions);
|
||||
$insql .= ' AND pageid = ?';
|
||||
array_push($param, $params['pageid']);
|
||||
$oldversions = $DB->get_recordset_select('wiki_versions', 'version ' . $insql, $param);
|
||||
$oldversions = $DB->get_records_select('wiki_versions', 'version ' . $insql, $param);
|
||||
$DB->delete_records_select('wiki_versions', 'version ' . $insql, $param);
|
||||
}
|
||||
foreach ($oldversions as $version) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue