Knowledge - edmozley/freeitsm GitHub Wiki
Knowledge
Folder: knowledge/
๐ Articles can be published to customers. The self-service Help Centre shows articles marked Analysts and signed-in customers. Every article starts as analysts-only.
Colour: Purple #8764b8
Rich-text knowledge base with AI chat and vector search. Articles are written in TinyMCE, organised by tags, and searchable both with traditional full-text search and semantic similarity via embeddings.
Who can see an article
Two settings in the editor, next to Owner. They answer different questions, and you need both.
Who can see this โ the audience:
| Setting | Who reads it |
|---|---|
| Analysts only | Your team. The default for every article, including ones written before this setting existed. |
| Analysts and signed-in customers | Shown in the self-service portal's Knowledge section โ signed-in requesters can search, browse and read these articles; they also appear as popular articles on the portal dashboard and power ticket-deflection suggestions. Their documents can be downloaded there too, unless a document is set to Hidden (3.7.0 - see Documents on an article). |
| Anyone, including website chat | The web chat widget's AI can answer visitors from it. Only choose this for things you would happily show a stranger. |
Company (only appears if you have more than one) โ leave it shared with all companies for anything generic ("how to reset your password"), or pick one company and only that company sees it.
The two are independent on purpose: scoping an article to a company still hands it to that company's anonymous website visitors unless the audience says otherwise.
Why has my chat widget gone quiet? Because every article defaults to Analysts only, so after upgrading, the widget's AI has nothing it is allowed to use. Mark a few customer-facing articles public and it starts working again. The default is deliberate โ an upgrade must never start showing internal runbooks to the public.
Articles in the recycle bin are never used by the chat AI either, nor is anything unpublished. The LMS can only build lessons from shared articles, because a course has no company and is shown to every learner.
Folders
Articles are organised into folders, one folder per document, so there is always a single honest answer to "where is it?". Drag a document onto a folder to file it; Ctrl-drag to leave a shortcut instead. Folders can be nested, and dragging a folder takes everything inside it.
Home shows what is filed at the top level, plus the folders โ not every article you own, any more than opening a disk lists every file on it. Searching and tag filters still look everywhere, and say which folder each result came from.
The main pane offers four views โ List, Cards, Tree and Details โ remembered per analyst. Documents sort alphabetically with folders above them. Switching away from Tree shows the same thing as opening that view fresh (the top level, not every article flattened out).
A folder's count includes everything beneath it - the articles in it and in all its subfolders, so a folder that only holds subfolders no longer reads 0. Only folders you can open are counted. In Details the count sits beside the folder's name.
The folder panel can be resized. Drag the edge between the panel and the articles to make it wider (for long folder names) or narrower, or click the edge and use the Left / Right arrow keys (Home / End for narrowest / widest). It stays between 200px and half the window, and the width is remembered in this browser. If the panel is set to open on hover, it stays open while you are typing or tabbing inside it.
In Tree, choosing a folder in the left panel keeps the tree where it is and scrolls the folder into view if it is off screen; Up a level and the breadcrumb do the same.
Folding the tree (5.15.0)
In Tree, every folder with something inside it has an arrow beside it (#464, raised by @Dr4inder). Click it to fold the folder away - its subfolders and articles disappear and the folder row stays - and click again to open it. Collapse all and Expand all sit above the tree: Collapse all leaves only the top-level folders (and the unfiled articles), Expand all opens everything. Folding never selects a folder, opens an article or ticks a box.
- Remembered in this browser, so the tree comes back the way you left it.
- Filters stay on. With a search or a tag filter, Expand all opens only what the filter found.
- Choosing a folder inside a folded branch - from the left panel or the breadcrumb - unfolds the folders above it, so it is on screen and highlighted.
- A folded article cannot be selected by accident. Shift-click ranges and Ctrl+A take only the rows you can see.
- Keyboard: the arrows and both buttons are ordinary buttons - Tab reaches them, Enter or Space works them, and a screen reader hears "Collapse Networking" or "Expand Networking".
Several articles can be ticked and then moved into a folder or given a new audience in one go. A plain click always opens a document, so the tick box is the selection mechanism; Shift and a tick takes a range, and the arrow keys, Space, Ctrl+A and Escape all work. The tick always matches the selection, in every view and with a tag filter on.
Delete from the right-click menu. Right-click an article, in any view, and choose Delete to send it to the Recycle Bin without opening it first. It is the same action as Archive on an open article (the confirmation, the Recycle Bin, Restore), only quicker. A shortcut still has Remove shortcut, which takes away the pointer and leaves the article alone.
Deleting a folder. Right-click โ Delete. A folder still has to be empty of articles and subfolders, but articles in the Recycle Bin do not count: once everything in a folder has been deleted, the folder can go too. Those articles stay in the Recycle Bin, and restoring one brings its folder back - and any parent folders that were deleted with it - in the same place, with the same permissions.
Esc closes the open Knowledge dialog (History, Permissions, Move, Tags, Share by email, name prompts, Archived article, Exceptions), exactly as its Close or Cancel button would. And typing a search while an article is open now takes you to the results, as choosing a folder does; an unsaved edit is never hidden.
Badges, folder paths and owners in the list (5.15.0)
Cards and list rows say more about each article (#481, raised by @Dr4inder):
| Beside the title | When |
|---|---|
| Review overdue (red) | its next review date has passed |
| Review due soon (amber) | its review is due within 30 days - the same window as Knowledge โ Review |
| Customers / Public (blue) | customers, or anyone on the internet, can read it |
An internal article with nothing due carries no badge. Details shows the same badges, and the Draft badge, after the name.
The folder path. Whenever a list holds articles from more than one folder - a search, a tag filter, a folder with shortcuts in it - each article shows its folder as a path, Service Desk โบ Runbooks, so two articles with the same title in different folders can be told apart. A long path loses its middle (Product โบ โฆ โบ Client โบ Install), and the whole path is in the tooltip. Browsing a single folder, every article is in that folder, so nothing is shown.
Author or owner. After an import every article has the same author - whoever ran the import - while the owner is the person to ask. Knowledge โ Settings โ Display chooses what cards and rows name, for everyone:
| Name on each card and row | Shows |
|---|---|
| The author (the default) | By ... - as before |
| The owner | Owner: ..., or the author when an article has no owner |
| The author and the owner | both, and the name once when they are the same person |
Decided with Ed, 1 December 2026: an install setting rather than a personal one, defaulting to the author so nothing changes until someone chooses; "due soon" is 30 days so a badge never disagrees with the Review page.
โ Knowledge โ folders and security
Permissions
Beyond the audience above, a folder or an individual document can be restricted to named analysts, teams or portal users.
Every folder and every document is either Open โ the list is who is shut out โ or Restricted to chosen people, where the list is who is let in. The list means the opposite thing in each, which is the one thing to understand before using it. Because an object is only ever one or the other, an access list cannot contradict itself: there is no allow/deny precedence to learn.
By default a document inherits the same permissions as the folder above. Permission exceptions in the left panel lists everything that does not, because an exception you cannot see is one nobody will ever audit.
Whether restricting a folder protects what is inside it is an install-wide setting โ folders are containers (the default) or folders are filing โ under Knowledge โบ Settings โบ Permissions, with a preview of how many document readings the change would gain or lose.
The same rules apply to analysts, the self-service portal, the AI assistant, the website chat and the REST API. An administrator can always read anything, and every use of that floor is recorded separately from ordinary reads.
โ Knowledge โ folders and security ยท Developer Guide
Network diagrams
An article can be linked from a Network Mapper diagram - from one node or shape on it, or from the diagram as a whole. When it is, the article shows a Network diagrams panel listing them, so a reader can jump from the runbook to the picture. The panel only lists the current version of each diagram, and only shows when the reader has Network Mapper access. The link respects this article's own visibility: someone who cannot read the article sees it on the diagram as an article you don't have access to, never its title.
Attached documents
Files and links can be attached to an article โ the manuals, procedures and PDFs an article refers to. The article lists them; adding and removing lives in the editor, because reading an article is not editing it.
Editing
- TinyMCE editor with the full toolbar (formatting, lists, tables, links)
- Full screen (button beside Save, desktop only) - just the editor, filling the whole window with nothing else on screen. Press Esc to come back, or use the full-screen button at the end of the toolbar
- Link to another article - select the words, click Link, then the folder icon beside URL. A list of the articles you can see opens, each with its folder; type to search, click one, and the address (
?article=N) is filled in. Whatever you typed in Text to display is kept. The link opens the article in its own folder, and in the self-service Help Centre it opens for requesters who may read it (an article they may not read says so, as any link would). (PR #253) - Tag-based organisation โ assign multiple tags per article
- Article versioning โ save as a new version to archive the previous content with full version history
- Article archiving with a recycle bin (soft delete, restore, configurable auto-purge after N days)
Pictures in an article (5.15.0)
Click a picture in an article and it opens enlarged in the same viewer Files uses (#474): zoom in and out, Fit, full screen, Download, and - when the article has more than one picture - previous / next (or the Left and Right arrow keys) and a Slideshow. Esc closes it and you are back where you were in the article. The pointer turns into a magnifier over a picture, so it is obvious it can be clicked.
Articles brought across from another knowledge base often wrap every picture in a link to the picture itself. Before 5.15.0 clicking one left the article for the bare image, and Back was the only way home. A link that holds nothing but a picture, and points at a picture, now opens in the viewer instead - at the link's address, which is often the full-size version. Every other link stays a link, and Ctrl-click or middle-click still opens a new tab.
On a phone the picture you tapped opens full screen, as a file in Files does - one picture, without previous / next.
In the Help Centre too (5.17.0). Customers reading an article in the self-service portal get the same: a picture opens enlarged in the same viewer, with the article's other pictures to step through, and a picture wrapped in a link to itself opens there instead of leaving the article. The code is shared - assets/js/article-pictures.js (ArticlePictures.init(body, nameFor)), loaded by the Knowledge page and, through $needsPictureViewer in self-service/includes/footer.php, by self-service/help-centre.php. The viewer is handed only the article's own picture addresses, so the portal needs no Files access for it. Full detail: Pictures in an article - Developer Guide.
More actions above an article (5.15.0)
Above an article, Share and Edit are always there - and Publish while it is a draft. The actions used less often are in the ... menu (#479):
| In the ... menu | |
|---|---|
| Move | file it in another folder |
| History | who read and changed it (only for someone who may change its access) |
| Permissions | who may read it (only for someone who may change its access) |
| Archive | last, apart from the rest and in red - sends it to the Recycle Bin |
Archive used to be a large red button right beside Edit; now the button that removes an article is never the one beside the one you use every day. The menu works from the keyboard: the first item takes the focus, the Up and Down arrows move between items, and Esc closes it and puts the focus back on .... On a phone the bar at the bottom of the screen has three buttons - Share, Edit and ... - and the menu opens as a sheet from the bottom, like Share.
Reading an article (5.15.0)
An open article now says where it lives, who looks after it and whether it is current (#478, raised by @Dr4inder).
- Where it is filed. Above the title: Home โบ Service Desk โบ Runbooks. Each part opens that folder. The left panel highlights the article's own folder while you read it - not wherever you came from - and goes back to your list's folder when you return to the list.
- Owner, review date and audience join the line under the title: Owner: ..., Review by 12 Jan 2027 (red - Review overdue since ... - once the date has passed, amber when it is within 30 days) and Audience: Analysts only / Customers / Public. All three are set in the editor; an article with no owner or no review date simply leaves that part out. On a phone they wait behind the tap that opens the rest of the details, except an overdue review, which stays in view beside Modified.
- A table of contents. An article with three or more H2 and H3 headings gets a list of them. On a wide screen it sits in a column beside the text and stays in view as you scroll; in a narrower window or on a phone it is a folded Contents block above the text. Click an entry to jump to that heading (the heading takes the keyboard focus too). Each person can switch it off in Knowledge โ Settings โ Left panel โ Table of contents - Hide gives the text the full width back.
Decided with Ed, 1 December 2026: the table of contents is a personal choice, on unless switched off - some people read top to bottom and want the width back.
Developer view: Knowledge - reading and lists: Developer Guide.
Versions (5.17.0)
From #465, by @Dr4inder. Saving with Save as new version has always kept the text as it was before, but until 5.17.0 only the REST API could read it. Now Versions, in an article's โฏ menu, lists them - the current text first, then each saved one with who saved it and when.
- Open a version to read it as it was.
- Compare with any other version - the current one is chosen for you - to see what changed: added words in green, removed ones struck through in red. It compares the words, so a change of formatting alone does not show.
- Restore puts back the version's title and text - the owner, folder, tags, audience and access stay as they are now. The current text is kept as a version first, so a restore never loses anything and can itself be undone. It is recorded in the article's History as Earlier version restored, with the version number.
- Who: anyone who can open and save the article - the same people. An old version can hold text that was taken out on purpose, so it is never shown more widely than the article itself.
- Every save, or only when asked: Knowledge โ Settings โ Versions โ Keep a version - Only when Save as new version is ticked (the default, as before) or Every time the title or text changes. With every time on, a bad edit can always be undone; a save that changes neither (a review date, say) keeps nothing.
For developers: KnowledgeService::listVersions(), getVersion(), restoreVersion() and autoVersionOn() (includes/services/knowledge.php), served by api/knowledge/versions.php. A row in knowledge_article_versions holds the text as it was before the save that kept it, under the number it had then; the article row is always the current version. A restore is an ordinary saveArticle() with save_as_version, so it takes the same locks, size checks and events, plus the version_restore audit action. The comparison is in assets/js/knowledge.js - kbVersionText() turns each version into plain text, kbDiff() is Myers' algorithm on words. Tested by tests/knowledge-versions.php. Full detail: Knowledge versions - Developer Guide.
Drafts and Publish (5.7.0)
Some articles start as drafts: anything the AI writes for you (the Assistant, Write up on a ticket, a project's document) and anything a migration script imports with is_published: false. A draft shows a Draft badge in the article list and under its title - "Only analysts can see this article until it is published" - and requesters, the Help Centre, web chat and AI answers ignore it.
Read it, click Edit to change what needs changing, then click Publish above the article. Publishing asks first, then makes the article visible to everyone its audience and permissions allow, and runs any workflow set to start when an article is published.
Anyone who can edit an article can publish it - the same people who can already create a published one. Decided with Ed, 19 November 2026.
Before 5.7.0, drafts looked exactly like published articles to analysts and nothing could publish them. It was found while reviewing PR #378; the write-up is there.
Migrating from another knowledge base (5.7.0)
A script can recreate your old knowledge base through the REST API - folders, articles, access lists and the pictures inside articles - and can be stopped and run again without making duplicates. Restricted articles are restricted from the moment they arrive. See REST API: Knowledge - Migrating a knowledge base in.
Pictures you paste into the editor are still kept inside the article itself; pictures a migration uploads are stored as protected files and checked against the article on every view. Nobody who is not signed in can see either.
Deleting unused tags (5.15.0)
A tag stays in the sidebar after the last article using it has dropped it, showing (0). A Knowledge administrator sees Delete unused tags under the tag list whenever a tag shows 0 (#463). It lists the tags no article uses at all, names them in the confirmation, and deletes those.
What counts as used: any article that has the tag - archived articles and drafts included. The sidebar count leaves out archived articles and articles you cannot see, so a tag showing (0) may still be in use; it is kept, and if nothing is really unused you are told so. Deleting a tag never changes an article. A tag that was an active filter stops filtering.
Search
- Full-text search on title + body across all active articles
- Tag filtering in the sidebar
- Vector / semantic search โ articles are embedded on save with the embedding model you choose (below); queries find conceptually related articles even when the words don't match
Embeddings (5.12.0, #449)
Two models are involved in Ask AI, and they are set in two places:
| Step | What it does | Set on |
|---|---|---|
| Finding the articles | Turns each article, and the question, into numbers (an embedding), so the closest articles are found by meaning | Knowledge โ Settings โ Embeddings |
| Writing the answer | Reads those articles and answers | Knowledge โ Settings โ AI |
The embedding model can be OpenAI, Azure OpenAI or your own server (anything OpenAI-compatible: Ollama with nomic-embed-text, LM Studio, vLLM), whatever writes the answers. OpenRouter and Anthropic cannot make embeddings. Choose your own server and no article text leaves your network.
- Provider, address or key, model (listed by the server), Save, Test - Test embeds one sentence and says how long it took.
- Changing the model means the articles need embedding again: vectors from different models cannot be compared, so the old ones stop counting and Generate redoes them. Until it has, Ask AI and the web chat use every article instead of the closest few.
- Generate is greyed out, with the reason, until an embedding model can work. A run that meets an error that would stop every article (no key, a key refused, no connection, an unknown model, a quota) stops at once and says why on the page; articles already done are kept.
- Upgrading: an install that had an OpenAI key keeps OpenAI
text-embedding-3-smalland every vector it has. Nothing to do. - The Knowledge assistant's gap analysis uses the same model for tickets, and starts its ticket cache again when the model changes.
Developers: Knowledge embeddings - developer guide.
A picture from Files (#424)
The article editor's Insert picture from Files button (under ... on a narrow window) opens the Files picker, showing only pictures. The chosen picture goes into the article as a copy:
- it's fetched through Files with your own rights, so you need Download on the folder;
- it's scaled and capped like a picture from your computer;
- its name becomes the alt text.
Why a copy, not a link: most readers of an article can't open the Files folder it came from, whether they're other analysts or portal users. A linked picture would be blank for them. A document you want kept in one place belongs in the article's Documents, attached From Files as a link. The code is kbInsertPictureFromFiles() in assets/js/knowledge.js, and the picker's accept: 'image' is in assets/js/files-picker.js.
Ask AI
AI chat panel powered by your chosen provider โ Anthropic Claude, OpenAI, or any model via OpenRouter (see AI Providers). The user asks a question; the model searches the knowledge base via vector similarity, picks relevant articles, and answers grounded in those articles' content. Sources are cited so the user can verify and read deeper.
Also accessible from the Tickets reading pane via the Ask AI button โ useful when triaging an unfamiliar incident.
Assistant
Reads your closed tickets and reports what the knowledge base is missing โ "I read 340 closed tickets from the last 90 days. Your knowledge base is missing six things." Each finding is a question the desk has answered repeatedly with no article covering it ("Cannot open shared mailbox in Outlook โ asked 14 times"), with the tickets attached as evidence.
Draft writes the article, streaming as it goes โ and it is allowed to say no. A ticket recording only "reset password, asked user to log in again" is refused rather than padded out, because a knowledge base full of padding teaches people to stop searching it. When it refuses it asks two to four specific questions about that ticket; answer them and it writes the article from your answers.
Drafts always land unpublished โ nothing AI-written reaches the portal, the web chat or the AI answers until a human publishes it. See Drafts and Publish.
The same judgement is available from a solved ticket via the Write up button in the Tickets reading pane.
Finding the gaps works with no AI spend at all (it matches on wording rather than meaning); only drafting needs a model, and it reuses the Ask AI provider above.
โ Knowledge Assistant ยท Knowledge Assistant โ Developer Guide
Reviews and reminders (5.15.0)
An article is either a draft (only analysts can see it) or published. Anyone who may edit an article may publish it - there is no separate approval step. Before 5.15.0 the in-app help described one (Pending Review, Approved, Changes Requested); it never existed, and the help now describes what Knowledge does (#466).
What keeps articles current is their owner (who to ask) and their next review date (when someone should look again), both set in the editor. Knowledge โ Review lists every article by its review date, with tabs for overdue, due in the next 30 days and no review date, and the Watchtower attention card counts the overdue ones.
Review reminders (#469) tell owners, so nobody has to remember to look. They are off until a Knowledge administrator turns them on in Knowledge โ Settings โ Reviews:
| Setting | Choices |
|---|---|
| Remind owners | Off (the default), Weekly (the first run of each week), Daily |
| Include reviews coming up | No - only due today or overdue; or due within 7 (the default), 14 or 30 days |
| Articles with no owner go to | Nobody, or one analyst. Also used when an owner has left (is no longer active) |
Each person gets one bell notification per day or week - "3 Knowledge articles are due for review", with "1 overdue, 2 due within 7 days" - linked to Knowledge โ Review. It gives counts, never titles: the Review page then shows each person only the articles they may read. Archived articles and articles with no review date never count. Each analyst can switch these notifications off in Preferences โ Notifications (Knowledge articles are due for review). They are sent by the Knowledge review reminders background job, which shows in Reporting โ System logs โ Background jobs while reminders are on. Developer view: Knowledge review reminders - Developer Guide.
Email Sharing
Articles can be emailed externally via the configured mail provider โ handy for sharing a how-to with a user when closing a ticket.
Share โ PDF downloads the article as a searchable PDF, and an emailed article can carry one. It prints every language FreeITSM ships โ Polish, Hindi, Tamil and the rest โ wraps within the margins, prints the article's tables as tables, and carries your organisation's logo (System โ Branding), or none if you have not set one. Chinese, Japanese and Korean are not covered yet. Since #254; how PDFs are made: PDF exports moved to PDFKit.
The Branding header and footer (5.15.0)
Every page of an article PDF - downloaded, or attached to an email - carries the header and footer set in System โ Branding (#493, raised by @Dr4inder): the same left, centre and right boxes Network Mapper diagrams use, so there is one place to brand output. The tokens are filled in for the article - {{logo}}, {{title}}, {{author}}, {{version}} (Version 4) and {{modified}} - and an empty box stays empty.
- Page numbers. Every page says Page 1 of 3 in the reader's language (Seite 1 von 3 in German), always with the final total. It goes in the first empty footer box, right first; when all three are in use, on a second line under the right one. To put it somewhere else, use the new
{{page}}and{{pages}}tokens in any box -{{page}} / {{pages}}prints 1 / 3 - and then no second counter is added. - The article never runs into the header or footer, on any page: paragraphs, pictures and tables that cross a page all stop above the footer and start below the header.
- A clear gap between the logo and the title, even with a logo that carries a tagline or a title that wraps.
- No logo uploaded, or empty boxes: nothing is printed in their place - no placeholder text and no broken picture. If the Branding settings cannot be read, the PDF still prints, with its page numbers.
Decided with Ed, 1 December 2026: the page counter places itself unless a box asks for it with {{page}}, so it appears without anyone editing Branding.
Settings
-
Email settings: SMTP / Graph configuration for outbound article emails
-
AI settings: provider / model / key for Ask AI (Anthropic, OpenAI or OpenRouter โ see AI Providers)
-
Embeddings: the embedding model that finds the articles - OpenAI, Azure OpenAI or your own server - and Generate (above). Before 5.12.0 this was an OpenAI key on the AI tab.
-
Reviews (5.15.0, #469): review reminders to article owners - above.
-
Display (5.15.0, #481): whether cards and rows name the author, the owner or both - above.
-
Left panel (personal): the sidebar's behaviour, where you browse folders, and - since 5.15.0 - the table of contents beside long articles (above). 5.15.0 fix: someone without Knowledge settings rights lands straight on this tab, and its choices used to show nothing ticked; they now load with the page.
-
Images (5.9.0, #417): the largest picture an integration may upload through the REST API - 5, 10 (the default), 20, 25 or 50 MB. For each size it shows whether this server's PHP can take it, and what to raise if not; FreeITSM never changes server settings itself. Pictures added in the article editor are not affected. See REST API - Knowledge.
API keys are encrypted at rest and masked in API responses.
Help
Interactive guide at knowledge/help.php covering article creation, publishing and reviews, Ask AI, search and navigation, sharing and export. Scroll-spy sidebar. (5.15.0: the "Review workflow" section described an approval step that does not exist and was rewritten - #466.)
Key Tables
| Table | Purpose |
|---|---|
knowledge_articles |
Core article record โ including tenant_id (owning company; NULL = shared with all) and audience (internal / customer / public) |
knowledge_article_versions |
Earlier versions - the text before each versioned save (Versions) |
knowledge_article_tags |
Many-to-many tags |
knowledge_tags |
Tag definitions |
knowledge_articles.embedding / embedding_model |
The article's vector (JSON) and which model made it (openai:text-embedding-3-small, compatible:nomic-embed-text). Corrected 28 Nov 2026: this row used to name a knowledge_embeddings table, which has never existed. |
knowledge_images |
Pictures uploaded to an article through the REST API (5.7.0); files in uploads/knowledge/ |
knowledge_api_references |
A migration script's client_reference for each create, so a retry finds the original (5.7.0) |
For developers
โ ๏ธ knowledge_articles.tenant_id IS NULL means "shared with EVERY company" โ the opposite of what NULL means for tickets, assets and changes, where it means "belongs to the Default company". Consequently Knowledge must never use the shared scoping helpers:
| Don't use | Use instead | Why |
|---|---|---|
activeTenantFilter() |
knowledgeTenantFilter() |
The generic one only shows NULL rows while Default is the active company โ every shared article would vanish for every other company. |
apiKeyTenantFilter() |
apiKeyKnowledgeFilter() |
Same trap on the REST side. Its docblock even says "for tickets, problems, and any future tenant-scoped module" โ Knowledge is the exception. |
The SQL looks nearly identical, the meaning does not, and getting it wrong fails silently: no error, tests green, an MSP's generic articles just quietly disappear for most clients. Both correct helpers carry loud docblocks.
Other notes:
audienceis an ordered ladder (internalโcustomerโpublic), not a flag per channel. A reader declares its own rung and sees everything at or above it. Values areAudience::constants (includes/knowledge/audience.php) for the same reason asCap::โ a typo that silently matches nothing is a disclosure, not a bug.- Why a ladder and not a flag per channel: the readers aren't peers โ they're degrees of trust, and a web chat visitor is anonymous (they typed a name and an email; neither is verified). Per-channel flags would allow eight combinations, most of them nonsense ("visible to web chat but not analysts"), and each new channel would mean another column plus a retroactive decision about every existing article. "Self-service yes, web chat no" is simply
customer. - Migration was free and fails safe:
tenant_idNULL = shared is exactly the pre-multi-tenancy behaviour, so nothing needed backfilling;audiencedefaults tointernal, so running Database Verify can never start disclosing existing articles โ authors opt in per article. Both filters are no-ops at N=1 and on installs that haven't migrated yet. - Reads are filtered in SQL before scoring (
includes/knowledge/kb_ai.php) โ the security boundary, and cheaper than decoding vectors you'd discard.kbRetrieveArticles()defaults to the most restrictive rung so a careless caller gets too little, never too much. - Embeddings encode
title + bodyonly, so ownership isn't baked in โ changing either column needs no regeneration. fk_knowledge_articles_tenantis deliberately notON DELETE SET NULL(unlikefk_assets_tenant): NULL means shared here, so SET NULL would promote a deleted company's private articles into everyone's.- The service layer unified writes, not reads โ one place to write these columns, ~20 hand-rolled SELECTs to filter. Adding a new reader? Add the filter, and a case to
tests/knowledge-visibility/. php tests/knowledge-visibility/run.phpโ 88 integration checks (dev installs only).- The article picker (PR #253) is TinyMCE's own file picker, not a custom dialog.
file_picker_types: 'file'puts a browse button only on the Link dialog's URL (the image and media dialogs keep their own flow), andfile_picker_callbackopenskbOpenArticleLinkPicker()- a TinyMCEwindowManagerdialog with a search box and atreeof results, so keyboard focus stays inside TinyMCE's focus trap. It searches the same permission-filtered list as the browser,api/knowledge/knowledge_articles.php?limit=40&search=...(limitis validated to 1-50, anything else is a 400), and returns?article=Nwith{ text }so display text the author already typed survives. TinyMCE stores the link as written (href="?article=21"). TRAP: that relative link resolves against wherever the article is read - the analyst page (knowledge/?article=N, opened by the link handler inknowledge.js) and the portal (self-service/help-centre.php, which takes?article=Nas an alias of?id=Nfor exactly this reason). A new place that renders article bodies must handle?article=Ntoo, or such links lead nowhere.tests/knowledge-link-picker-editor.phpdrives the real TinyMCE dialog in Chrome (12 checks). - Reading an article and the lists (5.15.0) - the folding tree, the breadcrumb, owner / review / audience, the table of contents, card badges and owners, and the branded PDF: Knowledge - reading and lists: Developer Guide.
- Folders and the access model have their own page: Knowledge โ folders and security: Developer Guide. The short version:
includes/knowledge/visibility.phpis the one choke point,knowledgeCanRead()is built on the same clause the list uses so the two cannot drift, andknowledge_aclhas no allow/deny column โ polarity lives on the object, which is what makes a contradictory list unstorable.
On a phone
The knowledge base is one of the modules built to work properly on a phone. Search sits in a bar across the top of the article list rather than behind a menu, the tag filters move into a panel of their own, and an article's content โ wide screenshots, tables, code blocks โ is contained so it can be read without the page falling apart. An article's own actions sit in a bar pinned to the bottom of the screen, where a thumb is - Share, Edit and, since 5.15.0, a ... button whose Move, History, Permissions and Archive open as a sheet from the bottom. Nothing changes on the desktop. See Mobile: Knowledge.
Domains (3.0.0)
An article can be a runbook for one or more domains - how to move a domain's DNS, how it is renewed, who to call. Link them in the article's editor (with its documents); readers see the linked domains listed under the article, and nothing when there are none. The domain's own Connections tab lists its runbooks too. Shown only to analysts who can open Domains. See Domains โ Connections.