主题和相关主题组件报告

此查询可全面了解 Discourse 实例中的所有主题及其已安装的组件,对于管理多个主题并需要快速识别每个主题上安装了哪些组件的管理员来说非常有用。

-- [params]
-- null text :theme_name

-- 查询以列出所有主题及其关联的已安装组件
WITH parent_themes AS (
  SELECT id, name
  FROM themes
  WHERE component = false
    AND (:theme_name IS NULL OR name ILIKE '%' || :theme_name || '%')
)

SELECT
  pt.name AS theme_name,
  ct.name AS component_name,
  ct.enabled AS component_enabled
FROM parent_themes pt
LEFT JOIN child_themes child ON child.parent_theme_id = pt.id
LEFT JOIN themes ct ON ct.id = child.child_theme_id
ORDER BY pt.name, ct.name

参数

  • theme_name:(可选)过滤结果,仅显示包含此文本的主题。默认视图显示所有主题及其组件。

结果

  • theme_name:每个主题的名称。
  • component_name:安装在主题上的组件的名称。
  • component_enabled:组件是否已启用(true)或禁用(false)。

没有组件的主题将显示为 component 字段的 NULL 值。结果按主题名称和组件名称的字母顺序排序。

示例结果

theme_name component_name component_enabled
Default discourse-adplugin true
Default discourse-chat true
Default discourse-signatures false
Corporate discourse-header-search true
Corporate discourse-tooltips true
3 个赞