Skip to content

Commit

Permalink
Merge branch 'MDL-63315-m36' of https://github.com/sammarshallou/moodle
Browse files Browse the repository at this point in the history
… into MOODLE_36_STABLE
  • Loading branch information
stronk7 committed Sep 3, 2019
2 parents ed90363 + 7b2442a commit 53c8bd1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/dml/pgsql_native_moodle_database.php
Expand Up @@ -187,6 +187,17 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
throw new dml_connection_exception($dberr);
}

if (!empty($this->dboptions['dbpersist'])) {
// There are rare situations (such as PHP out of memory errors) when open cursors may
// not be closed at the end of a connection. When using persistent connections, the
// cursors remain open and 'get in the way' of future connections. To avoid this
// problem, close all cursors here.
$result = pg_query($this->pgsql, 'CLOSE ALL');
if ($result) {
pg_free_result($result);
}
}

if (!empty($this->dboptions['dbhandlesoptions'])) {
/* We don't trust people who just set the dbhandlesoptions, this code checks up on them.
* These functions do not talk to the server, they use the client library knowledge to determine state.
Expand Down

0 comments on commit 53c8bd1

Please sign in to comment.