diff --git a/wire/core/Functions.php b/wire/core/Functions.php index cd731a7c..5fce3a61 100644 --- a/wire/core/Functions.php +++ b/wire/core/Functions.php @@ -882,6 +882,8 @@ function wireClassName($className, $withNamespace = false, $verbose = false) { * } * ~~~~~ * + * #pw-group-class-helpers + * * @param string|object $className * @param bool $withClass Include class name in returned namespace? (default=false) * @param bool $strict Return array of namespaces if multiple match? (default=false) diff --git a/wire/core/WireDatabasePDO.php b/wire/core/WireDatabasePDO.php index 68561a58..8a7d063e 100644 --- a/wire/core/WireDatabasePDO.php +++ b/wire/core/WireDatabasePDO.php @@ -641,21 +641,31 @@ class WireDatabasePDO extends Wire implements WireDatabase { protected function ___unknownColumnError($column) { } /** - * Log a query, or return logged queries + * Log a query, start/stop query logging, or return logged queries * * - To log a query, provide the $sql argument containing the query (string). * - To retrieve the query log, call this method with no arguments. * - Note the core only populates the query log when `$config->debug` mode is active. + * - Specify boolean true for $sql argument to reset and start query logging (3.0.173+) + * - Specify boolean false for $sql argument to stop query logging (3.0.173+) * * #pw-group-custom * - * @param string $sql Query (string) to log + * @param string $sql Query (string) to log, boolean true to reset/start query logging, boolean false to stop query logging * @param string $note Any additional debugging notes about the query - * @return array|bool|int Returns query log array, boolean true if added, boolean false if not + * @return array|bool|int Returns query log array, boolean true on success, boolean false if not * */ public function queryLog($sql = '', $note = '') { if(empty($sql)) return $this->queryLog; + if($sql === true) { + $this->debugMode = true; + $this->queryLog = array(); + return true; + } else if($sql === false) { + $this->debugMode = false; + return true; + } if(!$this->debugMode) return false; if(count($this->queryLog) > $this->queryLogMax) { if(isset($this->queryLog['error'])) {