Skip to content

Keep category memberships, for template categories, sub-categories and sort keys - #81

Merged
bonelifer merged 1 commit into
mainfrom
category-membership
Oct 15, 2026
Merged

bonelifer merged 1 commit into
mainfrom
category-membership

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

Which articles are in which category is now kept in a table (wiki_category_member). It is worked out from an article's rendered live version whenever that changes, and for every article that uses a template when the template changes. That gives:

  • Categories added by templates: [[Category:Stubs]] inside a template's <includeonly> lists every article using it in Stubs.
  • Sub-categories: a category page that is in another category is listed above that category's articles.
  • Sort keys: [[Category:Name|Key]] files the article under Key. The parser now keeps the key.
  • [[:Category:Name]]: a plain link to the category page that doesn't put the article in it.

Existing articles are filled in by a cron task, 50 at a time, after the update. Until it finishes, the category lists read the articles' text as before. The table uses a numeric key, since two names would make too long a key for SQL Server.

Claude tested it:

  • Unit tests on phpBB 3.3 and master, with database tests for sorting, sub-categories, counts, removal and the batch fill.
  • On the seed-forum 3.3 board: the old lists before the fill; the cron fill (two runs, same counts); then, through the edit form, a template's includeonly category reaching the article that uses it, a sub-category, a sort key changing the order, a [[:Category:...]] link, and a move taking the memberships along. Found and fixed: a category whose only member was a sub-category showed the "create" page.
  • On the seed-forum 4.0 board: the migration and the cron fill.

Investigated and written by Claude on behalf of William Jacoby (bonelifer).

🤖 Generated with Claude Code

…d sort keys

Which articles are in which category is now kept in a table, worked out
from an article's rendered live version whenever it changes, and for
every article that uses a template when the template changes. That lets
a category list the articles a template puts in it, list the category
pages that are in it as sub-categories, and sort its members by the key
after the bar, which the parser now keeps. [[:Category:Name]] is a plain
link to the category's page. A cron task fills the table for existing
articles in batches; until then the lists work as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bonelifer
bonelifer merged commit f035b7c into main Oct 15, 2026
58 checks passed
@bonelifer
bonelifer deleted the category-membership branch October 15, 2026 04:20
bonelifer added a commit that referenced this pull request Oct 15, 2026
A category page now lists its sub-categories (#81) a page at a time,
with their own page links (`substart`), so moving through them keeps the
page of articles, and the other way round. Each sub-category shows how
many articles it holds, and how many sub-categories when it has any,
counted for the whole page in one query (`category_members::counts()`).
The TODO's last category item is done.

Claude tested it:
- Unit tests on phpBB 3.3 and master, with a database test for the
counts (a version that isn't live doesn't count).
- On the seed-forum 3.3 board, at two items per page, with four
sub-categories and three articles in one category: the sort-key order
and counts, page 2 of the sub-categories, and each list's links keeping
the other's page.
- On the seed-forum 4.0 board: the category pages load.

---

Investigated and written by [Claude](https://www.anthropic.com/claude)
on behalf of William Jacoby ([bonelifer](https://github.com/bonelifer)).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant