Fixed error when no SQL queries logged by core.
This commit is contained in:
1 parent
fcf17e44d4
commit
7d64b920eb
2 files changed
+6
-3
No files matched your search
@@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Deprecated
|
### Deprecated
|
||||||
- old format of hook events
|
- old format of hook events
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- error when no SQL queries logged by core
|
||||||
|
|
||||||
## 2.0 - 2018-02-26
|
## 2.0 - 2018-02-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ class Sql_Record_Collector implements Record_Collector_Interface {
|
|||||||
*/
|
*/
|
||||||
public function get_records(): array {
|
public function get_records(): array {
|
||||||
|
|
||||||
if ( ! $this->is_savequeries() ) {
|
global $wpdb;
|
||||||
|
|
||||||
|
if ( empty( $wpdb->queries ) ) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
/** @var array $wpdb->queries */
|
/** @var array $wpdb->queries */
|
||||||
return array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries );
|
return array_map( [ $this, 'transform' ], array_keys( $wpdb->queries ), $wpdb->queries );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user