mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-57192 dml: Support temporarily disabling query logs during setup
This commit is contained in:
parent
c4cf1c60f5
commit
c14fe2cb03
@ -136,6 +136,11 @@ abstract class moodle_database {
|
||||
*/
|
||||
private $inorequaluniqueindex = 1;
|
||||
|
||||
/**
|
||||
* @var boolean variable use to temporarily disable logging.
|
||||
*/
|
||||
protected $skiplogging = false;
|
||||
|
||||
/**
|
||||
* Constructor - Instantiates the database, specifying if it's external (connect to other systems) or not (Moodle DB).
|
||||
* Note that this affects the decision of whether prefix checks must be performed or not.
|
||||
@ -487,6 +492,11 @@ abstract class moodle_database {
|
||||
* @return void
|
||||
*/
|
||||
public function query_log($error=false) {
|
||||
// Logging disabled by the driver.
|
||||
if ($this->skiplogging) {
|
||||
return;
|
||||
}
|
||||
|
||||
$logall = !empty($this->dboptions['logall']);
|
||||
$logslow = !empty($this->dboptions['logslow']) ? $this->dboptions['logslow'] : false;
|
||||
$logerrors = !empty($this->dboptions['logerrors']);
|
||||
@ -525,6 +535,20 @@ abstract class moodle_database {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable logging temporarily.
|
||||
*/
|
||||
protected function query_log_prevent() {
|
||||
$this->skiplogging = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore old logging behavior.
|
||||
*/
|
||||
protected function query_log_allow() {
|
||||
$this->skiplogging = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time elapsed since the query started.
|
||||
* @return float Seconds with microseconds
|
||||
|
Loading…
x
Reference in New Issue
Block a user