Zibll 主线收口:统一 single 并清退 compat 资源路径

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-09 20:30:49 +08:00
co-authored by Claude
parent 0a6f97af21
commit 09f1eec909
26 changed files with 158 additions and 1325 deletions
@@ -32,20 +32,6 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
'permission_callback' => [$this, 'check_permission'],
]);
// Docs page stats
register_rest_route(self::API_NAMESPACE, '/docs/stats', [
'methods' => 'GET',
'callback' => [$this, 'get_docs_stats'],
'permission_callback' => [$this, 'check_permission'],
]);
// Docs search (public, for frontend AJAX)
register_rest_route(self::API_NAMESPACE, '/docs/search', [
'methods' => 'GET',
'callback' => [$this, 'search_docs'],
'permission_callback' => '__return_true',
]);
// Extensions service status summary (aggregated)
register_rest_route(self::API_NAMESPACE, '/settings/extensions', [
'methods' => 'GET',
@@ -126,36 +112,11 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
}
public function get_docs_stats(): WP_REST_Response {
$nav_count = 0;
$special_count = 0;
$nav_query = new WP_Query([
'post_type' => 'page',
'post_status' => 'publish',
'meta_key' => '_wp_page_template',
'meta_value' => 'templates/pages/page-documentnav.php',
'posts_per_page' => 1,
'fields' => 'ids',
'no_found_rows' => false,
]);
$nav_count = (int) $nav_query->found_posts;
$special_query = new WP_Query([
'post_type' => 'page',
'post_status' => 'publish',
'meta_key' => '_wp_page_template',
'meta_value' => 'templates/pages/page-special.php',
'posts_per_page' => 1,
'fields' => 'ids',
'no_found_rows' => false,
]);
$special_count = (int) $special_query->found_posts;
return $this->success([
'data' => [
'total' => $nav_count + $special_count,
'nav_count' => $nav_count,
'special_count' => $special_count,
'total' => 0,
'nav_count' => 0,
'special_count' => 0,
],
]);
}
@@ -164,24 +125,10 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
* GET /docs/search — search document pages by keyword.
*/
public function search_docs(WP_REST_Request $request): WP_REST_Response {
$keyword = trim(sanitize_text_field((string) $request->get_param('keyword')));
$root_id = (int) $request->get_param('root_id');
$limit = max(1, min(50, (int) ($request->get_param('limit') ?: 20)));
if ($keyword === '') {
return $this->success(['data' => ['results' => [], 'total' => 0]]);
}
if (!class_exists('AKSRT_Docs_Presenter')) {
return $this->success(['data' => ['results' => [], 'total' => 0]]);
}
$results = AKSRT_Docs_Presenter::get_instance()->search_pages($keyword, $root_id, $limit);
return $this->success([
'data' => [
'results' => $results,
'total' => count($results),
'results' => [],
'total' => 0,
],
]);
}
@@ -439,13 +386,12 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
$services['push'] = ['enabled' => false, 'provider' => '', 'configured' => false, 'available' => false, 'verified' => false, 'transport' => '', 'missing_fields' => []];
}
// Docs Mode
$docs_en = !empty($settings['docs_mode_enabled']);
// Docs Mode (compat path is retired from rebuilt mainline)
$services['docs_mode'] = [
'enabled' => $docs_en,
'enabled' => false,
'provider' => 'builtin',
'configured' => $docs_en,
'available' => $docs_en,
'configured' => false,
'available' => false,
'verified' => true,
'transport' => 'builtin',
'missing_fields' => [],