Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/query-monitor/classes/Activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ protected function __construct( $file ) {

public function activate( $sitewide = false ) {
$db = WP_CONTENT_DIR . '/db.php';
$create_symlink = defined( 'QM_DB_SYMLINK' ) ? QM_DB_SYMLINK : true;

if ( ! file_exists( $db ) && function_exists( 'symlink' ) ) {
if ( $create_symlink && ! file_exists( $db ) && function_exists( 'symlink' ) ) {
@symlink( $this->plugin_path( 'wp-content/db.php' ), $db ); // phpcs:ignore
}

Expand Down
5 changes: 5 additions & 0 deletions plugins/query-monitor/classes/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function enable() {
}
}

if ( defined( 'QM_DB_SYMLINK' ) && ! QM_DB_SYMLINK ) {
WP_CLI::warning( 'Creation of symlink prevented by QM_DB_SYMLINK constant.' );
exit( 0 );
}

if ( ! function_exists( 'symlink' ) ) {
WP_CLI::error( 'The symlink function is not available' );
}
Expand Down
28 changes: 15 additions & 13 deletions plugins/query-monitor/output/html/db_queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,25 @@ protected function output_queries( $name, stdClass $db, array $data ) {
echo '<tr>';
echo '<th colspan="' . intval( $span ) . '" class="qm-warn"><span class="dashicons dashicons-warning" aria-hidden="true"></span>';
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
/* translators: 1: Symlink file name, 2: URL to wiki page */
$message = __( 'Extended query information such as the component and affected rows is not available. A conflicting %1$s file is present. <a href="%2$s" target="_blank" class="qm-external-link">See this wiki page for more information.</a>', 'query-monitor' );
/* translators: %s: File name */
$message = __( 'Extended query information such as the component and affected rows is not available. A conflicting %s file is present.', 'query-monitor' );
} elseif ( defined( 'QM_DB_SYMLINK' ) && ! QM_DB_SYMLINK ) {
/* translators: 1: File name, 2: Configuration constant name */
$message = __( 'Extended query information such as the component and affected rows is not available. Query Monitor was prevented from symlinking its %1$s file into place by the %2$s constant.', 'query-monitor' );
} else {
/* translators: 1: Symlink file name, 2: URL to wiki page */
$message = __( 'Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its %1$s file into place. <a href="%2$s" target="_blank" class="qm-external-link">See this wiki page for more information.</a>', 'query-monitor' );
/* translators: %s: File name */
$message = __( 'Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its %s file into place.', 'query-monitor' );
}
echo wp_kses( sprintf(
$message,
printf(
esc_html( $message ),
'<code>db.php</code>',
'<code>QM_DB_SYMLINK</code>'
);

printf(
' <a href="%s" target="_blank" class="qm-external-link">See this wiki page for more information.</a>',
'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink'
), array(
'a' => array(
'href' => array(),
'target' => array(),
'class' => array(),
),
) );
);
echo '</th>';
echo '</tr>';
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/query-monitor/output/html/logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function output() {

echo '<tr' . $attr . ' class="' . esc_attr( $class ) . '">'; // WPCS: XSS ok.

echo '<td scope="row" class="qm-nowrap">';
echo '<td class="qm-nowrap">';

if ( $is_warning ) {
echo '<span class="dashicons dashicons-warning" aria-hidden="true"></span>';
Expand Down
2 changes: 1 addition & 1 deletion plugins/query-monitor/output/html/php_errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function output() {
}

echo '<tr ' . $attr . 'class="' . esc_attr( $class ) . '">'; // WPCS: XSS ok.
echo '<td scope="row" class="qm-nowrap">';
echo '<td class="qm-nowrap">';

if ( $is_warning ) {
echo '<span class="dashicons dashicons-warning" aria-hidden="true"></span>';
Expand Down
2 changes: 1 addition & 1 deletion plugins/query-monitor/query-monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* Plugin Name: Query Monitor
* Description: The Developer Tools Panel for WordPress.
* Version: 3.6.6
* Version: 3.6.7
* Plugin URI: https://querymonitor.com/
* Author: John Blackbourn
* Author URI: https://querymonitor.com/
Expand Down
342 changes: 2 additions & 340 deletions plugins/query-monitor/readme.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions plugins/query-monitor/wp-content/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ public function query( $query ) {
}

$result = parent::query( $query );
$i = $this->num_queries - 1;

if ( ! SAVEQUERIES ) {
if ( ! isset( $this->queries[ $i ] ) ) {
return $result;
}

$i = $this->num_queries - 1;
$this->queries[ $i ]['trace'] = new QM_Backtrace( array(
'ignore_frames' => 1,
) );
Expand Down