Skip to content

Phase 1: data model with 13 IPF objects - #2

Merged
fiammybe merged 1 commit into
mainfrom
claude/project-thread-kfbxfw
Oct 25, 2026
Merged

fiammybe merged 1 commit into
mainfrom
claude/project-thread-kfbxfw

Conversation

@fiammybe

Copy link
Copy Markdown
Contributor

Phase 1 of the rebuild plan: the full data layer. There are still no admin screens or forum pages; those are phases 2 to 4.

What is in it

  • 13 objects with handlers in src/class/: category, forum, moderator, topic, post, attachment, report, suspension, readmark, online, digest, archive and permtemplate. The core builds one table <prefix>_imforum_<item> per item from object_items.
  • Permissions: category_access on categories, plus the eight forum permissions with iForum's gperm names (forum_access, forum_view, forum_post, forum_reply, forum_edit, forum_delete, forum_attach, forum_noapprove), so the importer can copy them unchanged. The poll permissions are gone.
  • Counters: forum_topics, forum_posts, forum_last_post_id, topic_replies and topic_first/last_post_id are recounted by synchronise() in the handler events after every insert, update and delete. Only approved items count.
  • Cascades:
    • Deleting a forum removes its topics, moderators, suspensions and read marks. Its subforums move up one level.
    • Deleting a topic removes its posts, attachments (including the files), reports, read marks and archive rows.
    • Deleting a post moves its replies up to its parent. A topic with no posts left is deleted.
    • A category that still holds forums cannot be deleted.
  • Indexes are created in imforum_db_upgrade_1(), and running it twice is safe. The FULLTEXT index is created where the server supports it; elsewhere the install carries on without it (MySQL 5.5 with InnoDB).
  • Labels for every field and permission, in English and Dutch.

Deviations from the plan

  • The Read object is now called readmark. READ is a reserved word in MySQL, and IPF uses the item name as a table alias (SELECT ... FROM table AS read), so every query on it failed without an error. A unit test now refuses reserved words as item names.
  • All time fields default to 0. Without that, MySQL in strict mode refuses the insert (Incorrect integer value: '').
  • post_edit stores the edit history as JSON instead of a serialised PHP array. That avoids unserialize() on database content; the importer will convert the old data.

Tests

  • Unit (30 tests): module definition, a class file for every item, no reserved item names, labels for every field, language parity.
  • Integration (26 tests, new): these install the module into an empty database with the core's own updater, exactly as on install, then test tables, indexes, CRUD, counters, cascades, the forum tree, moderators, suspensions, read marks, the permission template and the edit history. In CI they run on MySQL 5.5 (InnoDB), MySQL 5.7 with MyISAM and MariaDB 10.11.
  • Run locally on MariaDB 10.11 with InnoDB and with MyISAM: everything green. PHPStan reports no errors.

Not in this PR

  • Notifications on delete: phase 4.
  • Moving or merging topics, including recounting the old forum: phase 5.

Generated by Claude Code

- category, forum, moderator, topic, post, attachment, report, suspension,
  readmark, online, digest, archive and permtemplate, each with a handler;
  the core builds one table per item from object_items
- group permissions on categories and forums with iForum's gperm names
  (minus polls), forum tree with loop protection
- forum and topic counters recounted in handler events; cascading deletes
  from forum to topic to post to attachment and report; a category with
  forums cannot be deleted
- indexes in imforum_db_upgrade_1(), idempotent; FULLTEXT where the server
  supports it, the install carries on where it does not
- read marks are called readmark: READ is a reserved word and IPF uses the
  item name as a table alias
- time fields default to 0, which strict SQL mode needs
- labels and permission captions in English and Dutch
- integration tests that install the module with the core's own updater
  and exercise the handlers, in CI on MySQL 5.5, MySQL 5.7 with MyISAM and
  MariaDB 10.11

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MZy45V5RV9nx6Buq8vqKHr
@fiammybe
fiammybe merged commit 8fda9ca into main Oct 25, 2026
7 checks passed
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.

2 participants