Skip to content

Commit 778a93e

Browse files
committed
Removed some filters. Fixed sort by issue.
1 parent cb4d9d9 commit 778a93e

File tree

7 files changed

+7
-42
lines changed

7 files changed

+7
-42
lines changed

plugins/wpgraphql-logging/docs/reference/admin.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -231,22 +231,6 @@ add_filter( 'wpgraphql_logging_filter_redirect_url', function( $redirect_url, $f
231231
return add_query_arg( 'my_flag', '1', $redirect_url );
232232
}, 10, 2 );
233233
```
234-
235-
#### Filter: `wpgraphql_logging_view_template`
236-
Filters the template path for the single log view.
237-
238-
Parameters:
239-
- `$template_path` (string)
240-
241-
Returns: string
242-
243-
Example:
244-
```php
245-
add_filter( 'wpgraphql_logging_view_template', function( $template_path ) {
246-
return plugin_dir_path( __FILE__ ) . 'templates/custom-view.php';
247-
});
248-
```
249-
250234
---
251235

252236
### Class: `View\List\ListTable`

plugins/wpgraphql-logging/docs/reference/logging.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -221,21 +221,6 @@ Source: <https://github.com/wpengine/hwptoolkit/blob/main/plugins/wpgraphql-logg
221221

222222
Represents a single log entry and provides persistence helpers.
223223

224-
#### Filter: `wpgraphql_logging_database_name`
225-
Filters the database table name used for logs.
226-
227-
Parameters:
228-
- `$table_name` (string)
229-
230-
Returns: string
231-
232-
Example:
233-
```php
234-
add_filter( 'wpgraphql_logging_database_name', function( string $name ) {
235-
return $name . '_tenant_' . get_current_blog_id();
236-
});
237-
```
238-
239224
#### Filter: `wpgraphql_logging_allowed_orderby_columns`
240225
Filters the allowed columns for ORDER BY in `find_logs()` queries.
241226

plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,7 @@ protected function display_tablenav( $which ): void {
514514
* Render custom filter controls.
515515
*/
516516
protected function render_custom_filters(): void {
517-
$template = apply_filters(
518-
'wpgraphql_logging_filters_template',
519-
__DIR__ . '/../Templates/WPGraphQLLoggerFilters.php'
520-
);
517+
$template = __DIR__ . '/../Templates/WPGraphQLLoggerFilters.php';
521518

522519
if ( ! file_exists( $template ) ) {
523520
return;

plugins/wpgraphql-logging/src/Admin/ViewLogsPage.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,7 @@ protected function render_view_page(): void {
392392
return;
393393
}
394394

395-
$log_template = apply_filters(
396-
'wpgraphql_logging_view_template',
397-
__DIR__ . '/View/Templates/WPGraphQLLoggerView.php'
398-
);
395+
$log_template = __DIR__ . '/View/Templates/WPGraphQLLoggerView.php';
399396

400397
require_once $log_template; // @phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
401398
}

plugins/wpgraphql-logging/src/Logger/Database/WordPressDatabaseEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public static function get_schema(): string {
283283
public static function get_table_name(): string {
284284
global $wpdb;
285285
// @TODO - Check for multisite
286-
return apply_filters( 'wpgraphql_logging_database_name', $wpdb->prefix . 'wpgraphql_logging' );
286+
return $wpdb->prefix . 'wpgraphql_logging';
287287
}
288288

289289
/**

plugins/wpgraphql-logging/src/Logger/Database/WordPressDatabaseLogService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function find_entities_by_where(array $args = []): array {
9393
$orderby = 'id';
9494
}
9595

96-
$order = $args['order'] ?? 'DESC';
96+
$order = strtoupper( $args['order'] ?? 'DESC' );
9797
if ( ! in_array( $order, [ 'ASC', 'DESC' ], true ) ) {
9898
$order = 'DESC';
9999
}
@@ -109,6 +109,7 @@ public function find_entities_by_where(array $args = []): array {
109109
$offset = 0;
110110
}
111111

112+
112113
$sql .= " ORDER BY $orderby $order LIMIT %d, %d";
113114
$this->where_values[] = $offset;
114115
$this->where_values[] = $limit;

plugins/wpgraphql-logging/tests/wpunit/Admin/View/List/ListTableTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ public function test_prepare_items_handles_orderby_and_order_params(): void {
320320

321321
$_REQUEST = [
322322
'orderby' => 'date',
323-
'order' => 'DESC'
323+
'order' => 'DESC',
324+
'_wpnonce' => wp_create_nonce('wpgraphql-logging-sort'),
324325
];
325326

326327
$this->list_table->prepare_items();

0 commit comments

Comments
 (0)