Repository navigation
Import a board's kinerity/knowledgebase data when enabled - #13
Merged
Merged
Conversation
version_1_0_0 inserts the first seven Knowledge Base permission options with explicit ids, which leaves PostgreSQL's sequence for kb_options at 1. version_2_0_30 then let the sequence pick the id for kb_m_change_author, got 1 again, and stopped with a duplicate key, so the extension could not be enabled on a new PostgreSQL board. It now gives the option the next id itself, as version_1_0_0 does. Adds a regression test that builds kb_options the way version_1_0_0 does and runs version_2_0_30 on SQLite, MySQL and PostgreSQL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On PostgreSQL, version_1_0_3 creates the search-match unique index as
plain un_mtch. phpBB 3.3's database tools find an index by that name but
drop it as {table}_un_mtch, so version_2_0_31 stopped with "index does
not exist" and a fresh phpBB 3.3 PostgreSQL board could not enable the
extension. version_2_0_31 now drops this table's un_mtch index under
whichever name it really has before creating the four-column one. It
leaves an index of that name on another table alone.
The regression test runs the real migration chain for the table
(version_1_0_0, 1_0_3 with its data step, 2_0_2, 2_0_15, then 2_0_31
twice) on SQLite, MySQL and PostgreSQL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kinerity/knowledgebase uses the table names kb_articles and kb_categories with its own columns. New migration kinerity_tables_set_aside, which version_1_0_0 now depends on, copies kinerity's tables to kb_kinerity_* backup tables, counts the copies and drops the originals (and on PostgreSQL the sequence phpBB 4.0 leaves behind). version_2_0_32 then imports them in batches: categories with their tree, plain-text details and kinerity's board-wide permissions on every category; articles with their text, author, dates and views, the lowest category as primary and the others cross-listed, waiting articles queued and deleted or denied ones deactivated; then article counts, u_kb_view and a_manage_kb for kinerity's readers and admins, and the removal of kinerity's permissions, ACP modules, settings, notification types and extension entry. Each backup row records its new id and is claimed inside its batch's transaction, so an import that stops carries on where it stopped and two requests never convert a row twice. Enabling is refused while kinerity is enabled. docs/upgrading-from-kinerity.md describes the move, including the command line for large boards and retrying in the ACP. Tests: kb_kinerity_import_test.php against this extension's real schema on SQLite, MySQL and PostgreSQL; tests/board/kinerity_import_check.php compares a switched board with its backup tables row by row, and tests/browser/kb_kinerity_import.js checks the result in a browser. docs/testing.md records 50,000-article boards on phpBB 3.3 and 4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The category made for kinerity articles that were in no category was named in English in PHP. Its name now comes from the new language/en/default_content.php, read by inc/default_content.php in the board's default language, falling back to English. The board checker finds that category as the one the import adds, not by its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bonelifer
added a commit
that referenced
this pull request
Nov 12, 2026
EPV fails on htmlspecialchars() in inc/kinerity_import.php (merged in #13, so main fails its EPV check) and inc/intro.php. They now call phpBB's utf8_htmlspecialchars(), which does the same (ENT_COMPAT, UTF-8). inc/default_content.php no longer defines IN_PHPBB itself, which EPV also flagged; phpBB always defines it, and the tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bonelifer
added a commit
that referenced
this pull request
Nov 12, 2026
Brings in the fresh-PostgreSQL fix (#12) and the kinerity import (#13). version_2_0_30 now inserts kb_m_change_author with an explicit id, so it gets the same IDENTITY_INSERT wrapper on MSSQL as version_1_0_0, with a test. Both new docs/testing.md sections are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bonelifer
added a commit
that referenced
this pull request
Nov 12, 2026
* Add an optional introduction above the Knowledge Base index The ACP configuration page gets a switch, a text box and a Markdown option for a short introduction shown under the Knowledge Base title, on the hierarchical index and the flat index. It is written in BBCode or Markdown and stored through the same article_text service as articles. Migration version_2_0_33 adds it switched off, holding the text kinerity/knowledgebase showed above its index, and switches it on on a board imported from kinerity, so its visitors keep seeing it. Tests: kb_intro_test.php (default text, display switch, saving BBCode and Markdown, emptying, the migration and its kinerity check). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix the EPV findings from the kinerity import and the intro text EPV fails on htmlspecialchars() in inc/kinerity_import.php (merged in #13, so main fails its EPV check) and inc/intro.php. They now call phpBB's utf8_htmlspecialchars(), which does the same (ENT_COMPAT, UTF-8). inc/default_content.php no longer defines IN_PHPBB itself, which EPV also flagged; phpBB always defines it, and the tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Boards running Kailey's
kinerity/knowledgebaseextension can now move to this one: disable kinerity, keeping its data, and enable this extension. Enabling it imports kinerity's categories, articles and permissions. Nothing has to be converted by hand. The steps are indocs/upgrading-from-kinerity.md.Builds on the PostgreSQL fix PR (its two commits are at the start of this branch). Merge that one first.
How it works
kb_articlesandkb_categories, with different columns. A new migration that runs beforeversion_1_0_0copies them to backup tables (kb_kinerity_*) and checks that every row arrived. Only then does it drop the originals, so this extension can create its own tables. The backup tables stay.version_2_0_32imports from the backup, a batch at a time:u_kb_viewanda_manage_kb.On large boards, use the command line. phpBB's ACP enables an extension in one page load, so a large import can end on a time-out page while PHP keeps going. Nothing is lost: purge the cache and enable again. The guide explains this.
Tests
tests/kb_kinerity_import_test.phpbuilds this extension's real tables from its own migrations and covers each case above, including an import stopped part way and two imports running at once, on SQLite, MySQL and PostgreSQL. The full suite passes on phpBB 3.3.x and master, none skipped.tests/board/kinerity_import_check.phpcompared every imported row with kinerity's. All checks passed on every board.tests/browser/kb_kinerity_import.jspassed 14 browser checks on the result.docs/testing.md.Not imported: old kinerity links (
/kb/viewarticle?a=…) don't lead to the new article ids; the backup tables record old and new ids.The board fixture and the ACP helper used for testing are in phpbbmodders/seed-forum and phpbbmodders/phpbb-release-tools PRs.
Investigated and written by Claude on behalf of William Jacoby (bonelifer).
🤖 Generated with Claude Code