plugin_path( 'wp-content/db.php' ), $db ); // phpcs:ignore } if ( $sitewide ) { update_site_option( 'active_sitewide_plugins', get_site_option( 'active_sitewide_plugins' ) ); } else { update_option( 'active_plugins', get_option( 'active_plugins' ) ); } } public function deactivate() { $admins = QM_Util::get_admins(); // Remove legacy capability handling: if ( $admins ) { $admins->remove_cap( 'view_query_monitor' ); } # Only delete db.php if it belongs to Query Monitor if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && class_exists( 'QM_DB' ) ) { unlink( WP_CONTENT_DIR . '/db.php' ); // phpcs:ignore } } public function filter_active_plugins( $plugins ) { // this needs to run on the cli too if ( empty( $plugins ) ) { return $plugins; } $f = preg_quote( basename( $this->plugin_base() ), '/' ); return array_merge( preg_grep( '/' . $f . '$/', $plugins ), preg_grep( '/' . $f . '$/', $plugins, PREG_GREP_INVERT ) ); } public function filter_active_sitewide_plugins( $plugins ) { if ( empty( $plugins ) ) { return $plugins; } $f = $this->plugin_base(); if ( isset( $plugins[ $f ] ) ) { unset( $plugins[ $f ] ); return array_merge( array( $f => time(), ), $plugins ); } else { return $plugins; } } public function php_notice() { ?>